NEW
Font size
WorksheetsToán tử trong C ++
Total questions: 20
Worksheet time: 17mins
This code will output 0.
cout<< 23 % 2 <<endl;
True
False
Which of these operators increments an integer variable by one?
**
++
--
$$
Upon execution, what is stored in variable P?
P = 14 - 6 * 2;
16
2
22
26
What should be the values of variable b and variable h to get the value of area equals to 75 where area = 0.5 * b * h;
b = 10
h = 10
b = 15
h = 15
b = 10
h = 15
b = 20
h = 10
What is the output of the given statement?
P = 20 + 4 – 50 % 6;
22
26
2
12
Which of the following is an example of arithmetic operators in C++ programming?
&&
||
%
$$
Which of the following statements is TRUE about logical And (&&) operator?
The output is 1 only when anyone of the values is 0.
The output is 1 only when all values are 0.
The output is 1 only when anyone of the values is 1.
The output is 1 only when all values are 1.
If A = 1, B = 0 and C = 1 then what is stored in W?
W = !(A && B || C);
1
0
-1
Error
If A = 0, B = 1 and C = 1 then what is stored in W?
W = (A || B && C);
0
1
-1
Error
Consider the given code. What is the value of y upon execution?
int Y = 5;
Y++;
Y++;
cout<<Y*2;
5
10
7
14
Consider the given code. What is the value of y upon execution?
int D = 5;
D--;
D--;
cout<<D+4;
3
7
9
11
The expression A += B; is equivalent to
A + B = B;
A + A = B;
B + A = A;
A = A + B;
The logical operation for which this table is shown is
AND operation.
NOT operation.
OR operation.
Which of the following is an example of a relation operator?
!
!=
++
||
If A = 5, B = 10, then which expression will output True(1)?
cout << (A > B);
cout << (A >= B);
cout << (A < B);
cout << (A == B);
If W = 20, Y = 15, then which expression will output False(0)?
cout << (W != Y);
cout << (W < Y);
cout << (W <= Y);
cout << (W == Y);
What should be the values of A and B so that the statement cout<< (A < B); becomes True(1)?
A = 2 and B = 2
A = 2 and B = 3
A = 3 and B = 2
A = 3 and B = 3
What should be the values of P and Q so that the statement cout<< (P > Q); becomes True(1)?
P = 4 and Q = 3
P = 3 and Q = 3
P = 4 and Q = 4
P = 4 and Q = 3
Consider the given expression.
(x && y) || (y && z)
The expression evaluates TRUE (1) when the values of x, y and z are
x = 0, y = 1 and z = 0.
x = 1, y = 0 and z = 0.
x = 0, y = 1 and z = 1.
x = 1, y = 0 and z = 1.
The expression that contains two relational operators is
(x + y) <= (y + z)
(x == y) && (y != z)
(x && y) || (y && z)
(++x / --y) >= (++y / --z)
