Are you reading to get your java certification test? There are different things that you need to understand to ensure you do not fail the test properly, and the programming trivia questions quiz below will help you get a clue of what they are. How about you give it a shot and get to see if you actually know enough See moreto sit for the test or need more study hours.
Java MyFile 0 1 2 3
Java MyFile 1 3 2 2
Java MyFile 1 2 2 3 4
Java MyFile 2 2 2
Rate this question:
Static int[] findMax(int max)
Static int findMax(int[] numbers)
Final int[] findMax(int [] a)
Public int findMax(int[] numbers)
Rate this question:
ArrayList<Tiger> myList = new ArrayList<>(); myList.add(new Cat());
ArrayList<Hunter> myList = new ArrayList<>(); myList.add(new Cat());
ArrayList<Animal> myList = new ArrayList<>(); myList.add(new Tiger());
ArrayList<Hunter> myList = new ArrayList<>(); myList.add(new Tiger());
ArrayList<Animal> myList = new ArrayList<>(); myList.add(new Cat());
Rate this question:
Polymorphism.
Instantiation.
Encapsulation.
Inheritance.
Abstraction.
Rate this question:
Welcome Log 1: 0
Welcome Log 2: 1
Hello Log 2: 1
Hello Log 1: 0
Rate this question:
Javac Greeting java Greeting Duke
Javac Greeting.java Duke java Greeting
Javac Greeting.java java Greeting Duke
Javac Greeting.java java Greeting.class Duke
Rate this question:
3 5
9 25
0 0
Compilation fails.
Rate this question:
10 : 0
0 : 0
Compilation fails on line n1.
Compilation fails on line n2.
Compilation fails on line n3.
Rate this question:
Super.r=r; this.c=c;
Super(r); this(c);
Super(r); this.c=c;
This.c=r; super(c);
Rate this question:
10 : 30 : 5
10 : 22 : 22
10 : 22 : 20
10 : 22 : 5
Rate this question:
String main 1
Int main 1
Object main 1
Compilation fails.
An exception is thrown at runtime.
Rate this question:
A DateTimeException is thrown at runtime.
Compilation fails.
2012-02-10
2012-02-11
Rate this question:
5 : 5
10 : 10
5: 10
Compilation fails.
Rate this question:
Replace line 5 with String opt = "true"; Replace line 7 with case "true":
Replace line 5 with String opt = 1; Replace line 7 with case 1:
At line 9, remove the break statement.
Remove the default section.
Rate this question:
Compilation fails at line n1 and line n2.
A B C
C
C B A
Rate this question:
An exception is thrown at runtime.
-1
5
0
Rate this question:
It can run on any platform only if that platform has both the Java Runtime Environment and the compiler.
It can run on any platform that has a Java compiler.
It can run on any platform that has the Java Runtime Environment.
It can run on any platform only if it was compiled for the platform.
It can run on any platform.
Rate this question:
Int [] array = new int[2];
Int [] array; array = int[2];
Int array = new int[2];
Int array[2];
Rate this question:
200.0 : 100.0
400.0 : 200.0
400.0 : 100.0
Compilation fails.
Rate this question:
Hello World!
Hello Universe!
An exception is thrown at runtime.
Compilation fails.
Rate this question:
5 4 3 2 1 0
5 4 3 2 1
4 2 1
5
Nothing is printed
Rate this question:
4 21
4 5
5 4
3 5
4 4
4 4
4 7
4 7
Rate this question:
Compilation fails.
False true
True true
True false
Rate this question:
1 3 5 7 1 3
1 3 1 3
1 3 1 3 0 0
Compilation fails.
1 3 Followed by an ArrayIndexOutOfBoundsException.
Rate this question:
Compilation fails.
10 20 30 40
0 0 30 40
An exception is thrown at runtime.
Rate this question:
Match 1
Match 2
No Match
A NullPointerException is thrown at runtime.
Rate this question:
A main method must be declared in every class.
A package must contain more than one class.
A subclass can inherit from a superclass.
Objects cannot be reused.
Object can share behaviors with other objects.
Object is the root class of all other objects.
Rate this question:
A NullPointerException is thrown at runtime.
Java EE
Java SE
Compilation fails at line n1.
Rate this question:
Int f = ps.indexOf(new Patient("Mike"));
Int f = ps.indexOf(Patient("Mike"));
Patietn p = new Patient("Mike"); int f = ps.indexOf(p);
Int f = ps.indexOf(p2);
Rate this question:
10 Hello World!
10 Hello Universe!
9 Hello World!
Compilation fails.
Rate this question:
Stuff.equals("TV") ? res = "Walter" : stuff.equals("Movie") ? res = "White": res = "No Result";
Res = stuff.equals("TV") ? "Walter" else stuff.equals("Movie") ? "White": "No Result";
Res = stuff.equals("TV") ? stuff.equals("Movie") ? "Walter" : "No Result";
Res = stuff.equals("TV") ? "Walter" : stuff.equals("Movie") ? "White": "No Result";
Rate this question:
2 4
0 2 4 6
0 2 4
Compilations fails.
Rate this question:
Hello Java SE 8 Hello Java SE 8
Hello java.lang.StringBuilder@<<hashcode>> Hello p1.MyString@<<hashcode2>>
Hello Java SE 8 Hello p1.MyString@<<>hashcode>
Compilation fails at the Test class.
Rate this question:
Sb.deleteAll();
Sb.delete(0,sb.length());
Sb.delete(0,sb.size());
Sb.removeAll();
Rate this question:
200: 300 200: 300
300: 0 0: 300
300: 300 200: 300
300: 100 200: 300
Rate this question:
Welcome Visit Count: 1 Welcome Visit Count: 2
Welcome Visit Count: 1 Welcome Visit Count: 1
Compilation fails at line n1 and line n1 and line n2.
Compilation fails at line n3 and line n3 and line n4.
Rate this question:
US: 2 UK: 2
US: 3 UK: 3
US: 2 UK: 4
An ArrayIndexOutOfBoundsException is thrown at runtime.
Rate this question:
String str2 = "Duke";
String str2 = sb1.toString();
String str2 = str1;
String str2 = new String(str1);
Rate this question:
Compilation fails at line n2.
Read E-Book
Read Book
Compilation fails at line n3.
Compilation fails at line n1.
Rate this question:
A B C C
A B C D
A C D
A B D
A B D C
A B D D
Rate this question:
Date1 = 2014-06-20 date2 = 2014-06-20 date3 = 2014-06-20
Date1 = 06/20/2014 date2 = 2014-06-20 date3 = Jun 20, 2014
Compilation fails.
A DateParseException is thrown at runtime.
Rate this question:
Import sales.*;
Import java.sales.products.*;
Import sales; import sales.products;
Import sales.*; import products.*;
Import sales.*; import sales.products.*;
Rate this question:
An UnsupportedOperationException is thrown at runtime.
Hi removed
Compilation fails.
The program compiles, but it prints nothing.
Rate this question:
StringBuilder sb = new StringBuilder(x); sb.append(creditCard, 15, 19); return sb.toString();
StringBuilder sb = new StringBuilder(creditCard); sb.subString(creditCard, 15, 19); return x + sb;
return x + creditCard.substring(15, 19);
StringBuilder sb = new StringBuilder(creditCard); StringBuilder s = sb.insert(0, x); return s.toString();
Rate this question:
Invalid Names omas null null
Invalid Names
Invalid Names omas
Omas
Rate this question:
Compilation fails.
-1
4
3
Rate this question:
123: false 123: false
123: true 123: true
123: false 123: true
Compilations fails.
Rate this question:
Result A 1 Result B 3
Result A 01 Result B 3
Result A 01 Result B 12
Result A 1 Result B 12
Rate this question:
Quiz Review Timeline (Updated): Mar 22, 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.