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 2683
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:

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:

A VM/VSE customer wants to implement a WAS on an existing zSeries server. On which of the following operating environments would WAS best be implemented?

A) VSE B) z/VM
C) z/OS D) Linux
 
Answer & Explanation Answer: D) Linux

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: IBM Certification

1 2680
Q:

Designing pricing strategies and programs :

How do buyers respond to price changes?

Answer

Depending upon the increase or decrease in price rates, buyers may respond accordingly. Some buyers may assume that quality of the product may have reduced to to reduction in price or that the company may not be selling the product as per expectations. The other assumption that buyers may make is that prices may go down in the future and so may delay purchase. On the other hand increased price may lead to a decrease in demand as the product may be more costly for the consumers who may switch to another seller offering similar products at lower prices.

Report Error

View answer Workspace Report Error Discuss

0 2680