Flow Control Questions and Answers

Take Exam

Flow control in Java determines the order in which statements, instructions, or functions are executed during program execution. It includes loops, conditional statements, and branching structures. Understanding Java flow control is essential for writing efficient and bug-free programs. In technical interviews and competitive exams, programming questions and answers related to flow control help assess a candidate’s logical thinking and problem-solving ability. Practice Java MCQs and coding challenges that involve conditional constructs, nested loops, and exception handling to strengthen your understanding. This topic is particularly relevant for companies like TCS, Infosys, and Capgemini.

Flow Control

Showing 10 of 29 questions

11. What data types can a switch statement operate on in Java?

  • int, String, enum
  • long only
  • float only
  • boolean only
Show Answer Report

12. Which keyword is used to test multiple conditions?

  • switch
  • if-else
  • goto
  • check
Show Answer Report

13. Which operator checks both conditions must be true?

  • ||
  • &&
  • !
  • =
Show Answer Report

14. Which loop executes zero or more times?

  • do-while
  • for
  • both for and while
  • none
Show Answer Report

15. What will “continue” inside a for-loop do?

  • exit loop
  • restart program
  • skip to next iteration
  • stop JVM
Show Answer Report

16. Which statement is illegal in switch?

  • break
  • default
  • continue
  • case
Show Answer Report

17. What is used to repeat a block until a condition becomes false?

  • class
  • loop
  • method
  • exception
Show Answer Report

18. Which statement returns control to the caller method?

  • break
  • end
  • return
  • exit
Show Answer Report

19. The condition inside an if statement must be a:

  • float
  • boolean
  • int
  • char
Show Answer Report

20. Which keyword is used to label loops?

  • mark
  • tag
  • label
  • none (user-defined name)
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test