Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Which line of code will set the String s to the value happy? Question 1 options: s

Which line of code will set the String s to the value "happy"?

Question 1 options:

s <- "happy";

set s to "happy";

"happy" = s;

s = "happy";

Question 2 (1 point)

What is the value of the expression (2 + 3 + "fun")?

Question 2 options:

5

23fun

5fun

error

Question 3 (1 point)

Java ints can only represent integers. Decimal values must be handled by a different type.

Question 3 options:

True
False

Question 4 (1 point)

The second line of following code has an error. What change will fix it so the final value in x will be 199?

double b = 99.6; int x = b * 2.0;

Question 4 options:

int x = (int)(b * 2.0);

int x = b * 2;

int x = (int)b * 2;

double x = b * 2.0;

Question 5 (1 point)

A Java int type can hold any integer.

Question 5 options:

True
False

Question 6 (1 point)

What is the value of the following expressions in Java?

20 / 3

Your Answer:Question 6 options:

Answer

Question 7 (1 point)

What is the value of the following expression

4%3 + 1

Question 7 options:

2

2.3333333333

0

1

Question 8 (1 point)

* has higher precedence than -

Question 8 options:

True
False

Question 9 (1 point)

Which command can be used to compile a Java program saved in a file called MyProgram.java

Question 9 options:

javac MyProgram.java

javac MyProgram

java MyProgram.java

java MyProgram

Question 10 (1 point)

A Java double can represent all real numbers between 0 and 1.

Question 10 options:

True
False

Question 11 (1 point)

Java is case-sensitive.

Question 11 options:

True
False

Question 12 (1 point)

What is the value of the expression of boolean variables a and b

a && b

given that a is true and b is false.

Question 12 options:

True
False

Question 13 (1 point)

In the main method, how would you set an int called b to the value held in args[0]?

Question 13 options:

int b = Integer.parseInt(args[0]);

args[0] = b;

int b = args[0];

int b = Scanner.nextInt(args[0]);

Question 14 (1 point)

What is the value of the expression ("fun" + 2 + 3)?

Question 14 options:

fun23

fun+2+3

fun5

fun 23

Question 15 (1 point)

What is the signature of the method that is the starting point of a Java program?

Question 15 options:

public void main(String[] args)

public static void start(String args)

public static void main(String[] args)

public static void main(String args)

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

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

8th Edition

013460153X, 978-0134601533

More Books

Students also viewed these Databases questions