Question
Please anwser the following Java programming questions 1. Will the following program terminate? ? Yes No 2.) Do the following two statements in (I) and
Please anwser the following Java programming questions
1. Will the following program terminate?
? Yes No
2.) Do the following two statements in (I) and (II) result in the same value in sum?
? Yes No
hich of the following expression yields an integer between 0 and 100, inclusive? (int)(Math.random() * 100) (int)(Math.random() * 101) (int)(Math.random() * 100) + 1 (int)(Math.random() * 100 + 1)
4 The following loop displays ________.
? 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 1 3 5 7 9 2 4 6 8 10
5 Analyze the following code.
? The loop runs forever. The code does not compile because the loop body is not in the braces. The code does not compile because (0 < x) && (x < 100) is not enclosed in a pair of parentheses. The numbers 1 to 99 are displayed. The numbers 2 to 100 are displayed.
6. What is y after the following switch statement?
? 1 -1 0 2
7 Assume x = 4, which of the following is true? !(x == 4) x != 4 x == 5 x != 5
8 You can always convert a switch statement to an equivalent if statement. true false
9 Analyze the following code:
if (x < 100) && (x > 10) System.out.println("x is between 10 and 100"); The statement has compile errors because (x<100) & (x > 10) must be enclosed inside parentheses. The statement has compile errors because (x<100) & (x > 10) must be enclosed inside parentheses and the println() statement must be put inside a block. The statement compiles fine. The statement compiles fine, but has a runtime error.
10 What is x after evaluating the following?
x = (2 > 3) ? 2 : 3; 2 3 4 5
11 What is the value of balance after the following code is executed?
? -1 0 1 2
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