Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question 20) What is 1.0+ 1.0+ 1.0+ 1.0+ 1.0== 5.0?

Java

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question

20) What is 1.0+ 1.0+ 1.0+ 1.0+ 1.0== 5.0? 20) A) true B) false C) There is no guarantee that 1.0+ 1.0+ 1.0+ 1.0+ 1.0== 5.0 is true. 21) Analyze the following code. boolean even= false; if (even) { System.out.println("It is even!"); } 21) A) The code is wrong. You should replace if (even) with if (even = true) B) The code displays nothing. C) The code is wrong. You should replace if (even) with if (even == true) D) The code displays It is even! 22) Analyze the following fragment: double sum= 0; double d= 0; while (d != 10.0) { d+= 0.1; sum += sum + d; } 22) A) The program does not compile because sum and d are declared double, but assigned with integer value 0. B) The program never stops because d is always 0.1 inside the loop. C) After the loop, sum is 0 + 0.1+ 0.2+ 0.3+ ... + 1.9 D) The program may not stop because of the phenomenon referred to as numerical inaccuracy for operating with floating-point numbers. 23) Which of these data types requires the most amount of memory? 23) A) byte B) int C) long D) short 4 24) What is y after the following statement is executed? x= 0; y= (x > 0) ? 10 :-10; 24) A) 0 B) 20 C) -10 D) 10 E) Illegal expression 25) How many times will the following code print "Welcome to Java"? int count= 0; do { System.out.println("Welcome to Java"); } while (count++ < 10); 25) A) 8 B) 11 C) 10 D) 0 E) 9

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions