C++ Online Quiz


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

Q 1 - The default access specifer for the class members is

A - public

B - private

C - protected

D - None of the above.

Answer : B

Explaination

If a member/s appear in the class with following no access specifier, the default is private.

Q 2 - ‘cin’ is an __

A - Class

B - Object

C - Package

D - Namespace

Answer : B

Explaination

It’s an object of istream class.

Q 3 - We can have varying number of arguments for the overloaded form of () operator.

A - True

B - False

Answer : A

Explaination

Q 4 - Escape sequence character '\0' occupies __ amount of memory.

A - 0

B - 1

C - 2

D - 4

Answer : B

Explaination

As it is also a character is occupies 1 byte of memory.

Q 5 - Which feature of the OOPS gives the concept of reusability?

A - Abstraction

B - Encapsulation

C - Inheritance

D - None of the above.

Answer : C

Explaination

The process of designing a new class (derived) from the existing (base) class to acquire the attributes of the existing is called as inheritance. Inheritance gives the concept of reusability for code/software components.

Answer : A

Explaination

Q 7 - i) Exception handling technically provides multi branching.

ii) Exception handling can be mimicked using ‘goto’ construct.

A - Only (i) is true

B - Only (ii) is true

C - Both (i) & (ii) are true

D - Both (i) && (ii) are false

Answer : A

Explaination

goto just does the unconditional branching.

Answer : B

Explaination

Compilation is the process of translating high level language statements into equivalent machine code, which is object code.

Q 9 - A single line comment in C++ language source code can begin with _____

A - ;

B - :

C - /*

D - //

Answer : D

Explaination

Two immediate forward slashes are used to comment a single line. A single can be commented by beginning with /* and should be terminated with */ , in general used for multi-line comments.

Q 10 - i) Exceptions can be traced and controlled using conditional statements.

ii) For critical exceptions compiler provides the handler

A - Only (i) is true

B - Only (ii) is true

C - Both (i) & (ii) are true

D - Both (i) && (ii) are false

Answer : B

Explaination

Conditional statements are used to take alternate actions depending upon certain condition but not multi branching. C++ too provides some critical exception handlers.

cpp_questions_answers.htm
Advertisements