Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 Which of the following is NOT a relational operator in Java? 1 points Question 2 Which of the following is not alogical operator?

Question 1

Which of the following is NOT a relational operator in Java?

<>

<=

==

>

1 points

Question 2

Which of the following is not alogical operator?

!

||

!=

&&

1 points

Question 3

Suppose that x is an int variable. Which ofthe following expressions always evaluates to false?

(x > 0) || (x <= 0)

(x > 0) || (x == 0)

(x > 0) && ( x <= 0)

(x >= 0) && (x == 0)

1 points

Question 4

Which of the following is a relational operator?

=

==

!

&&

1 points

Question 5

'A' < 'a' && 4 <= 8 || 2.5 >= 7 || 4
Based on the code above, which part of the expression is notevaluated?

2.5 >= 7

4 < y

2.5 >= 7 || 4 < y

4 <= 8

1 points

Question 6

'A' < 'a' && 4 <= 8 || 2.5 >= 7 || 4
What is the value of the expression above?

true

false

x

It cannot be determined.

1 points

Question 7

int x, y;

if (x < 4)
y = 2;
else if (x > 4)
{
if (x > 7)
y = 4;
else
y = 6;
}
else
y = 8;

Based on the code above, what is the value of y if x= 5?

2

4

6

8

1 points

Question 8

What is the output of the following Java code?

int x = 0;
if (x > 0)
System.out.println("positive ");
System.out.println("zero ");
System.out.println("negative");

zero

negative

zero negative

positive zero negative

1 points

Question 9

If str1 is “Hello” and str2 is “Hi”,which of the following could not be a resultof str1.compareTo(str2);?

-9

-5

-1

1

1 points

Question 10

int x, y;

if (x < 4)
y = 2;
else if (x > 4)
{
if (x > 7)
y = 4;
else
y = 6;
}
else
y = 8;

Based on the code above, what is the value of y if x= 9?

2

4

6

8

1 points

Question 11

switch (lastInitial)
{
case 'A':
System.out.println("section 1");
break;
case 'B':
System.out.println("section 2");
break;
case 'C':
System.out.println("section 3");
break;
case 'D':
System.out.println("section 4");
break;
default:
System.out.println("section 5");
}

Based on the code above, what is the output if lastInitial= 'C'?

section 1

section 2

section 3

section 5

1 points

Question 12

Which of the following will cause a syntax error, if you aretrying to compare x to 5?

if (x == 5)

if (x = 5)

if (x <= 5)

if (x >= 5)

1 points

Question 13

int x, y;

if (x < 4)
y = 2;
else if (x > 4)
{
if (x > 7)
y = 4;
else
y = 6;
}
else
y = 8;

Based on the code above, what is the value of y if x= 1?

2

4

6

8

1 points

Question 14

What is the output of the following Java code?


int x = 57;
int y = 3;

switch (x % 9)
{
case 0:
case 1:
y++;
case 2:
y = y - 2;
break;
case 3:
y = y + 2;
case 4:
break;
case 5:
case 6:
y = y + 3;
}

System.out.println(y);

2

5

6

57

1 points

Question 15

What does >= mean?

less than

greater than

less than or equal to

greater than or equal to

1 points

Question 16

The conditional operator ?: takes ____ arguments.

two

three

four

five

1 points

Question 17

switch (lastInitial)
{
case 'A':
System.out.println("section 1");
break;
case 'B':
System.out.println("section 2");
break;
case 'C':
System.out.println("section 3");
break;
case 'D':
System.out.println("section 4");
break;
default:
System.out.println("section 5");
}

Based on the code above, what is the output if lastInitial= 'E'?

section 2

section 3

section 4

section 5

1 points

Question 18

Which of the following has the highest value?

'-'

'5'

'H'

'b'

1 points

Question 19

After the execution of the following code, what will be thevalue of num if the input values are 0 3? (Assumethat console is a Scanner object initialized tothe standard input device.)


int num = console.nextInt();

if (num > 0)
num = num + 13;
else
if (num >= 3)

num = num + 15;

0

3

13

15

1 points

Question 20

int x;
x = (1 <= 3 && 'K' >= 'F') ? 5 :12

Based on the code above, what is the value of x?

1

3

5

12

Step by Step Solution

3.54 Rating (161 Votes )

There are 3 Steps involved in it

Step: 1

The detailed answer for the above question is provided below 1 a is not a ... 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

Auditing and Assurance Services

Authors: Timothy Louwers, Robert Ramsay, David Sinason, Jerry Straws

6th edition

978-1259197109, 77632281, 77862341, 1259197107, 9780077632281, 978-0077862343

More Books

Students also viewed these Programming questions

Question

=+ Describe the components. Which month was left out? Why?

Answered: 1 week ago

Question

What is the shape of the exponential distribution?

Answered: 1 week ago

Question

How has technology had an impact on product design?

Answered: 1 week ago