C++ Online Quiz


Advertisements


Following quiz provides Multiple Choice Questions (MCQs) related to C++ Framework. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Questions and Answers

Answer : D

Explaination

C++ supports all the forms of inheritance.

Q 2 - Choose the respective delete operator usage for the expression ‘ptr=new int[100]’.

A - delete ptr;

B - delete ptr[];

C - delete[] ptr;

D - []delete ptr;

Answer : C

Explaination

Answer : B

Explaination

Both the mentioned operators cannot be overloaded.

Q 6 - i) single file can be opened by several streams simultaneously.

ii) several files simultaneously can be opened by a single stream

A - (i) and (ii) are true

B - (i) and (ii) are false

C - Only (i) is true

D - Only (ii) is true

Answer : C

Explaination

Answer : A

Explaination

When the program is in execution phase the possible unavoidable error is called as an exception.

Q 8 - What is the output of the following program?

#include<iostream>

using namespace std;
main() { 
   int i = 13, j = 60;
   
   i^=j;
   j^=i;
   i^=j;
   cout<<i<<" "<<j;
}

A - 73 73

B - 60 13

C - 13 60

D - 60 60

Answer : B

Explaination

60 13, its swapping.

#include<iostream>

using namespace std;
main() { 
   int i = 13, j = 60;
   
   i^=j;
   j^=i;
   i^=j;
   cout<<i<<" "<<j;
}

Q 9 - Special symbol permitted with in the identifier name.

A - $

B - @

C - _

D - .

Answer : C

Explaination

The only permitted special symbol is under score (_) in the identifier.

Q 10 - What is the output of the following program?

#include<iostream>

using namespace std;
main() { 
   class student { 
      int rno = 10;
   } v;
  
   cout<<v.rno;
}

A - 10

B - Garbage

C - Runtime error

D - Compile error

Answer : D

Explaination

Class member variables cannot be initialized.

#include<iostream>

using namespace std;
main() { 
   class student { 
      int rno = 10;
   } v;
  
   cout<<v.rno;
}

cpp_questions_answers.htm

Advertisements