Practice: Output Prediction & Debugging Mock Test
60 min · Intermediate
This is a full mock of a written or live code-reading round: 15 predict-the-output questions (12 in the MCQ tab, 3 in Practice), two compile-error-or-output questions and five find-the-bug methods. Time yourself, answer on paper first, then check and score.
Topics in this lesson
- How to take this mock test
- Compile error or output? Decide first
- Scoring guide
- Review: the most-missed traps
Interview questions this lesson answers
- What does int x = 5; x = x++ + ++x; leave in x?
- What does System.out.println(10 + 20 + "30") print?
- What does "" + 'a' + 'b' print compared with 'a' + 'b'?
- What is -9 / 2 and -9 % 2?
- What does Integer.MAX_VALUE + 1 == Integer.MIN_VALUE evaluate to?
- What does new String("a") == "a" give, and why?
- What does Integer.valueOf(127) == Integer.valueOf(127) give? And for 128?
- If a parent reference points to a child, which static method runs?
- Why might a child's field print 0 when accessed from the parent constructor?
- try returns 1 and finally returns 2. What is returned?
Sign in free to continue this lesson
Create a free account to read every lesson, practise with the exercises and keep track of your progress.