ACTUAL ANSWERS 2025/2026
UPDATE.
A, B, D - Answer Which of the following are valid declarations? Assume java.util.* is
imported. (choose 3)
A. Vector<Map> v;
B. Set<String> s;
C. Map<String> m;
D. Map<String, String> m;
A - Answer You can determine all the keys in a Map in which of the following ways?
A⦁ By getting a Set object from the Map and iterating through it.
B⦁ By iterating through the Iterator of the Map.
C⦁ By enumerating through the Enumeration of the Map.
D⦁ By getting a List from the Map and enumerating through the List.
E⦁ You cannot determine the keys in a Map
D - Answer What keyword is used to prevent an object from being serialized?
A ⦁ private
B ⦁ volatile
C ⦁ protected
D ⦁ transient
E ⦁ None of the above
A - Answer An abstract class can contain methods with declared bodies.
A ⦁ True
B ⦁ False
E - Answer Select the order of access modifiers from least restrictive to most restrictive.
A ⦁ public, private, protected, default
B ⦁ default, protected, private, public
C ⦁ public, default, protected, private
D ⦁ default, public, protected, private
,E ⦁ public, protected, default, private
C - Answer Which access modifier allows you to access method calls in libraries not created
in Java?
A ⦁ public
B ⦁ static
C ⦁ native
D ⦁ transient
E ⦁ volatile
D - Answer Which of the following statements are true? (Select all that apply.)
A ⦁ A final object's data cannot be changed.
B ⦁ A final class can be subclassed.
C ⦁ A final method cannot be overloaded.
D ⦁ A final object cannot be reassigned a new address in memory.
E ⦁ None of the above.
A - Answer The keyword extends refers to what type of relationship?
A ⦁ "is a"
B ⦁ "has a"
C ⦁ "was a"
D ⦁ "will be a"
E ⦁ None of the above
B - Answer Which of the following keywords is used to invoke a method in the parent class?
A ⦁ this
B ⦁ super
C ⦁ final
D ⦁ static
C - Answer Given the following code, what will be the outcome?
public class Funcs extends java.lang.Math { public int add(int x, int y) {
return x + y;
}
,public int sub(int x, int y) { return x - y;
}
public static void main(String [] a) { Funcs f = new Funcs(); System.out.println("" + f.add(1, 2));
}
}
A ⦁ The code compiles but does not output anything.
B ⦁ "3" is printed out to the console.
C ⦁ The code does not compile.
D ⦁ None of the above.
D - Answer Given the following code, what is the expected outcome?
public class Test {
public static void main(String [] a) { int [] b = [1,2,3,4,5,6,7,8,9,0]; System.out.println("a[2]=" +
a[2]);
}
}
A ⦁ The code compiles but does not output anything.
B ⦁ "a[2]=3" is printed out to the console.
C ⦁ "a[2]=2" is printed out to the console.
D ⦁ The code does not compile.
E ⦁ None of the above.
D - Answer What is the value of x after the following operation is performed?
x = 23 % 4;
A. 23
B. 4
C. 5.3
D. 3
E. 5
C - Answer Given the following code, what keyword must be used at line 4 in order to stop
execution of the
, for loop?
boolean b = true;
for (;;) {
if (b) {
<insert code>
}
// do something
}
A ⦁ stop
B ⦁ continue
C ⦁ break
D ⦁ None of the above
B - Answer What method call is used to tell a thread that it has the opportunity to run?
A ⦁ wait()
B ⦁ notify()
C ⦁ start()
D ⦁ run()
A - Answer Given the following code, which of the results that follow would you expect?
1. package mail; 2.
interface Box {
protected void open();
void close();
public void empty();
}
A ⦁ The code will not compile because of line 4.
B ⦁ The code will not compile because of line 5.
C ⦁ The code will not compile because of line 6.
D ⦁ The code will compile
C - Answer Assertions are used to enforce all but which of the following?