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 2684
Q:

In Which three languages is the Rosetta Stone written?

Answer

Greek, demotic Egyptian and hieroglyphics.

Report Error

View answer Workspace Report Error Discuss

Subject: World History

0 2682
Q:

The Motto of Defence academy?

A) Do or Die B) Service Before Self
C) YES, OF COURSE WE CAN, RIGHT? D) Yours is here
 
Answer & Explanation Answer: B) Service Before Self

Explanation:

The National Defence Academy is formed by combining the cadets of three services Army, Navy and Air force. The Defence academy established on 7 December 1954. Its motto is "Service Before Self."

Report Error

View Answer Report Error Discuss

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

2 2682
Q:

What was the name of the mission that first landed men on the moon?

Answer

Apollo 11

Report Error

View answer Workspace Report Error Discuss

0 2681
Q:

The fog that commonly occurs along the sea-coasts is of the ______ type

A) radiation B) advection
C) frontal D) convection
 
Answer & Explanation Answer: B) advection

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: World Geography

0 2681
Q:

Sachin Tendulkar hit his 100th international century against which among the following team?

A) Bangladesh B) Pakistan
C) Sri Lanka D) England
 
Answer & Explanation Answer: A) Bangladesh

Explanation:
Report Error

View Answer Report Error Discuss

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

4 2681
Q:

Select the correct statement about the uterine cycle.

A) During the secretory phase, estrogen levels are at their highest. B) During the proliferative phase, levels of progesterone rise as the follicle begins to produce more hormone.
C) If fertilization occurs, the corpus luteum is maintained by a hormone secreted by the developing embryo. D) The menstrual phase of the cycle is from day 1 to day 8.
 
Answer & Explanation Answer: C) If fertilization occurs, the corpus luteum is maintained by a hormone secreted by the developing embryo.

Explanation:

"If fertilization occurs, the corpus luteum is maintained by a hormone secreted by the developing embryo." is the only correct statement about the uterine cycle among the options.

Report Error

View Answer Report Error Discuss

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

4 2681
Q:

In which of the following, the cellular power plants - Mitochondria are absent?

A) Bacteria B) Red Algae
C) Brown Algae D) Green Algae
 
Answer & Explanation Answer: A) Bacteria

Explanation:

Mitochondria is absent in Bacteria as well as in Blue Green Algae. They are seen in eukaryotic cells for respiration purpose.

Report Error

View Answer Report Error Discuss

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

4 2680