Question: 1) The switch instruction is a more general-purpose (more versatile) tool than the if instruction. True False 2) You are writing a program that will

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

True
False

2) 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?

a) if statements should be used
b) a switch statement should be used
c) either if statements or a switch statement could be used

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

a) x = 3
b) x = 7
c) x = 12
d) NO value of x -- all numerical values cause the expression to evaluate to false
e) ALL numerical values cause the expression to evaluate to true

4) Which of the following is a legal Java expression?

a) 2 <= n < 5
b) 2 <= n && < 5
c) 2 <= n && n < 5
d) 2 <= n && !5

5) Which of the following operators has the highest precedence?

a) | |
b) +
c) &&
d) >
e) %

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

a) I.
b) II.
c) I & II are both true
d) Neither are true

7) What kind of loop is a data validation loop?

a) a definite loop
b) an indefinite loop

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

a)for
b) while
c) do...while
d) Any of the loop control structures can be used in this situation.
e)

None of the above -- this situation is impossible to program.

9) 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) a while loop
b) a do...while loop
c) any of the loop control structures can be used to create a counting loop
d) none of the above -- only a for loop can be used

10) 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?

a) Fiddle is the client class. Woog is the supplier class.
b) Woog is the client class. Fiddle is the supplier class.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!