Questions

Q:

What would be the output of the following program?

main()

{

   struct emp

   {

        char *n;

        int age;

   };

   struct emp e1 = { "Dravid", 23};

   struct emp e2 = e1;

   strupr (e2.n);

   printf ("\n%s",e1.n);

}

Answer

DRAVID


When a structure is assigned, passed, or returned, the copying is done monolithically. This means that the copies of any pointer fields will point to the same place as the original. In other words, anything pointed to is not copied. Hence, on changing the name through e2.n it automatically changed e1.n

Report Error

View answer Workspace Report Error Discuss

Subject: Programming

0 2655
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 2655
Q:

Head Quaters of NATO is located in 

A) Newyork B) Brussels
C) Alaska D) California
 
Answer & Explanation Answer: B) Brussels

Explanation:

Head Quaters of NATO is located in Brussels

Report Error

View Answer Report Error Discuss

Filed Under: World Organisations

5 2655
Q:

How many Nucleotides make up a Codon?

A) 3 B) 4
C) 5 D) 6
 
Answer & Explanation Answer: A) 3

Explanation:

3 Nucleotides make up a Codon. 

The nucleotide triplet that encodes an amino acid is called a codon.

Each group of three nucleotides encodes one amino acid.

Report Error

View Answer Report Error Discuss

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

6 2654
Q:

Insert command falls in which sub-language of SQL ?

A) DCL B) DQL
C) DML D) DDL
 
Answer & Explanation Answer: C) DML

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Oracle Certification

5 2653
Q:

There are five boxes in a cargo hold. The weight of the first box is 200 kg and the weight of the second box is 20% higher than the weight of the third box, whose weight is 25% higher than the first box’s weight. The fourth box at 350 kg is 30% lighter than the fifth box. Find the difference in the average weight of the four heaviest boxes and the four lightest boxes.

A) 51.5 kg B) 75 kg
C) 37.5 kg D) 112.5 kg
 
Answer & Explanation Answer: B) 75 kg

Explanation:
Report Error

View Answer Report Error Discuss

0 2653
Q:

One of the following companies does have business interest in both oil and shipping sectors. Identify this.

A) Tata Group B) Reliance Group
C) Essar Group D) ONGC
 
Answer & Explanation Answer: C) Essar Group

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Business Awareness

6 2652
Q:

Refractive Index of glass with respect to water is

A) 4/3 B) 9/8
C) 2/3 D) 8/9
 
Answer & Explanation Answer: D) 8/9

Explanation:

Refractive Index of glass with respect to water can be calculated by 

(Refractive Index of glass with respect to air) × (1/Refractive Index of water with respect to air)

 

We know that,

Refractive Index of glass with respect to air = 4/3

Refractive index of water with respect to air = 3/2

 

Hence, Refractive Index of glass with respect to water = (4/3) x (2/3) = 8/9.

Report Error

View Answer Report Error Discuss

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

4 2652