Dive into the 'Java Toughest Exam: Trivia Quiz!' to challenge your understanding of Java programming. This quiz tests key concepts such as method overriding, exception handling, and object-oriented programming principles, essential for advanced Java programmers.
5,6
5,5
6,5
6,6
Rate this question:
A NullPointerException occurs at runtime.
Compilation fails because of an error in line 9.
Compilation fails because of an error in line 5.
The value "4" is printed at the command line.
Rate this question:
81
82
91
92
Rate this question:
DoStuff x = 5 main x = 5
DoStuff x = 6 main x = 6
Compilation fails
An exception is thrown at runtime
Rate this question:
18. d = df.parse(ds);
18. d = df.getDate(ds);
18. try { 19. d = df.parse(ds); 20. } catch(ParseException e) { };
18. try { 19. d = df.getDate(ds); 20. } catch(ParseException e) { };
Rate this question:
A
B
C
Ac
Abc
Rate this question:
The equals method does NOT properly override the Object.equals method.
Compilation fails because the private attribute p.name cannot be accessed in line 5.
To work correctly with hash-based data structures, this class must also implement the hashCode method.
When adding Person objects to a java.util.Set collection, the equals method in line 4 will prevent duplicates.
Rate this question:
Pi is not bigger than 3. Have a nice day.
Pi is bigger than 3. Have a nice day.
An exception occurs at runtime.
Pi is bigger than 3.
Compilation fails.
Rate this question:
Test end
Compilation fails
Test runtime end
Test exception end
Rate this question:
The equals method does NOT properly override the Object.equals method.
Compilation fails because the private attribute p.name cannot be accessed in line 5.
To work correctly with hash-based data structures, this class must also implement the hashCode method.
When adding Person objects to a java.util.Set collection, the equals method in line 4 will prevent duplicates.
Rate this question:
3
1 2
2 3
1 2 3
Compilation fails.
Rate this question:
Alpha a = x;
Foo f = (Delta)x;
Foo f = (Alpha)x;
Beta b = (Beta)(Alpha)x;
Rate this question:
The value "4" is printed at the command line.
Compilation fails because of an error in line 5.
Compilation fails because of an error in line 9.
A NullPointerException occurs at runtime.
Rate this question:
The instance gets garbage collected.
The code on line 33 throws an exception.
The code on line 35 throws an exception.
The code on line 31 throws an exception.
The code on line 33 executes successfully.
Rate this question:
The hashCode method for a given class can be used to test for object equality and object inequality for that class.
The hashCode method for a given class can be used to test for object inequality, but NOT object equality, for that class.
The hashCode method is used by the java.util.SortedSet collection class to order the elements within that set.
The hashCode method is used by the java.util.HashSet collection class to group the elements within that set into hash buckets for swift retrieval.
Rate this question:
00
0001
000120
00012021
Compilation fails.
Rate this question:
P0 = p1;
P1 = p2;
P2 = p4;
P2 = (ClassC)p1;
P1 = (ClassB)p3;
P2 = (ClassC)p4;
Rate this question:
B 3
B 8
B 13
F 3
F 8
F 13
Compilation fails
Rate this question:
0
1
2
3
4
Rate this question:
Quiz Review Timeline (Updated): Mar 20, 2023 +
Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.
Wait!
Here's an interesting quiz for you.