Object Oriented Programming - Find Output

1. The following program fragment
int i=10;
void main ( )

{
int i=20;
{
int i=30.;
cout << i << :: i ;    
}
}

  • Option : A
  • Explanation : :: is basically meant to manipulate a global variable, in case a local variable also has the same name.
Cancel reply
Cancel reply

4. The statements
int a = 5; cout << "FIRST" << (a <<2) << "SECOND";
outputs

  • Option : B
  • Explanation : The symbol << has a context sensitive meaning. The << in (a << 2) means shifting a by 2 bits to the left, which is nothing but multiplying it by 4. So, a < <2 will be 5 x 4 = 20 and hence the output will be FIRST20SECOND.
Cancel reply
Cancel reply

5. The following program fragment   
void main ( )
{
int x=10;
int &p=x;
cout << &p <<  &x;
}     

  • Option : D
  • Explanation : int &p=x aliases p to x. This means they refer to the same memory location. So, the address of x will be same as that of p.
Cancel reply
Cancel reply
  • Find Output Questions can be used to give quizzes by any candidate who is preparing for UGC NET Computer Science
  • This Find Output Questions section will help you test your analytical skills in a tricky method, thereby giving you an edge over other students
  • Any student who wants to prepare for DOEACC A Level, DOEACC B Level, and DOEACC C level can also use these Objective Type Questions Answer.
  • All candidates who have to appear for the Kendriya Vidyalaya Entrance exam can also refer to this mcq section.
  • You can also get access to the Find Output MCQ ebook.
  • Find Output Questions can be used in the preparation of JRF, CSIR, and various other exams.
  • You can also download pdf for these Find Output multiple-choice questions Answers.
  • This Find Output Multiple Choice Questions Answers section can also be used for the preparation of various competitive exams like UGC NET, GATE, PSU, IES, and many more.
  • Find Output Questions can be used to gain a credit score in various undergraduate and postgraduate courses like BSc, MSc and MCA
  • Find Output Questions for UGC NET Computer Science

    Find Output MCQ

    Find Output Multiple choice questions