Java MULTIPLE CHOICE. Choose the one alternative that best completes the stateme
ID: 3802992 • Letter: J
Question
Java
MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question
8) What is the result of 45 / 4? 8) A) 11 B) 10 C) 11.25 D) 12
9) The statement System.out.printf("%10s", 123456) outputs ________. (Note: * represents a space) 9) A) 12345***** B) 23456***** C) 123456**** D) ****123456
10) What is the printout of the following switch statement?
char ch = 'b';
switch (ch) { case 'a': System.out.print(ch); case 'b': System.out.print(ch); case 'c': System.out.print(ch); case 'd': System.out.print(ch); }
10)
A) b B) bb C) bcd D) abcd E) bbb
11) Which of the following are valid specifiers for the printf statement? (Choose all that apply.) 11) A) %10b B) %8.2d C) %4c D) %10.2e E) %6d
12) The statement System.out.printf("%5d", 123456) outputs ________. 12) A) 23456 B) 123456 C) 12345.6 D) 12345
13) Suppose x=10 and y=10 what is x after evaluating the expression (y >= 10) || (x++> 10)? 13) A) 10 B) 9 C) 11
2
14) How many times will the following code print "Welcome to Java"?
int count= 0; do { System.out.println("Welcome to Java"); } while (++count< 10);
14)
A) 11 B) 8 C) 0 D) 9 E) 10
Explanation / Answer
8) 45/4 = 11.2 but in java it prints 11 for int.
9) the answer is D
10) the answer is bbb ., because the ch = b., and the loop flows downward and pints 3 b's.
11)ACDE are the valid specifiers becuase int doesnt not accept these notations
12) b is the answer
13) c. .x values increases +1 to 10 and makes 11
14) the loop runs on for 10 times
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.