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 3
WGU D286 · Java Fundamentals

WGU D286 Practice Questions – Set 3

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

Question 1 of 50

What is the output of: int x = 5; System.out.println(x++);

Question 2 of 50

What is the value of result after: int result = 10 + 5 * 2;

Question 3 of 50

What does the expression (3 > 2) && (2 > 5) evaluate to?

Question 4 of 50

What is the value of s after: String s = "Java"; s.toUpperCase();

Question 5 of 50

Which loop prints the numbers 1 through 5?

Question 6 of 50

How many times does this loop execute: for (int i = 0; i < 10; i += 2)?

Question 7 of 50

What does the expression "5" + 5 produce in Java?

Question 8 of 50

What does 5 + 5 + "5" produce?

Question 9 of 50

Which statement correctly declares and initializes a two-dimensional array?

Question 10 of 50

What is the result of comparing two String objects created with new using ==?

Question 11 of 50

What does the String method equalsIgnoreCase() do?

Question 12 of 50

What does the trim() method on a String accomplish?

Question 13 of 50

What does the split() method return?

Question 14 of 50

What does Integer.parseInt("42") return?

Question 15 of 50

What does the charAt(0) method return for the String "Hello"?

Question 16 of 50

What is the purpose of the indexOf() method on a String?

Question 17 of 50

What does the contains() method on a String return?

Question 18 of 50

Which loop construct is most appropriate for iterating over an ArrayList when the index is not needed?

Question 19 of 50

Which ArrayList method adds an element to the end of the list?

Question 20 of 50

Which ArrayList method returns the number of elements?

Question 21 of 50

What does the ArrayList get(index) method do?

Question 22 of 50

What does HashMap.put(key, value) do when the key already exists?

Question 23 of 50

What does HashMap.get(key) return when the key is absent?

Question 24 of 50

Which collection would best store a list of unique usernames?

Question 25 of 50

What is the output of: System.out.println(10 / 3);

Question 26 of 50

What is the output of: System.out.println(10.0 / 3);

Question 27 of 50

What does casting a double to an int accomplish, as in (int) 9.99?

Question 28 of 50

Which method rounds a double to the nearest whole number?

Question 29 of 50

What does Math.abs(-7) return?

Question 30 of 50

What does Math.pow(2, 3) return?

Question 31 of 50

What happens when a method declares a return type but has no return statement on some path?

Question 32 of 50

What does passing an object to a method actually pass in Java?

Question 33 of 50

Can a method modify the contents of an array passed as a parameter?

Question 34 of 50

What is a varargs parameter, declared as int... numbers?

Question 35 of 50

What is the scope of a variable declared inside a for loop's initialization?

Question 36 of 50

What is shadowing in Java?

Question 37 of 50

What does a constructor with parameters allow?

Question 38 of 50

What is constructor chaining using this()?

Question 39 of 50

What must be the first statement in a constructor that calls super()?

Question 40 of 50

What is the purpose of a static initializer block?

Question 41 of 50

What does the keyword void indicate as a return type?

Question 42 of 50

What is an immutable object?

Question 43 of 50

Which practice helps make a class immutable?

Question 44 of 50

What is the output of: boolean b = (5 == 5.0);

Question 45 of 50

What is integer overflow?

Question 46 of 50

Which type would you choose for values larger than the int range?

Question 47 of 50

What does the char data type store?

Question 48 of 50

What is the difference between 'A' and "A" in Java?

Question 49 of 50

What is the primary benefit of writing small, single-purpose methods?

Question 50 of 50

Which Java keyword is used to create a subclass that inherits from a superclass?

Set 3 complete

You scored 0%

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

Next: Set 4

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