No student devices needed. Know more
12 questions
What will the output of the following code segment be?
int a = 1, b = 2;
System.out.println(++a+”,”+b++);
1,2
2,2
2,3
3,3
What will the following program segment display?
for(int a = 2; a <= 10; a += 3)
System.out.print(a+””);
2 5 8
2 5
2 5 8 11
2
In the expression number++, the ++ operator is in what mode?
prefix
pretest
postfix
posttest
What is each repetition of a loop known as?
cycle
revlolution
orbit
iteration
This is a variable that controls the number of iterations performed by a loop.
loop control variable
accumulator
iteration register variable
repetition meter
The while loop is this type of loop.
pretest
posttest
prefix
postfix
The do-while loop is this type of loop.
a. pretest
b. posttest
c. prefix
d. postfix
The for loop is this type of loop.
a. pretest
b. posttest
c. prefix
d. postfix
This type of loop has no way of ending and repeats until the program is interrupted.
a. indeterminate
b. interminable
c. infinite
d. timeless
This expression executes at the end of each iteration of the for loop.
a. initialization expression
b. test expression
c. update expression
d. statement block
This expression is executed by the for loop only once, regardless of the number of iterations.
a. initialization expression
b. test expression
c. update expression
d. preincrement expression
This statement causes a loop to terminate early.
a. continue
b. break
c. switch
d. none of the above
Explore all questions with a free account