Jun 3, 20226 min
Updated: Oct 15, 2022
Following is the top C++ Placement MCQ questions and answers to help you crack best company placements.
Basic C++ Placement Questions
C sharp
C extended
C with classes
C actual
Correct Answer: C
Explanation: It is initially called C with classes which later renamed as C++, which means increment C by 1
4 editions
10 editions
6 editions
3 editions
Correct Answer: A
Explanation:
The versions of C++ are as follows:
C++98 - 1998, C++03 - 2003, C++11 - 2011, C++14 - 2014, C++17 - 2017
4
Error in compilation
10
5
Correct Answer: A
Explanation:
The expression is evaluated from right to left, as / %* stand relatively above in operator priority list than any other operator, thus (k*2/3%10) is executed first writing the value as 0.As the value of k<<2 is 4, the output of the final expression is 4+0, i.e., 4
Q4. C++ was developed by :
Dennis Ritchie
James Gosling
Guido van Rossum
Bjarne Stroustrup
Correct Answer: D
Explanation:
Dennis Ritchie – Father of C,
James Gosling – Developer of Java,
Guido van Rossum – Python developer
0
6
10
6
Correct Answer: C
Explanation:
In the declaration of j, --i refers to decrement of i value by 1 and ++i refers to increment of i value by 1 and thus j takes the value 10.
6 Bytes
8 Bytes
2 Byte
Depends on Compiler
Correct Answer: D
Explanation:
If it is 16 bits compiler like Turbo C++, the size is 2 bytes while if it is 32 bit compiler like Dev-C++, g++ or Visual Studio, the size is 4 bytes.
Source Code -> Compiler -> Object code -> Linker -> Machine code -> (OS+CPU)
Source code -> compiler -> Byte code -> Virtual Machine
Source code -> compiler -> Byte code -> Interpreted by VM
All of the above
Correct Answer: A
Explanation:
Option b refers to Java and option c refers to python
At most 8
No limit
32
16
Correct Answer: B
Explanation:
One can instantiate any number of objects for a given class.
One cannot create his own workspace.
a class can contain another class in it
int a(10) is a different declaration from int a=10;
One can reinitialize a reference variable
Correct Answer: B
Explanation:
Int a(10) and int a=10 are same declarations, One can never reinitialize a reference variable as it might lead to memory corruption.
One can always create his own workspace by following the given procedure:
Byte
Single
Short
Integer
Correct Answer: B
Explanation:
Different types of int in c++ are as follows: Unsigned int, signed int, short int, unsigned short int, signed short int, long int, signed long int, Unsigned long int, long long int, unsigned long long int, int.
Welcome to Rootworkz Learning
We are from RootWorkz learning
Compilation Error
No output
Correct Answer: B
Explanation:
In C++ programming, 0 is false 1 is true and thus if(0) evaluates false condition
0 times
Error in execution
5 times
4 times
Correct Answer: C
Explanation:
The if condition evaluates i<5 value as true for i value from 0 to 4, and false when i takes the value i=5.
Hello from RootWorkz Learning
No output as it is not a true condition
Compilation Error
The program will not be executed
Correct Answer: A
Explanation:
Value of rwl is 90/20 and thus 4.5.Since, rwl is of int type, the 4.5 is truncated to 4
For loop
Switch case
If statement
No such operator exists
Correct Answer: C
Explanation:
Also called as short-hand if.
Outputs It is a E-Learning platform
? is used as substitute of if condition
No output as there is no such ? operator.
Option a, b are correct
Correct Answer: C
for(initialization; condition; increment/decrement)
for(increment/decrement; initialization; condition)
for(initialization, condition, increment/decrement
None of These
Correct Answer: A
No
Yes
Correct Answer: B
Explanation:
Nested switch can be achieved by writing a switch statement in any case of a already called switch statement.
They save time, reduce errors, and they make code more readable.
To perform operations on variables and values.
It can also be used to prevent execution when testing alternative code.
Correct Answer: A
//<image missing>//
0 times
99 times
100 times
101 times
Correct Answer: C
Explanation:
While loop takes I value from 0 to 99, and exists the loop for i=100
//<image missing>//
Prints the values from 0 to 5 excluding 5.
Prints the values from 0 to 5 including 5.
Infinite loop
Compilation error
Correct Answer: C
Explanation:
As there no increment to the value of i, the above loop turns out to be an infinite loop.
//<image missing>//
Error
111111
101011
101010
Correct Answer: A
Explanation:
As their no variables initialized with the names x,p
=
==
>>
<=
Correct Answer: A
Explanation:
== is called as Equality operator, >> is Left Shift operator, <= is called Lesser than or equal to
++
*
–
+
Correct Answer: A
Explanation:
3
4
5
6
Correct Answer: C
Explanation:
The 5 types of operators in C++ are as follows: Arithmetic, Assignment, Comparison, Logical and Bitwise operators
Bitwise operator
Assignment operator
Comparison operator
Logical operator
Correct Answer: D
Explanation:
&& - also called as Logical and operator.
3
1
There is no way one can comment in C++
2
Correct Answer: B
Explanation:
There are 2 ways one can comment in C++:
Single-line comment using //
Multi-line comment using /**/
3
4
5
6
Correct Answer: C
Explanation:
5 types – int, double, string, char, bool
//<image missing>//
Welcome
Welcome to RootWorkz Learning
Does not execute
None of the above
Correct Answer: B
Explanation:
The switch case start with the case 1 and exits the loop after executing the case 4 as there is break statement.
One cannot perform such functions in C++
By including cmath library.
By writing detailed code for it
None of the above
Correct Answer: B
Explanation:
cmath is a library that has many functions which allows one to perform many mathematical tasks.
There is no difference, those are just 2 keywords used for same functionality
breaks particular iteration, continue doesn’t harm any iteration
There are no such keywords named break, and continue.
Continue is used to break an iteration, break is used to jump off particular loop.
Correct Answer: D
Explanation:
Self – explanatory.
Creates a data type that can be used to group items of possibly different types into a single type
They provide an efficient way of using the same memory location for multiple purposes.
Arrays are used to store multiple values in a single variable, instead of declaring separate variables for each value.
None of the above
Correct Answer: C
Explanation:
Option a refers to structure in c++, option b refers to union in c++.
There is no difference, those are just 2 keywords used for same functionality.
There is no concept of references in C++
There is no concept of pointers in C++
References are used to refer an existing variable in another name whereas pointers are used to store address of variable.
Correct Answer: D
Explanation:
Self-explanatory
x array [ y ]
int, -10
long , 4.5
Double , 5
double, 15
Correct Answer: D
Explanation:
x refers to data type, y refers to array-size. There is no such type with the keyword Double
By using keyword arr.length()
By using keyword arr.length()
sizeof(arr)
sizeof(arr) / sizeof(arr[0])
Correct Answer: D
Explanation:
Number of elements in an array refers to length of the array. There is no such keyword called arr.length() and arr.lengthsizeof(arr) refers to total memory size of array, and thus to find number of elements ratio between total array size and size of each element gives out number of elements
Array considers homogeneous type elements only.
The pointer variable must be declared with the type to which it is referring to.
Increment and decrement operations cannot be performed on pointers
Void pointer is a pointer that has no associated data type with it.
Correct Answer: C
Explanation:
Above all are the correct statements other than the answer (marked).
//<image missing>//
Compilation Error – Constructor Missing
Nothing is printed
Undefined
Error: Improper object instantiation
Correct Answer: B
Explanation:
A class can be empty, thus there can be no error.
A class can be nested
A singleton class can have at most 1 object.
Constructor is a special type of function used for declarations
C++ does not support the concept of nested class.
Correct Answer: D
Explanation:
All the above statements are true other than the answer, i.e., C++ do support nested classes.
3
1
0
There is no concept called Constructors in C++
Correct Answer: A
Explanation:
Default, parameterized, copy are the different types of constructors in C++
Functions
Switch case
Data structures
None of the above
Correct Answer: A
Explanation:
Self – explanatory
a) OOP
b) Exception Handling
c) Pointers
d) Arrays
Correct Answers: A
Explanation:
DRY means Don’t Repeat Yourself, which means the feature of code reusability. OOP concepts are the ones which support the concept of code reusability.
Mobiprep handbooks are free downloadable placement preparation resources that can help you ace any company placement process. We have curated a list of the 40 most important MCQ questions with detailed explanations to ensure the best placement preparation.