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

Which of the following is the sacred book of Judaism?

A) Old Testament B) Aporypha
C) Avesta D) Both (a) and (b)
 
Answer & Explanation Answer: D) Both (a) and (b)

Explanation:

The sacred books of judaism form the Old Testament and Aporypha. These books contain the history of the Jews and lay down the religious laws and ethics which they must follow.

Report Error

View Answer Report Error Discuss

Filed Under: World History

3 2654
Q:

The cotton gin was an important invention because

Answer

Cotton Gin was invented by Eli Whitney in 1793, which is used to separate cotton seeds from cotton fiber.


 


Hence, it was an important invention because it dramatically reduced the amount of time it took to separate cotton seeds from cotton fiber.

Report Error

View answer Workspace Report Error Discuss

Subject: Inventions Exam Prep: AIEEE , Bank Exams
Job Role: Analyst , Bank Clerk , Bank PO

0 2654
Q:

Backup means

A) Protecting data by copying it from the original source to a different destination B) Accessing data on tape
C) Filtering old data from the new data D) Adding more components to your network
 
Answer & Explanation Answer: A) Protecting data by copying it from the original source to a different destination

Explanation:

Protecting data by copying it from the original source to a different destination is called as Backup. When an original data is lossed, to restore the information by copying the data from the source to other destination is called as Backup or Data backup.

Report Error

View Answer Report Error Discuss

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

4 2654
Q:

Which one of the following is a search engine?

A) Bing B) Reddit
C) Pinterest D) Twitter
 
Answer & Explanation Answer: A) Bing

Explanation:
Report Error

View Answer Report Error Discuss

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

2 2653
Q:

Two metallic wires made from copper have same length but the radius of wire 1 is half of that of wire 2. The resistance of wire 1 is R. If both the wires are joined together in series, the total resistance becomes

 

A) 2R B) R/2
C) 5R/4 D) 3R/4
 
Answer & Explanation Answer: C) 5R/4

Explanation:

So, resistance of Wire 2 is R/4 as radius is half of wire 1, so area would be 4 times of wire 1.

Now for resistance in series. R= R1 + R2.

Therefore, Final R= R + R/4 = 5R/4

 

Report Error

View Answer Report Error Discuss

Filed Under: Physics
Exam Prep: Bank Exams

3 2653
Q:

Which is false concerning the use of the voting machine?

A) It does away with the need for numerous officials to count ballots. B) Fraud is nearly impossible.
C) It assures absolute secrecy. D) It was invented in 1898.
 
Answer & Explanation Answer: D) It was invented in 1898.

Explanation:

A voting machine is a machine used to register and tabulate votes.

 

In the given options, It was invented in 1898 is the false statement as it was actually invented in 1875 with some faults in it.

Report Error

View Answer Report Error Discuss

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

2 2653
Q:

Which is the first national park established in India?

A) Kanha National Park B) Keoladeo National Park
C) Jim Corbett National Park D) Jaldapara National Park
 
Answer & Explanation Answer: C) Jim Corbett National Park

Explanation:

Which_is_the_first_national_park_established_in_India1559301595.jpg image

Jim Corbett National Park is the oldest national park in India and was established in 1936 as Hailey National Park to protect the endangered Bengal tiger. It is located in Nainital district of Uttarakhand and was named after Jim Corbett, a well known hunter and naturalist. The park was the first to come under the Project Tiger initiative.

Report Error

View Answer Report Error Discuss

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

4 2653