Midterm T/F Flashcards
unsigned int is a value type in Java for representing unsigned integer numeric values
False
Java does not support unsigned data types
String is a built-in value type in Java
False String is a built-in class in java
A class name usually starts with a capital letter.
True
switch is a valid variable name
False
switch is a statement in java.
An instance of a class is always a reference type in Java
True
An object is a reference type.
An object reference is not a valid expression
False.
The reference of an object is valid
A variable can be assigned the result of any expression
False
An if statement is a type of loop
False.
An if statement does not loop
A continue statement within the body of a loop exits the loop
False
continue (keyword) is used in loops
for: causes control to immediately jump to the update statement
while: control immediately jumps to the boolean expression.
A continue statement within the body of a loop exits the loop
False
continue (keyword) is used in loops
for: causes control to immediately jump to the update statement
while: control immediately jumps to the boolean expression.
A local variable declared within a loop is not available outside of the body of the loop.
True.
No.
Several case statements within a switch statement may be associated with the same block of statements to be executed.
True.
Yes.
A method must return a value that can be used in an expression
False
A method can be void
To invoke (i.e., call) a method, you must provide a value for each parameter declared in the method’s signature.
True
Yes.
Invoking a class method - a static method - requires a reference to a particular instance (i.e., object) of the class.
False
A static method can be invoked without the need for creating an instance of a class.
When a method is called from within another method, the code within method A can access local variable within method B at the point where the call to method A was made.
False
No.
The length of an array in Java cannot be changed after the array is created
True
You can not modify the length of an array after it is created.
A specific array in java cannot be changed after the array is created.
True
Yes.
A specific array can hold values of any type.
False
No.
The individual characters of a String object can be changed
False
The principle of encapsulation encourages object fields to be marked private
True
Every method of a class should be included in at least one of the interfaces that the class implements.
False
Overloading a method is an example of the principle of encapsulation
False
Setters should never be provided for an immutable object
True
To adhere to the principle of encapsulation, a public method should not make use of (i.e., call) a private method declared in the same class.
False
It is possible to create an instance of a class that does not explicitly define a constructor
True