JAVA MIDTERM STUDY GUIDE EXAM
QUESTIONS WITH COMPLETE
SOLUTIONS
What will the println statement in the following program segment display?
Int x = 5;
System.out.println(x++);
o5
o6
o0
o none of these - Answer- 5
What will the println statement in the following program segment display?
Int x = 5;
System.out.println(++x);
o5
o6
o0
o none of these - Answer- 6
In the expression number++, the ++ operator is in what mode?
o Prefix
o Protest
o Postfix
o Posttest - Answer- Postfix
What is each repetition of a loop known as?
o Cycle
o Revolution
o Orbit
o Iteration - Answer- Iteration
This is a variable that controls the number of iterations performed by a loop.
o Loop control variable
o Accumulator
o Iteration register variable
o Repetition meter - Answer- Loop control variable
, The while loop is this type of loop.
o Pretest
o Posttest
o Prefix
o Postfix - Answer- Pretest
The do while loop is this type of loop.
o Pretest
o Posttest
o Prefix
o Postfix - Answer- Posttest
The for loop is this type of loop.
o Pretest
o Posttest
o Prefix
o Postfix - Answer- Pretest
This type of loop has no way of ending and repeats until the program is interrupted.
o Intermediate
o Interminable
o Infinite
o Timeless - Answer- Infinite
This type of loop always executes at least once.
o While
o Do-while
o For
o Any of these - Answer- Do-while
This expression is executed by the loop only once, regardless of the number of
iterations.
o Initialization expression
o Test expression
o Update expression
o Pre-increment expression - Answer- Initialization expression
This is a variable that keeps a running total.
o Sentinel
o Sum
o Total
o Accumulator - Answer- Accumulator
This is a special value that signals when there are no more items from a list of times to
be processed. This value cannot be mistaken as an item from the list.
o Sentinel
QUESTIONS WITH COMPLETE
SOLUTIONS
What will the println statement in the following program segment display?
Int x = 5;
System.out.println(x++);
o5
o6
o0
o none of these - Answer- 5
What will the println statement in the following program segment display?
Int x = 5;
System.out.println(++x);
o5
o6
o0
o none of these - Answer- 6
In the expression number++, the ++ operator is in what mode?
o Prefix
o Protest
o Postfix
o Posttest - Answer- Postfix
What is each repetition of a loop known as?
o Cycle
o Revolution
o Orbit
o Iteration - Answer- Iteration
This is a variable that controls the number of iterations performed by a loop.
o Loop control variable
o Accumulator
o Iteration register variable
o Repetition meter - Answer- Loop control variable
, The while loop is this type of loop.
o Pretest
o Posttest
o Prefix
o Postfix - Answer- Pretest
The do while loop is this type of loop.
o Pretest
o Posttest
o Prefix
o Postfix - Answer- Posttest
The for loop is this type of loop.
o Pretest
o Posttest
o Prefix
o Postfix - Answer- Pretest
This type of loop has no way of ending and repeats until the program is interrupted.
o Intermediate
o Interminable
o Infinite
o Timeless - Answer- Infinite
This type of loop always executes at least once.
o While
o Do-while
o For
o Any of these - Answer- Do-while
This expression is executed by the loop only once, regardless of the number of
iterations.
o Initialization expression
o Test expression
o Update expression
o Pre-increment expression - Answer- Initialization expression
This is a variable that keeps a running total.
o Sentinel
o Sum
o Total
o Accumulator - Answer- Accumulator
This is a special value that signals when there are no more items from a list of times to
be processed. This value cannot be mistaken as an item from the list.
o Sentinel