Question
Question 1 With a Scanner object created as follows, what method do you use to read an int value? Scanner input = new Scanner(System.in); A.
Question 1 With a Scanner object created as follows, what method do you use to read an int value? Scanner input = new Scanner(System.in); A. input.nextInt(); B. input.integer(); C. input.nextInteger(); D. input.int();
Question 2 What is y after the following switch statement is executed? int x = 3; int y = 4; switch(x + 3) { case 6: y = 0; case 7: y = 1; default: y += 1; } A. 0 B. 2 C. 4 D. 1
Question 3 What is x after the following statements? int x = 2; int y = 1; x *= y + 1; A. x is 1. B. x is 4. C. x is 3. D. x is 2.
Question 4 Which of the following operators has the highest precedence? A. * B. casting C. + D. /
Question 5 Math.pow(3, 3) returns ________. A. 27.0 B. 9.0 C. 27 D. 9
Question 6 What is sum after the following loop terminates? int sum = 0; int item = 0; do { item++; sum += item; if (sum > 4) break; } while (item < 5); A. 8 B. 6 C. 5 D.
7 Question 7 One byte has ________ bits. A. 16 B. 4 C. 8 D. 12
Question 8 Which of the following expressions is equivalent to (x > 1)? A. x >= 1 B. !(x = 1) C. !(x <= 1) D. !(x < 1) Question
9 A Java statement ends with a ________. A. comma (,) B. closing brace C. semicolon (;) D. period (.)
Question 10 The "less than or equal to" comparison operator in Java is ________. A. =< B. < C. << D. <=
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