Questions

Q:

Write a c program for binary search.

Answer

#include<stdio.h>
int main(){

    int a[10],i,n,m,c=0,l,u,mid;

    printf("Enter the size of an array: ");
    scanf("%d",&n);

    printf("Enter the elements in ascending order: ");
    for(i=0;i<n;i++){
         scanf("%d",&a[i]);
    }

    printf("Enter the number to be search: ");
    scanf("%d",&m);

    l=0,u=n-1;
    while(l<=u){
         mid=(l+u)/2;
         if(m==a[mid]){
             c=1;
             break;
         }
         else if(m<a[mid]){
             u=mid-1;
         }
         else
             l=mid+1;
    }
    if(c==0)
         printf("The number is not found.");
    else
         printf("The number is found.");

    return 0;
}

Sample output:
Enter the size of an array: 5
Enter the elements in ascending order: 4 7 8 11 21
Enter the number to be search: 11
The number is found.

Report Error

View answer Workspace Report Error Discuss

Subject: Programming

0 2735
Q:

Elastomers can extend upto

A) ten times their original dimensions B) seven times their original dimensions
C) five times their original dimensions D) three times their original dimensions
 
Answer & Explanation Answer: B) seven times their original dimensions

Explanation:

An elastomer is a polymer with viscoelasticity which have low youngs modulus with weak intermolecular forces when compared with other materials.

Report Error

View Answer Report Error Discuss

Filed Under: General Science
Exam Prep: AIEEE , Bank Exams , CAT , GATE
Job Role: Analyst , Bank Clerk , Bank PO

3 2735
Q:

Which statement about general education policy is most accurate?

A) It is set by multiple levels of the government. B) It is determined by local school boards.
C) It is controlled only by the federal government. D) It provides its funding at the state level.
 
Answer & Explanation Answer: A) It is set by multiple levels of the government.

Explanation:

General education policy is set by multiple levels of the government like Federal, state and local governments. 

Report Error

View Answer Report Error Discuss

Filed Under: Indian Politics
Exam Prep: AIEEE , Bank Exams
Job Role: Analyst , Bank Clerk , Bank PO

1 2734
Q:

Aniruddh's birthday is on Sunday 2nd April. On what day of the week will be Priyansh's Birthday in the same year if Priyansh was born on 28th October?

A) Saturday B) Wednesday
C) Friday D) Thursday
 
Answer & Explanation Answer: A) Saturday

Explanation:
Report Error

View Answer Report Error Discuss

6 2734
Q:

Shahi Litchi of which recently got a GI tag?

A) Telangana B) Bihar
C) Odisha D) Maharastra
 
Answer & Explanation Answer: B) Bihar

Explanation:

Shahi Litchi of Bihar recently got a GI tag and got official recognition for Muzaffarpur in Bihar.

Report Error

View Answer Report Error Discuss

Filed Under: Indian Geography
Exam Prep: AIEEE , Bank Exams , CAT
Job Role: Analyst , Bank Clerk , Bank PO

3 2734
Q:

Bleeding of gums, falling of teeth, fragile bones and delayed wound healing occur due to the deficiency of which one of the following vitamins?

A) Vitamin C B) Vitamin K
C) Vitamin D D) Vitamin B
 
Answer & Explanation Answer: A) Vitamin C

Explanation:

Deficiency of Vitamin C causes Scurvy, Swelling of gums etc.Vitamin K causes Non-clotting of blood ,Vitamin D causes Rickets in children and Osteomalasia in adults, Vitamin B 1 causes Beriberi,B2 causes Cracking of skin,reddish eye,cracking of tongue,B3 causes Whitening of hair ,mentally retardness ,B5 causes Pallagra or 4D syndrome,B6 causes Anemia,skin disease ,B7 causes Paralysis,hair falling,B11 causes Dysentery and B12 causes Jaundice and Teroile Glutemi

Report Error

View Answer Report Error Discuss

Filed Under: Biology
Exam Prep: Bank Exams

1 2733
Q:

An electric fuse is based on

A) the chemical effect of the current B) the magnetic effect of the current
C) the heating effect of the current D) All of the above
 
Answer & Explanation Answer: C) the heating effect of the current

Explanation:

An electric fuse is based on the heating effect of the current.

Report Error

View Answer Report Error Discuss

Filed Under: Physics
Exam Prep: AIEEE , Bank Exams , CAT
Job Role: Analyst , Bank Clerk , Bank PO

1 2733
Q:

The country where the military has imposed martial law amid a political crisis

Answer

Thailand

Report Error

View answer Workspace Report Error Discuss

0 2733