Question
Please anwser Java questions 12 What is the output of the following code? ? does not print anything prints out Welcome to Java one time
Please anwser Java questions
12 What is the output of the following code?
? does not print anything prints out Welcome to Java one time prints out Welcome to Java two times prints out Welcome to Java forever
13 What is y after the following for loop statement is executed?
? 9 10 11 12
14 Analyze the following code:
import java.util.Scanner;
? The program does not compile because the Scanner input = new Scanner(System.in); statement is inside the loop. The program compiles, but does not run because the Scanner input = new Scanner(System.in); statement is inside the loop. The program compiles and runs, but it is not efficient and unnecessary to execute the Scanner input = new Scanner(System.in); statement inside the loop. You should move the statement before the loop. The program compiles, but does not run because there is not prompting message for entering the input.
15 What is the output of the following fragment?
? System.out.println(j); 4 8 16 32 64
16 Which of the following loops prints "Welcome to Java" 10 times?
? BD ABC AC BC AB
17 What is the value in count after the following loop is executed?
? 8 9 10 11 0
18 To add 0.01 + 0.02 + ... + 1.00, what order should you use to add the numbers to get better accuracy? Add 0.01, 0.02, ..., 1.00 in this order to a sum variable whose initial value is 0. Add 1.00, 0.99, 0.98, ..., 0.02, 0.01 in this order to a sum variable whose initial value is 0.
19 Which of the following loops correctly computes 1/2 + 2/3 + 3/4 + ... + 99/100?
? BCD ABCD B CDE CD
20 What is i after the following for loop?
? 9 10 11 undefined
21 Analyze the following code:
?
boolean even = (number % 2 == 0); Code 1 has compile errors. Code 2 has compile errors. Both Code 1 and Code 2 have compile errors. Both Code 1 and Code 2 are correct, but Code 2 is better.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started