Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 41 Which of the following is NOT a valid assignment statement? A. x = 55; B. 55 = x; C. x += 3; D.

Question 41 Which of the following is NOT a valid assignment statement? A. x = 55; B. 55 = x; C. x += 3; D. x = 56 + y;

Question 42 What is the result of 45 / 4? A. 11.25 B. 10 C. 12 D. 11 Question

43 What is the output of the following code? x = 0; if (x > 0) System.out.println("x is greater than 0"); else if (x < 0) System.out.println("x is less than 0"); else System.out.println("x equals 0"); A. x is greater than 0 B. x is less than 0 C. x equals 0 D. None

Question 44 What is the exact output of the following code? double area = 3.5; System.out.print("area"); System.out.print(area); A. area3.5 B. area 3.5 C. 3.5 3.5 D. 3.53.5

Question 45 What does System.out.println("Welcome" + 1 + 1 * 2); print? A. Welcome3 B. Welcome11*2 C. Welcome12 D. Welcome4

Question 46 Which of the following is the best for generating random integer 0 or 1? A. (int)(Math.random() + 0.5) B. (int)Math.random() + 1 C. (int)Math.random() D. (int)(Math.random() + 0.2) Question 47 What is the printout of the following code: double x = 10.1; int y = (int)x; System.out.println("x is " + x + " and y is " + y); A. x is 10.0 and y is 10.0 B. x is 10.1 and y is 10.0 C. x is 10.1 and y is 10 D. x is 10 and y is 10

Question 48 You should fill in the blank in the following code with ________. public class Test { public static void main(String[] args) { System.out.print("The grade is "); printGrade(78.5); System.out.print("The grade is "); printGrade(59.5); } public static __________ printGrade(double score) { if (score >= 90.0) System.out.println('A'); else if (score >= 80.0) System.out.println('B'); else if (score >= 70.0) System.out.println('C'); else if (score >= 60.0) System.out.println('D'); els System.out.println('F'); } } A. void B. boolean C. double D. char Question 49 The ________ method parses a string s to an int value. A. Integer.parseInteger(s); B. Integer.parseInt(s); C. integer.parseInteger(s); D. integer.parseInt(s);

Question 50 Suppose x = 1, y = -1, and z = 1. What is the printout of the following code? if (x < 0) if (y < 0) System.out. println("x < 0 and y < 0"); else if (z < 0) System.out. println("x < 0 and z < 0"); else System.out. println("x < 0 and z > 0"); A. x > 0 and y > 0; B. x < 0 and z > 0; C. x < 0 and z < 0; D. no printout.

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

Managing Your Information How To Design And Create A Textual Database On Your Microcomputer

Authors: Tenopir, Carol, Lundeen, Gerald

1st Edition

1555700233, 9781555700232

More Books

Students also viewed these Databases questions

Question

In the network shown, Vo = 6v. Find Is. 3 kQ 1 kQ Ig 9 kQ 2 kQ 5 kQ

Answered: 1 week ago

Question

Write a program to check an input year is leap or not.

Answered: 1 week ago

Question

Write short notes on departmentation.

Answered: 1 week ago

Question

What are the factors affecting organisation structure?

Answered: 1 week ago

Question

What are the features of Management?

Answered: 1 week ago

Question

Briefly explain the advantages of 'Management by Objectives'

Answered: 1 week ago

Question

6. Describe why communication is vital to everyone

Answered: 1 week ago