Assess your experience with Java

I estimate it would take you 40 steps in 13 minutes to Assess your experience with Java.
What is the visibility (access) of myMethod?

public class Test {
void myMethod() {
// ...
  • private
  • public
  • default (package-private)
  • protected
Which of the following options could be a valid problem when using the == operator when comparing the value of two floating-point numbers?
1. Using this operator converts primitive floating-point numbers to their boxed representations (Double and Float).

2. For floating-point numbers, the compiler optimizes the code when this operator is used, possible changing the output of the comparison.

3. For floating-point numbers, this operator compares their references instead of their values.

4. Due to precision and rounding issues, this operator may not report floating-point numbers as exactly equal (even when they are in theory).
  • 1.
  • 2.
  • 3.
  • 4.
How is a foreach loop constructed in Java?
  • foreach (collection as Object o)
  • for (Object o : collection)
  • foreach (Object o : collection)
  • for (Object o in collection)
How do you prevent a class from being extended by a subclass?
  • all member variables and methods as protected
  • all its members as private
  • the class as final
  • the class as abstract
💡FUN FACT 💡James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language project in June 1991
What is the super class of all classes in Java?
  • Object class
  • rototype class
  • Base class
  • Abstract Class
What is a weak reference?
  • always returns 'null'.
  • protects an object from garbage collection.
  • can't force an object to remain in memory.
What output does the following code snippet produce?

public static void main(String[] args) {
List <String> myList =
Arrays.asList("a1", "a2", "b1", "c2", "c1");
.filter(s -> s.startsWith("c"))
  • C2 C1
  • c2 c1 (lowercase c's)
  • The code does not compile
  • A1 A2 B1
  • None
A method is considered to be 'overloaded' when:
1. You cannot overload a method.

2. It has different return types within the same class scope.

3. It has multiple call signatures within the same class scope.

4. It throws an exception.
  • 1.
  • 2.
  • 3.
  • 4.
Which of the following statements about notifyAll() is true?
1. It can be called from anywhere without throwing an exception.

2. It wakes up all threads that called one of the wait methods.

3. It causes all threads to immediately release their locks.
  • 1.
  • 2.
  • 3.
Which of these keywords is used to define a class?
  • this
  • class
  • super
  • object
Given the following code:
What does the filter method do when called as shown above?
  • It returns a list of People whose surname starts with Smith.
  • It returns a list of people whose surname is Smith
  • It returns a list of all people.
  • The code won't compile
💡FUN FACT 💡Sun Microsystems released the first public implementation as Java 1.0 in 1996.
What is the syntax for creating a class derived from a class named MyClass?
  • class MyDerived implements MyClass
  • class MyDerived extends MyClass
  • public class MyDerived : MyClass
Which of following annotations can be used only on methods?
  • @Inherited
  • @Deprecated
  • @Override
  • @SuppressWarnings
  • @Documented
Given the following:

int y = 21 % 5 ;

What is the y value ?
  • 4
  • 0
  • 1
  • 5
Which of these operators is used to allocate memory for an object?
  • new
  • super();
  • this
After the following code fragment, what is the value in a?

String s = "Foolish boy.";
int a = s.indexOf("ool");
  • 0
  • 1
  • 8
  • -1
Which of the following is true of interface variables?
  • can be transient and volatile.
  • can be volatile but not transient.
  • can be transient but not volatile.
  • must be public, static, and final.
Java interfaces can extend:
  • nothing – extension is not valid for interfaces.
  • only one other interface.
  • final classes.
  • multiple interfaces.
Get Started   

Or consider 72 other intentions.