Hey Guys , Welcome to CSE Study247, This page provides you with C++ Programming MCQs SET-2 which is useful for Semester and competitive exams.
Q.1 do while loop is called as ?
Entry control
Exit control
Per tested
None
Explanation
A do-while loop is an exit-controlled loop because it executes the body first and then tests the condition at the end.
Q.2 Which of the following is logical AND Operator?
||
&&
&
!
Explanation
In C++, the double ampersand (&&) is the logical AND operator used to combine two boolean expressions.
Q.3 A pure virtual function is a virtual function that?
returns nothing
has no body
is used in base class
None
Explanation
A pure virtual function is declared in a base class with ‘= 0’ and has no implementation (no body) in that class.
” d=”None” correct=”c” ans=”The square brackets [ ] are the subscript operator, primarily used to access elements of an array.”]
Q.5 A pointer is?
address of a variable
a variable for storing address
Indication of the variable to be accessed next
None
Explanation
A pointer is a special variable that stores the memory address of another variable rather than a direct value.
Q.6 Which of the following is the address of operator?
&&
*
$
&
Explanation
The single ampersand (&) is the address-of operator, used to retrieve the memory address of a variable.
Q.7 Which looping is best used when we know the number of iterations?
for loop
do while loop
while loop
None
Explanation
A for loop is ideal when the exact number of iterations is known in advance, as it handles initialization, condition, and increment in one line.
Q.8 Which of the following is the scope resolution operator?
;
::
:
None
Explanation
The double colon (::) is the scope resolution operator, used to access global variables or define class members outside the class declaration.
Q.9 A relational operator:
Assigns operand to another
Compares two operands
logically combines two operators
None
Explanation
Relational operators (like , ==) are used to compare two values and return a boolean result based on their relationship.
Q.10 The library function exit() causes an exit from:
Program in which it occurs
Function in which it occurs
loop in which it occurs
None
Explanation
The exit() function immediately terminates the entire program and returns control to the operating system.
Q.11 goto is a:
variable
label
operator
Function
Explanation
The goto statement is a jump statement that transfers control to a location identified by a specific label.
Q.12 What is the other name used for functions inside a class?
Member Variables
Member Function
Class Function
None
Explanation
Functions that are declared or defined inside a class are officially referred to as Member Functions.
Q.13 if else statement can be replaced by which operator?
Bitwise operator
Conditional operator
logical operator
None
Explanation
The conditional operator (?:), also known as the ternary operator, can be used as a shorthand for simple if-else statements.
Q.14 Which of the following cannot be a friend?
Function
Class
Object
Operator Function
Explanation
In C++, functions and classes can be declared as friends to access private members, but a specific instance (object) cannot.
Q.15 How many types of polymorphism are there in C++?
1
2
3
4
Explanation
There are two main types of polymorphism in C++: Compile-time (static) and Run-time (dynamic) polymorphism.
Q.16 How compile time polymorphism is implemented in C++?
using inheritance
using Templates
using virtual function
None
Explanation
Compile-time polymorphism is achieved using function/operator overloading and templates.
Q.17 Which members are inherited but not accessible in any case?
Private
Protected
Both A & B
None
Explanation
Private members of a base class are inherited by the derived class, but they are not directly accessible by that derived class.
Q.18 Which of the following is C++ equivalent for scanf()?
cout
cin
print
None
Explanation
The ‘cin’ object in C++ is used with the extraction operator ( ) to take user input, similar to scanf() in C.
Q.19 C++ uses:
Top-Down approach
Bottom-up approach
Left-left
Right-Right
Explanation
C++ is an Object-Oriented Programming language and follows a bottom-up design approach for program development.
Q.20 Which of the following class allows to declare only one object of it?
Abstract class
Virtual class
Singleton class
None
Explanation
A Singleton class is a design pattern that restricts the instantiation of a class to a single object.