17.1k views
0 votes
1) These are operators that add and subtract one from their operands.

A) plus and minus
B) ++ and --
C) binary and unary
D) conditional and relational
E) None of these

2) What is the output of the following code segment?
n = 1; while (n <= 5) cout << n << ' '; n++;

A) 1 2 3 4 5
B) 1 1 1... and on forever
C) 2 3 4 5 6
D) 1 2 3 4
E) 2 3 4 5

User Mwilson
by
5.9k points

1 Answer

3 votes

Answer:

1) B (++ and --)

2) A (1 2 3 4 5)

Step-by-step explanation:

In the first question, the operators ++ and -- are used in almost all programming languages for adding and subtracting 1 respectively from an operand.

In the second question using a while statement the numbers 1-5 is printed out because the variable n=1 is increased by 1 after each iteration.

User Vtukhtarov
by
5.7k points