UPDATED ACTUAL Questions and
CORRECT Answers
Inheritance is the process of sharing methods and instance variables between a base class
and its subclasses (T/F). - CORRECT ANSWER - True
The name of the text file with Java source code must match the name of the program with a
.class extension (T/F). - CORRECT ANSWER - False
Both for loops and while loops can be used as count-controlled loops (T/F). - CORRECT
ANSWER - True
It is illegal to declare several variables in a single declaration, i.e. int a, b, c; - CORRECT
ANSWER - False
m++, m=m+1, and m+=1 are all equivalent expressions (T/F). - CORRECT ANSWER -
True
The assignment operator ( = ) and equal to operator ( == ) can be used interchangeably (T/F). -
CORRECT ANSWER - False
A while loop will always execute at least once (T/F). - CORRECT ANSWER - False
The counter in a for loop is updated at the beginning of the loop (T/F). - CORRECT
ANSWER - False
It is illegal to declare the loop control variable inside the for loop header (T/F). - CORRECT
ANSWER - False
, The for statement combines counter initialization, condition test and counter update into a single
expression (T/F). - CORRECT ANSWER - True
It is usually safer to use the == or != operators in loops, rather than the other logical operators
(T/F). - CORRECT ANSWER - False
The identity of an object is simply the variable that references the object (T/F). - CORRECT
ANSWER - False
A class's implementation details can be changed radically without affecting any of its clients
provided its interface remains the same (T/F). - CORRECT ANSWER - True
The keyword public indicates that the class is accessible to all potential clients (T/F). -
CORRECT ANSWER - True
Constructors do not have return types, but all other methods do (T/F). - CORRECT
ANSWER - True
A class can include only one constructor (T/F). - CORRECT ANSWER - False
A method can only have one return statement (T/F). - CORRECT ANSWER - False
The OR operand evaluates to false if one operand is false (T/F). - CORRECT ANSWER -
False
Nested if statements offer an alternative to deal with a programs logical complexity (T/F). -
CORRECT ANSWER - True