Java control flow quiz

  • Admin
  • 1 min read

Nine questions on if, switch, loops and arrays.

Java

Java control flow quiz

9 questions, instant feedback

Question 1 of 9 Which condition is valid in an if statement?
Question 2 of 9 What does else if allow?
Question 3 of 9 Which switch type is allowed in modern Java?
Question 4 of 9 What happens when a switch case has no break?
Question 5 of 9 How many times does for (int i = 0; i < 3; i++) run?
Question 6 of 9 What is the difference between while and do-while?
Question 7 of 9 What does an array of int default to when created with new int[5]?
Question 8 of 9 What is the valid index range for new int[4]?
Question 9 of 9 Which loop is best when the number of items is known?

Your answers stay in this browser. Nothing is sent to a server.