C++ MCQ Questions - Operators
This section focuses on the "Operators" in C++ programming langauge. These Multiple Choice Questions (MCQ) should be practiced to improve the C++ programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.
1. + operator will do?
A. Multiplies both operands
B. Subtracts second operand from the first
C. Adds two operands
D. Increment operator
View Answer
Ans : C
Explanation: + : Adds two operands
2. Which of the following is not Arithmetic Operators?
A. ++
B. --
C. **
D. %
View Answer
Ans : C
Explanation: ** is not Arithmetic Operators
3. Which operator checks if the values of two operands are equal or not, if values are not equal then condition becomes true?
A. >=
B. <=
C. !=
D. >
View Answer
Ans : C
Explanation: != : Checks if the values of two operands are equal or not, if values are not equal then condition becomes true.
4. If both the operands are non-zero, then condition becomes true known as?
A. &
B. &&
C. ||
D. !
View Answer
Ans : B
Explanation: && Called Logical AND operator. If both the operands are non-zero, then condition becomes true.
5. Which of the following is Binary Left Shift Operator?
A. >>
B. <<
C. ||
D. $$
View Answer
Ans : B
Explanation: << is Binary Left Shift Operator. The left operands value is moved left by the number of bits specified by the right operand.
6. Casting operators convert one data type to another.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: True, Casting operators convert one data type to another.
7. Which operator is having the right to left associativity in the following?
A. Array subscripting
B. Function call
C. Addition and subtraction
D. Type cast
View Answer
Ans : D
Explanation: There are many rights to left associativity operators in C++, which means they are evaluation is done from right to left. Type Cast is one of them.
8. Pointer operator * is pointer to a variable.
A. Yes
B. No
C. Can be yes or no
D. Can not say
View Answer
Ans : A
Explanation: Yes, Pointer operator * is pointer to a variable.
9. What is this operator called ?:?
A. conditional
B. relational
C. casting operator
D. unrelational
View Answer
Ans : A
Explanation: In this operator, if the condition is true means, it will return the first operator, otherwise second operator.
10. What is the use of dynamic_cast operator?
A. it converts virtual base class to derived class
B. it converts the virtual base object to derived objects
C. it will convert the operator based on precedence
D. it converts the virtual base object to derived class
View Answer
Ans : A
Explanation: Because the dynamic_cast operator is used to convert from base class to derived class.
Discussion