Question: Here are some very quick multiple choice questions. Am I correct? Thanks a ton!! QUESTION 1 What is the difference between conditions that control loops
Here are some very quick multiple choice questions. Am I correct? Thanks a ton!!






QUESTION 1 What is the difference between conditions that control loops and conditions that control if statements? O conditions that control loops cannot contain logical operators there is no difference conditions in loops can be either boolean or int values, such as int i = 5; while(i)... conditions in if statements can be either boolean or int values, such as int i = 5; if ()... QUESTION 2 What is the output of the following snippet? int i = 0; while (i++ 0) for (int i = 0; i 0; i++) O int i; while (i = 5; i > 0) for (i = 5; i > 0; i--) QUESTION 4 What is wrong with the following code? Scanner kybd = new Scanner(System.in); System.out.println("Enter an int: "); int i = kybd.nextInt(); int j = 1; while (i > 0) System.out.println(j++); The loop body never modifies anything that affects the condition The printin should only printj, and j++ should be its own statement The condition should be i++ The condition should be j> 0 QUESTION 5 Which of the following is a sentinel controlled loop? Scanner kybd = new Scanner(System.in); System.out.println("Enter a value"); int i = kybd.nextInt(); int j = 0; while (j
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
