CST 8116 FINAL EXAM PREPARATION TEST
BANK WITH CORRECT ANSWERS
●● Every class definition must include a constructor.
Answer: False
●● While multiple objects of the same class can exist, in a given
program there can be only one version of each class.
Answer: True
●● Accessors and mutators provide mechanisms for controlled access to
a well-encapsulated class.
Answer: True
●● All Java classes must contain a main method which is the first
method executed when the Java class is called upon.
Answer: False
●● As in the other members of the C family of languages (C, C++, C#),
Java interprets a zero value as false and a non-zero value as true.
Answer: True
●● In Java, selection statements consist of the if and if-else statements.
,Answer: False
●● In Java, the symbol "=" and the symbol "==" are used synonymously
(interchangeably).
Answer: False
●● When comparing any primitive type of variable, == should always
be used to test to see if two values are equal.
Answer: False
●● The statement if (a >= b) a++; else b--; will do the same thing as the
statement if (a < b) b--; else a++;.
Answer: True
●● An if statement may or may not have an else clause, but an else
clause must be part of an if statement.
Answer: True
●● In order to compare int, float and double variables, you can use <, >,
==, !=, <=, >=, but to compare char and String variables, you must use
compareTo( ), equals( ) and equalsIgnoreCase( ).
Answer: False
●● Control in a switch statement jumps to the first matching case.
, Answer: True
●● Each case in a switch statement must terminate with a break
statement.
Answer: False
●● It is possible to convert any type of loop (while, do, or for) into any
other.
Answer: True
●● The following loop is syntactically valid.
for (int j = 0; j < 1000; j++) j--;
Answer: True
●● A dialog box is a device which accepts voice commands.
Answer: False
●● For the questions below, assume that boolean done = false, int x =
10, int y = 11, String s = "Help" and String t = "Goodbye".
The expression (!done && x <= y) is true.
Answer: True
BANK WITH CORRECT ANSWERS
●● Every class definition must include a constructor.
Answer: False
●● While multiple objects of the same class can exist, in a given
program there can be only one version of each class.
Answer: True
●● Accessors and mutators provide mechanisms for controlled access to
a well-encapsulated class.
Answer: True
●● All Java classes must contain a main method which is the first
method executed when the Java class is called upon.
Answer: False
●● As in the other members of the C family of languages (C, C++, C#),
Java interprets a zero value as false and a non-zero value as true.
Answer: True
●● In Java, selection statements consist of the if and if-else statements.
,Answer: False
●● In Java, the symbol "=" and the symbol "==" are used synonymously
(interchangeably).
Answer: False
●● When comparing any primitive type of variable, == should always
be used to test to see if two values are equal.
Answer: False
●● The statement if (a >= b) a++; else b--; will do the same thing as the
statement if (a < b) b--; else a++;.
Answer: True
●● An if statement may or may not have an else clause, but an else
clause must be part of an if statement.
Answer: True
●● In order to compare int, float and double variables, you can use <, >,
==, !=, <=, >=, but to compare char and String variables, you must use
compareTo( ), equals( ) and equalsIgnoreCase( ).
Answer: False
●● Control in a switch statement jumps to the first matching case.
, Answer: True
●● Each case in a switch statement must terminate with a break
statement.
Answer: False
●● It is possible to convert any type of loop (while, do, or for) into any
other.
Answer: True
●● The following loop is syntactically valid.
for (int j = 0; j < 1000; j++) j--;
Answer: True
●● A dialog box is a device which accepts voice commands.
Answer: False
●● For the questions below, assume that boolean done = false, int x =
10, int y = 11, String s = "Help" and String t = "Goodbye".
The expression (!done && x <= y) is true.
Answer: True