You are on page 1of 2

1. What is Operator in C++?

Answer: An operator is a symbol used for performing operations on operands. An operator


operates operands. The operations can be mathematical or logical. There are different types of
operators in C++ for performing different operations.

2. Enumerate and discuss the different types of


Operators in C++.
Answer:
● Arithmetic Operators- In C++, Arithmetic Operators are symbols used to perform
common arithmetic operations like addition, subtraction, multiplication, division, modulus,
etc. Arithmetic Operators are operators which are used within the equation to perform a
number of basic mathematical calculations.
● Assignment Operators-In the C++ programming language, the assignment operator, =,
is the operator used for assignment. Like most other operators in C++, it can be
overloaded
● Relational Operators- relational operator is used to check the relationship between two
operands. For example, // checks if a is greater than b a > b; Here, > is a relational
operator. It checks if a is greater than b or not.
● Logical Operators- Logical operators are used to check whether an expression is true
or false. If the expression is true, it returns 1 whereas if the expression is false, it returns
0.
● Bitwise Operators-Bitwise operators are characters that represent actions (bitwise
operations) to be performed on single bits. They operate at the binary level and perform
operations on bit patterns that involve the manipulation of individual bits.

3. What is Conditional Statement?


Answer: Alternatively known as a conditional expression, conditional flow statement, and
conditional processing, a conditional statement is a set of rules performed if a certain condition
is met. It is sometimes referred to as an If-Then statement, because IF a condition is met, THEN
an action is performed.

In the study of logic, there are two types of statements, conditional statement and bi-conditional
statement.
These statements are formed by combining two statements, which are called compound
statements.
Suppose a statement is- if it rains, then we don't play.
This is a combination of two statements. These types of statements are mainly used in
computer programming languages such as c, c++, etc.
4. Enumerate and discuss the different Conditional Statement in C++.
Answer:
● Use if to specify a block of code to be executed, if a specified condition is true
● Use else to specify a block of code to be executed, if the same condition is false
● Use else if to specify a new condition to test, if the first condition is false
● Use switch to specify many alternative blocks of code to be executed

You might also like