Q1. Distinguish between a unary, a binary and a ternary operator. Give examples of C++ operators for each one of them.
Ans. A unary operator requires a single operand. unary+, unary-, ++, –, sizeof etc. are some unary operators in C++.
A binary operator requires two operands.
+(add), -(subtract), *, /, % etc. are some binary operators in C++.
A ternary operator requires three operands. ?: (the conditional operator) is a ternary operator in C++.