ACTUAL Exam Questions and CORRECT
Answers
Is java.io package or java.lang package automatically imported into all Java programs? -
CORRECT ANSWER - java.io: Not automatically imported.
java.lang: Automatically imported.
What is the short-circuit evaluation of logical AND(&&) and logical OR(||)? - CORRECT
ANSWER - evaluates the first condition, and depending on the result, may or may not
needs to further evaluateq
What is the scope of a local variable? - CORRECT ANSWER - the block of code within
which the variable is declared, used, and can be modified.
What is the scope of a method parameter? - CORRECT ANSWER - is the method in
which the parameter is declared
Can a method return a reference to an object? - CORRECT ANSWER - yes, a method
return a reference to an object?
What is shadowing? - CORRECT ANSWER - When a method has a local variable with
the same name as a field in a class, the name of the local variable _____ the name of the field,
and the local variable will hide the value of the field
When an array of String objects is declared but not initialized, what is value of each element in
the array? - CORRECT ANSWER - Null
What are command-line arguments? - CORRECT ANSWER - arguments passed in the
main method