C++ Review Questions
Review C++ operators and conditional statements with questions on arithmetic, assignment, relational, and logical operators, if-else logic, and nested conditions.
1. Basics
Operators: Basics
Answer the following questions.
- What is an operator?
- What is an operand?
- What is an expression?
- What is a unary operator?
- What is a binary operator?
- What is the purpose of
+?
- What is the purpose of
%?
- What is the difference between
= and ==?
- What is the difference between
++x and x++?
- What is the purpose of
--?
- What does
>= mean?
- What does
!= mean?
- What is the purpose of
&&?
- What is the purpose of
||?
- What does
! do?
- What is the difference between
x += 5 and x = x + 5?
- What does
x *= 2 do?
- What is the result of
20 % 6?
- What does a relational operator return?
- Why are logical operators used with conditions?
Conditional Statements
if else-if
- What is the purpose of an
if statement?
- What is the difference between
if-else and else-if?
- What is a nested
if statement?
- Why should higher grade thresholds be checked first?
- Can an
if statement exist inside another if statement?
- What happens when every condition in an
if-else-if ladder is false and no final else is provided?