References

6

Which of the following statement is correct about the program given below?

#include 
int main()
{
    int x = 0;
    int &y = x; y = 5; 
    while(x <= 5)
    {
        cout<< y++ << " ";
        x++;
    }
    cout<< x; 
    return 0; 
}
A. The program will print the output 5 6 7 8 9 10.
B. The program will print the output 5 6 7 8 9 10 7.
C. The program will print the output 5 7.
D. It will result in a compile time error.

7

Which of the following statement is correct about the program given below?

#include 
int main()
{
    int x = 10, y = 20;
    int *ptr = &x;
    int &ref = y;

    *ptr++;
     ref++;    

    cout<< x << " " << y;
    return 0; 
}
A. The program will print the output 10 20.
B. The program will print the output 10 21.
C. The program will print the output 11 20.
D. The program will print the output 11 21.
E. It will result in a compile time error.

8

Which of the following statement is correct about the program given below?

#include 
enum bix
{
    a=1, b, c
};
int main()
{
    int x = c;
    int &y = x;
    int &z = x;
    y = b;
    cout<< z--;
    return 0; 
}
A. It will result in a compile time error.
B. The program will print the output 1.
C. The program will print the output 2.
D. The program will print the output 3.

9

Which of the following statement is correct about the program given below?

#include 
int main()
{
    int x = 10;
    int &y = x;
    x = 25;
    y = 50;
    cout<< x << " " << --y;
    return 0; 
}
A. The program will print the output 25 49.
B. It will result in a compile time error.
C. The program will print the output 50 50.
D. The program will print the output 49 49.

10

Which of the following statement is correct about the program given below?

#include 
int main()
{
    int x = 10;
    int &y = x;
    x++;
    cout<< x << " " << y++;
    return 0; 
}
A. The program will print the output 11 12.
B. The program will print the output 12 11.
C. The program will print the output 12 13.
D. It will result in a compile time error.