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

How long can you commit to work with us?

Answer

I like new challenges and fortunate to develop. As long as I keep doing these, I don’t think I’ll need to alter. I’d like to consider that this relationship lasts for many years. However, I haven’t set a period of time limit as such.


 

Report Error

View answer Workspace Report Error Discuss

Subject: Human Resources

3 2683
Q:

Who is the first richest person in India?

A) Mukesh Ambani B) Azim Premji
C) Dilip Shangvi D) Lakshmi Mittal
 
Answer & Explanation Answer: A) Mukesh Ambani

Explanation:

According to 2018 January reports, Mukesh Ambani is the first richest person in India being 18th in the world, followed by Azim Premji and S.P. Hinduja in second and third places.

Report Error

View Answer Report Error Discuss

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

1 2683
Q:

What factors contribute to global winds?

A) Coriolis Effect B) Convection Cells
C) Uneven warming of the earth by the sun D) All of the above
 
Answer & Explanation Answer: D) All of the above

Explanation:

All of the factors that contribute to global winds are 

1) Uneven warming of the earth by the sun
2) Coriolis Effect
3) Convection Cells

Report Error

View Answer Report Error Discuss

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

2 2683