Skip to content
Pass Any WGU OA Exam Now & Pay After You Pass. Contact Us!
  1. Home
  2. WGU Exams
  3. WGU D286
  4. Set 5
WGU D286 · Java Fundamentals

WGU D286 Practice Questions – Set 5

50 multiple-choice questions with answers and detailed explanations. Untimed — choose an answer to check it instantly.

Question 1 of 50

What is the purpose of the static keyword in Java?

Question 2 of 50

Which of the following is a method of the String class?

Question 3 of 50

How do you declare a single-dimensional array in Java?

Question 4 of 50

Which of the following is a valid way to define a method in Java?

Question 5 of 50

What is the output of System.out.println(10 % 3); ?

Question 6 of 50

Which of the following types can be used in a switch statement?

Question 7 of 50

How do you handle exceptions in Java?

Question 8 of 50

What is an ArrayList in Java?

Question 9 of 50

Which of the following is not a Java access modifier?

Question 10 of 50

How do you create a thread in Java?

Question 11 of 50

What is the output of System.out.println(3 * 2 + 1); ?

Question 12 of 50

Which of the following is a valid way to declare a constant variable in Java?

Question 13 of 50

How do you check if a String is empty in Java?

Question 14 of 50

Which exception is thrown when you divide by zero in Java?

Question 15 of 50

What is the purpose of the default keyword in an interface?

Question 16 of 50

Which of the following collections allows duplicate elements?

Question 17 of 50

What will the following code output? System.out.println(“Hello”.charAt(1)); ?

Question 18 of 50

How do you create an immutable class?

Question 19 of 50

Which of the following is not a type of loop in Java?

Question 20 of 50

What is the purpose of the try block?

Question 21 of 50

How do you create a synchronized method in Java?

Question 22 of 50

What is the result of System.out.println(5 + “5”); ?

Question 23 of 50

Which of the following is not a primitive data type in Java?

Question 24 of 50

How can you declare an abstract method in a class?

Question 25 of 50

What will happen if you try to access a null reference in Java?

Question 26 of 50

Which of the following is a method to remove an element from a List?

Question 27 of 50

What is the output of System.out.println(“Hello World”.substring(0, 5)); ?

Question 28 of 50

How do you declare an interface in Java?

Question 29 of 50

Which of the following is true about constructors in Java?

Question 30 of 50

What is the purpose of the final keyword in Java?

Question 31 of 50

Which method is used to convert a string to an integer?

Question 32 of 50

What does the public keyword signify in Java?

Question 33 of 50

How do you find the size of a List in Java?

Question 34 of 50

What is the output of System.out.println(“Java”.equals(“java”)); ?

Question 35 of 50

Which of the following is a valid constructor declaration?

Question 36 of 50

How do you define a method that can throw an exception?

Question 37 of 50

What is the result of System.out.println(7 / 2); ?

Question 38 of 50

Which of the following will create an empty HashMap?

Question 39 of 50

How do you check if a map contains a specific key?

Question 40 of 50

Which of the following is not a feature of Java?

Question 41 of 50

What is the purpose of the this keyword in Java?

Question 42 of 50

How do you declare a variable that can hold a decimal value in Java?

Question 43 of 50

Which of the following statements is true about the final keyword?

Question 44 of 50

What is the output of System.out.println(2 * 3 + 4 * 5); ?

Question 45 of 50

How do you convert a primitive type to a wrapper type in Java?

Question 46 of 50

What is the output of System.out.println(“2” + 3 + 1); ?

Question 47 of 50

Which of the following is true about an interface in Java?

Question 48 of 50

How do you make a class final in Java?

Question 49 of 50

What is the output of System.out.println(5 + “10”); ?

Question 50 of 50

Which of the following is a feature of exception handling in Java?

Set 5 complete

You scored 0%

0 correct out of 0 answered (50 questions in this set).

Struggling with WGU D286?

If this exam is giving you a hard time, let us be your helping hand. Contact us, and we'll provide the assistance you need to pass and move forward.

Chat Now