Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 21 Which of the following expression yields an integer between 0 and 100, inclusive? A. (int)(Math.random() * 100) B. (int)(Math.random() * 101) C. (int)(Math.random()

Question 21 Which of the following expression yields an integer between 0 and 100, inclusive? A. (int)(Math.random() * 100) B. (int)(Math.random() * 101) C. (int)(Math.random() * 100) + 1 D. (int)(Math.random() * 100 + 1

Question 23 The not equal comparison operator in Java is ________. A. != = B. <> C. ^= D. !=

Question 24 What is the output of the following fragment? for (int i = 0; i < 15; i++) { if (i % 4 == 1) System.out.println(i + " "); } A. 1 5 9 13 17 B. 1 3 5 7 9 11 13 C. 1 5 9 13 D. 1 4 8 12 Question 25 What is the printout of the following code? double x = 5.5; int y = (int)x; System.out.println("x is " + x + " and y is " + y); A. x is 6 and y is 6 B. x is 6.0 and y is 6.0 C. x is 5.5 and y is 5.0 D. x is 5.5 and y is 5

Question 26 Analyze the following code: if (x < 100) && (x > 10) System.out.println("x is between 10 and 100"); A. The statement has compile errors because (x < 100) && (x > 10) must be enclosed inside parentheses. B. The statement compiles fine. C. 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. D. The statement compiles fine, but has a runtime error.

Question 27 Java allows you to declare methods with the same name in a class. This is called ________. A. method redeclaration B. method overriding C. method duplication D. method overloading

Question 28 Arguments to methods always appear within ________. A. parentheses B. quotation marks C. curly braces D. brackets

Question 29 Math.pow(2, 3) returns ________. A. 9 B. 8 C. 9.0 D. 8.0 Question 30 The statement System.out.printf("%10s", 123456) outputs ________. (Note: in rhe answers * represents a space) A. 123456**** B. 12345***** C. 23456***** D. ****123456

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

Temporal Databases Research And Practice Lncs 1399

Authors: Opher Etzion ,Sushil Jajodia ,Suryanarayana Sripada

1st Edition

3540645195, 978-3540645191

Students also viewed these Databases questions

Question

socialist egalitarianism which resulted in wage levelling;

Answered: 1 week ago

Question

soyuznye (all-Union, controlling enterprises directly from Moscow);

Answered: 1 week ago