Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 10.05 pts What will the value of x be after the following statements are executed? double a, b, c, x; a = 5; b

Question 10.05 pts

What will the value of x be after the following statements are executed? double a, b, c, x; a = 5; b = 3; c = 6; if ( a <= c ){

x = 1;

} else if ( c > b ) {

x = 2;

} else {

x = 3;

}

0
1
2
3
5

Flag this Question

Question 20.05 pts

What will the value of x be after the following statements are executed? double a, b, c, x; a = 5; b = 3; c = 6; if ( a <= c ) {

x = 1;

}

if ( c > b ) {

x = 2;

}

if ( x > b ) {

x = 3;

}

0
1
2
3
5

Flag this Question

Question 30.05 pts

Which of the following is NOT a Java relational operator?

=
>=
No answer text provided.
!=
>

Flag this Question

Question 40.05 pts

Which of the following is true?

When using == to compare reference variables, you are testing for "identity equality" -- that the two variables refer to the same object.

The .equals() method tests for "content equality" -- that the objects are considered equivalent to each other.

I
II
I & II are both true
Neither is true

Flag this Question

Question 50.05 pts

What symbols does Java use to create block statements (a 'block' of code)?

{ }
()
[ ]
No answer text provided.

Flag this Question

Question 60.05 pts

Which of the following operators may NOT be used with operands of type boolean?

&&
| |
!=
!
ALL of the above may be used with type boolean

Flag this Question

Question 70.05 pts

What is a common use for a variable of type boolean?

a question variable
a flag variable
a counter variable
a reference variable

Flag this Question

Question 80.05 pts

What is a common name for a method that returns type boolean?

a question method
a flag method
a predicate method
a mutator

Flag this Question

Question 90.05 pts

Which of the following data types is NOT valid for the switch expression in a switch instruction?

int
double
char
all three ARE valid
NONE of these is valid

Flag this Question

Question 100.05 pts

If a break statement is not included at the end of each action (alternative) in a switch instruction, what is the result?

a syntax error
a run-time exception
no action will ever be executed
more than one action may be executed
no effect -- execution is unchanged

Flag this Question

Question 110.05 pts

The switch instruction is a more general-purpose (more versatile) tool than the if instruction.

True
False

Flag this Question

Question 120.05 pts

You are writing a program that will allow a user to enter a single word identifying her 'sign' in the Chinese zodiac (e.g. "Dog") and then show some information about that sign. Obviously a decision must be made in this program. Which selection structure(s) could you use?

if statements should be used
a switch statement should be used
either if statements or a switch statement could be used

Flag this Question

Question 130.05 pts

What numerical value for x will cause the following expression to evaluate to true. x > 5 || x < 9

x = 3
x = 7
x = 12
NO value of x -- all numerical values cause the expression to evaluate to false
ALL numerical values cause the expression to evaluate to true

Flag this Question

Question 140.05 pts

Which of the following is a legal Java expression?

2 <= n < 5
2 <= n && < 5
2 <= n && n < 5
2 <= n && !5

Flag this Question

Question 150.05 pts

Which of the following operators has the highest precedence?

| |
No answer text provided.
&&
>
%

Flag this Question

Question 160.05 pts

Which of the following is true in Java? I. Every else must have a preceding if. II. Every if must have a following else.

I.
II.
I & II are both true
Neither are true

Flag this Question

Question 170.05 pts

What kind of loop is a data validation loop?

a definite loop
an indefinite loop

Flag this Question

Question 180.05 pts

Which loop control structure can NOT be used if there are conditions under which the body of the loop should be executed zero times?

for
while
do...while
Any of the loop control structures can be used in this situation.
None of the above -- this situation is impossible to program.

Flag this Question

Question 190.05 pts

You know that a for loop is usually the best choice for a counting loop, but which other loop control structure(s) could possibly be used to create a counting loop?

a while loop
a do...while loop
any of the loop control structures can be used to create a counting loop
none of the above -- only a for loop can be used

Flag this Question

Question 200.05 pts

Consider the following class definition:

public class Woog{

public static void main (String[] a){

Fiddle f = new Fiddle();

...

}

}

How would you describe the relationship between Fiddle and Woog?

Fiddle is the client class. Woog is the supplier class.
Woog is the client class. Fiddle is the supplier class.

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

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions