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 - A constructor can be virtual.

A - True

B - False

Answer : B


The purpose of the constructor cannot be overridden in the derived class hence constructor cannot be a virtual.

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


Answer : B


Both the mentioned operators cannot be overloaded.

Q 6 - With respective to streams >> (operator) is called as

A - Insertion operator

B - Extraction operator

C - Right shift operator

D - Left shift operator

Answer : B


It extracts the data from stream into variables.

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


goto just does the unconditional branching.

Q 8 - What is the size of ‘int’?

A - 2

B - 4

C - 8

D - Compiler dependent

Answer : D


The size of ‘int’ depends upon the complier i.e. whether it is a 16 bit or 32 bit.

Q 9 - Identify the C++ compiler of Linux

A - cpp

B - g++

C - Borland

D - vc++

Answer : B


g++ is GNU C++ compiler for linux. Borland and vc++ (Microsoft visual c++) for windows.

Q 10 - What is the built in library function to compare two strings?

A - string_cmp()

B - strcmp()

C - equals()

D - str_compare()

Answer : B


strcmp() is the built in function from “string.h” to compare two strings. Returns 0 if both are same strings. Returns -1 if first < second string. Returns 1 first > second.