D286 Java Fundamentals - Set 3 - Part 2
Test your knowledge of technical writing concepts with these practice questions. Each question includes detailed explanations to help you understand the correct answers.
Question 21: Which ArrayList method returns the number of elements?
Question 22: What does the ArrayList get(index) method do?
Question 23: What does HashMap.put(key, value) do when the key already exists?
Question 24: What does HashMap.get(key) return when the key is absent?
Question 25: Which collection would best store a list of unique usernames?
Question 26: What is the output of: System.out.println(10 / 3);
Question 27: What is the output of: System.out.println(10.0 / 3);
Question 28: What does casting a double to an int accomplish, as in (int) 9.99?
Question 29: Which method rounds a double to the nearest whole number?
Question 30: What does Math.abs(-7) return?
Question 31: What does Math.pow(2, 3) return?
Question 32: What happens when a method declares a return type but has no return statement on some path?
Question 33: What does passing an object to a method actually pass in Java?
Question 34: Can a method modify the contents of an array passed as a parameter?
Question 35: What is a varargs parameter, declared as int... numbers?
Question 36: What is the scope of a variable declared inside a for loop's initialization?
Question 37: What is shadowing in Java?
Question 38: What does a constructor with parameters allow?
Question 39: What is constructor chaining using this()?
Question 40: What must be the first statement in a constructor that calls super()?
Don't Want to Study?
Save Time on Studies, Spend More with Family & Friends! Pay-After-you-Pass!
Get Exam Support