Input and Output Handling Long Questions Ch. No 3
Q.No1 Describe how basic and compound assignment operators are used?
Ans: Basic Assignment Operator:
The basic assignment operator is =
. this is used to assign value of an expression to a variable. It has the
general form:
variable = expression
where
expression may be a constant, another variable to which a value has been
assigned or a formula to be evaluated. For example:
sum = a + b;
Compound
Assignment Operator:
In addition to = , there are a number of assignment operators unique to
C. these include +=, -=, /= and %= etc. suppose op represents an arithematic operator.
Then, the compound assignment operator has the following general form.
variable
op = expression
This is
equivalent to:
variable
= variable op expression
For example:
sum
= sum + n; or sum += n;
➤➤➤➤➤➤➤➤➤➤➤➤
Q.No2 Describe the functions of the following operators?
Ans: Relational Operator:
These are used to compare two values of the same type. These are used in
expressions when a decision is to be based on a condition. After evaluation of
a relational expression, the result produced is either True or False. These
operators are used for decision making.
Types of
Relational Operators:
Six types of relational
operators are available in C. These are;
Operator
|
Definition
|
= =
|
equal to
|
!=
|
not equal to
|
<
|
less than
|
>
|
greater than
|
< =
|
less than or
equal to
|
> =
|
greater than or
equal to
|
➤➤➤➤➤➤➤➤➤➤➤➤
Fbise Notes-Computer | Input and Output Handling Long Question Ch.No 3
Reviewed by fbisenotes
on
July 24, 2019
Rating:
No comments: