Java Quiz
Fast practice, instant feedback. Timer auto-submits when time’s up.
Avg score: 13% Most missed: “You need to mark that a method is obsolete and should not be used anymore. | Wha…”

For Pluralsight Skill Assessments.

Java Quiz
Time left 00:00
16 Questions

1. What command must you use to execute a Main class that contains a main()
method?
2. What Java API is not supported in Android?
3. How can you add a method to an existing interface without having to modify
the classes that already implement it?
4. What implementation of List does the collectors.totist() create?
5. How can you test if a double value d is not a number?
6. What command must you use to execute a Main class that contains a main()
method?
7. You have the following class:
public class Holder {
public Holder(int capacity) { }
}
You need to extend this class with the following class:
public class SmartHolder extends Holder {
public SmartHolder(int capacity) {
..
}
}
What code do you need to add to the SmartHolder constructor?
8. Which of the following type is NOT valid within a switch statement's test
expression?
9. What is the difference between an instance of the String class and array of
chars?
10. How can you add a method to an existing interface without having to modify
the classes that already implement it?
11. You have the following class:
public class Holder {
public Holder(int capacity) { }
}
You need to extend this class with the following class:
public class SmartHolder extends Holder {
public SmartHolder(int capacity) {
..
}
}
What code do you need to add to the SmartHolder constructor?
12. What Javadoc would you write to document the following method?
public static final Connection getConnection(String url) throws SQLTimeoutexception {
}
13. Which statement declares an integer field that is shared by all the instances of
the Holder class?
14. i is an int of value 2 and the result variable is declared. What does the following code print out?
switch(i) {
case 1: result = 1;
break;
case 2: result = 2;
case 3: result = 3;
case 4: result = 4;
}
system.out.printIn(
15. You create a string of characters, trim it, put it in upper case, and extract the
first three characters using the substring method. How many instances of the
string would be created?
16. Which of the following type is NOT valid within a switch statement's test
expression?