Sail E0 Webinar

MCQs

Total Questions : 37 | Page 2 of 4 pages
Question 11.


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


#include
int main()
{
int x = 10;
int &y = x;
x++;
cout
  1.    The program will print the output 11 12.
  2.    The program will print the output 12 11.
  3.    The program will print the output 12 13.
  4.    It will result in a compile time error.
 Discuss Question
Answer: Option B. -> The program will print the output 12 11.


Question 12.


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
  1.    The program will print the output 25 49.
  2.    It will result in a compile time error.
  3.    The program will print the output 50 50.
  4.    The program will print the output 49 49.
 Discuss Question
Answer: Option D. -> The program will print the output 49 49.


Question 13.


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
  1.    The program will print the output 10 20.
  2.    The program will print the output 10 21.
  3.    The program will print the output 11 20.
  4.    The program will print the output 11 21.
  5.    It will result in a compile time error.
 Discuss Question
Answer: Option B. -> The program will print the output 10 21.


Question 14.


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
  1.    The program will print the output 5 6 7 8 9 10.
  2.    The program will print the output 5 6 7 8 9 10 7.
  3.    The program will print the output 5 7.
  4.    It will result in a compile time error.
 Discuss Question
Answer: Option C. -> The program will print the output 5 7.


Question 15.


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
  1.    It will result in a compile time error.
  2.    The program will print the output 1.
  3.    The program will print the output 2.
  4.    The program will print the output 3.
 Discuss Question
Answer: Option C. -> The program will print the output 2.


Question 16.


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


#include
int main()
{
int x = 80;
int &y = x;
x++;
cout
  1.    The program will print the output 80 80.
  2.    The program will print the output 81 80.
  3.    The program will print the output 81 81.
  4.    It will result in a compile time error.
 Discuss Question
Answer: Option A. -> The program will print the output 80 80.


Question 17.

Which of the following statements is correct?

       1. Pointer to a reference and reference to a pointer both are valid.

       2. When we use reference, we are actually referring to a referent.


  1.    Only 1 is correct.
  2.    Only 2 is correct.
  3.    Both 1 and 2 are correct.
  4.    Both 1 and 2 are incorrect.
 Discuss Question
Answer: Option C. -> Both 1 and 2 are correct.


Question 18.

Which of the following statement is correct?


  1.    A reference is declared using * operator.
  2.    Once a reference variable has been defined to refer to a particular variable it can refer to any other variable.
  3.    A reference must always be initialized within classes.
  4.    A variable can have multiple references.
 Discuss Question
Answer: Option D. -> A variable can have multiple references.


Question 19.


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


#include
int main()
{
int x = 80;
int y& = x;
x++;
cout
  1.    The program will print the output 80 80.
  2.    The program will print the output 81 80.
  3.    The program will print the output 81 81.
  4.    It will result in a compile time error.
 Discuss Question
Answer: Option D. -> It will result in a compile time error.


Question 20.

Which of the following statement is correct?


  1.    An array of references is acceptable.
  2.    Once a reference variable has been defined to refer to a particular variable it can refer to any other variable.
  3.    An array of references is not acceptable.
  4.    Reference is like a structure.
 Discuss Question
Answer: Option C. -> An array of references is not acceptable.


Latest Videos

Latest Test Papers