Technical Questions asked in MAQ-Software

  1. What will be output of following program?
    #include<stdio.h>
    #include<iostream.h>
    int main(){
    register a = 25;
    int far *p;
    p=&a;
    printf("%d ",*p);
    return 0;
    }
     
    1. 25
    2. 4
    3. Address
    4. Compilation error
    Answer: Option D
  2. Shravanti writes the following program:
    Integer i = 0,
    j while ( i < 2 )
    {
    j = 0;
    while ( j <= 3*i )
    {
    print j
    print blank space
    j = j + 3
    }
    print end-of-line \takes the cursor to the next line
    i = i + 1
    }
    What will be the output of the program?
    1. 0
      0 3
    2. 0
      0 3
      0 3 6
    3. 0
      0 3
      0 3 6 9
    4. 0
      0 3
      0 3 6
      0 3 6 9
      0 3 6 9 12
    Answer: Option A
  1. What is the output of this program?
    class main_class {
    public static void main(String args[])
    {
    if (a == 20) {
    int a= 18;
    System.out.println(x);
    }
    }
    }
    1. 20
    2. 18
    3. Compilation error
    4. Runtime error
    Answer: Option C
  2. Predict the output of the following program:
    #include<iostream.h>
    Class Green
    {
    int x;
    }
    int main()
    {
    Green g;
    cout < return0;
    }
    1. Runtime Error
    2. 0
    3. Compiler Error
    4. Garbage Value
    Answer: Option C
    As x is a private member of Class Green so it cannot be accessed outside the class. It shows a compiler error.
  3. What is the output of the following code?
    x=15;
    y=0;
    if(x=10) y=7;
    else y=1;
    cout<< y; 
    1. 7
    2. 0
    3. 1
    4. 6
Answer: Option C
Since x is not equal to 10, the flow will go to else statement hence y=1.
  1. Write one statement equivalent to the following two statements:
    x=sqr(a);
    return(x);
    1. return(sqr(a));
    2. printf("sqr(a)");
    3. return(a*a*a);
    4. printf("%d",sqr(a));
    Answer: Option A
    In the return bracket the command can be directly put.
  2. What is the output of the following code?
    x=15;
    y=0;
    if(x=10) y=7;
    else y=1;
    cout<< y;
    1. 7
    2. 0
    3. 1
    4. 6
    Answer: Option C.
    Since x is not equal to 10, the flow will go to else statement hence y=1.
Campus Placement ad
Rate Us
Views:66313