Question

4. The _____ case is performed by the switch statement if a match is not found...

4. The _____ case is performed by the switch statement if a match is not found

  1. default

  2. first

  3. second

  4. otherwise

Answer:


5. When three relational expressions are joined by OR (||) operators, there must be at least _____ of the relational expressions that evaluate to true for the logical expression to evaluate to true.

  1. one

  2. two

  3. three

  4. none of the relational expressions evaluate to true

Answer:


6. Which of the following items is an acceptable first character in a Java identifier, such as a variable name?

  1. letter

  2. period

  3. semicolon

Answer:


7. When a group of several relational expressions are joined with AND (&&) operators, _____ relational expression(s) must be evaluated to true for the logical expression to be evaluated to true.

  1. one

  2. two

  3. all

  4. none of the relational expressions evaluate to true

Answer:







8. The _____ command allows exiting from a switch statement when a match has occurred.

  1. else

  2. if

  3. case

  4. break

Answer:



9. The language directly executable by a CPU (without translation) is:

  1. bytecode

  2. source code

  3. machine code

Answer:


10. The logical operator || has higher precedence than &&.

  1. true

  2. false


Answer:


11. Which of the following Boolean assignment statements is valid?

  1. boolean a = ‘true’;

b. boolean a = true;

c. boolean a = “true”;

d. boolean a = TRUE;

Answer:


12. Which of the following is NOT a logical operator?

  1. &&

  2. ||

  3. %

Answer:




13. The operands of a logical expression must be of type ______

  1. float

  2. long

  3. integer

  4. boolean

Answer:


14. Assuming that the variables are integers, which of the following expressions is not valid?

  1. (a <= B)

  2. (a != B)

  3. (A == B) <= C

  4. (A ==B)

Answer:

15. Java allows assigning a wrong type to a variable by using casting. According to the information given in this class, when assigning a narrow range value to a wider range variable, explicit casting is not needed.


  1. true

  2. false

Answer:


16. If two classes are related to each other through inheritance hierarchy, the child object can access its parent’s private members.

  1. true

  2. false

Answer:


17. Java is a structured language. This means Java uses the following mechanisms to control the execution flow.

  1. Block, loops, and repetition.

  2. Block, selection, and repetition.

  3. Block, selection, if statements.

Answer:

Homework Answers

Answer #1
Question4:
Answer: default

The default case is performed by the switch statement if a match is not found

Question5:

Answer: one

When three relational expressions are joined by OR (||) operators, there must be at least one of the relational expressions that evaluate to true for the logical expression to evaluate to true.

Question6:
Answer: Letter

Letter is an acceptable first character in a Java identifier, such as a variable name?

Question7:
Answer: all

When a group of several relational expressions are joined with AND (&&) operators, all relational expression(s) must be evaluated to true for the logical expression to be evaluated to true.

Question8:
Answer: break

The break command allows exiting from a switch statement when a match has occurred.

Question9:
Answer: machine code

The language directly executable by a CPU (without translation) is: machine code

Question10:
Answer: false

The logical operator && has higher precedence than ||, so the given statement is false.

***Please give Upvote***
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
python Given: age1 = 21 age2 = 14 age3 = 15 Simplify the following expression to...
python Given: age1 = 21 age2 = 14 age3 = 15 Simplify the following expression to true or false: age1 > age3 and not(age3 == 15) or age3 > age2 Step 1) Substitute in the values Step 2) Evaluate all the relational operators (<, >, <=, >=, ==, !=) to true or false Step 3) Evaluate the boolean (logical) operator (and, or, not) of highest precedence Step 4) Evaluate the next boolean (logical) operator (and, or, not) of highest precedence...
   QUESTION 6 1.   If we wanted something like the python else statement for a counter...
   QUESTION 6 1.   If we wanted something like the python else statement for a counter controlled loop in Java, what would it look like?        Since there is no way for a loop in Java to tell you if it completed without breaks or continues, you'd need to set a boolean flag to indicate that and check it after the loop was completed.        We simply check either break or continue flags to see if either is...
Stack2540Array import java .io .*; import java . util .*; public class Stack2540Array { int CAPACITY...
Stack2540Array import java .io .*; import java . util .*; public class Stack2540Array { int CAPACITY = 128; int top ; String [] stack ; public Stack2540Array () { stack = new String [ CAPACITY ]; top = -1; } 1 3.1 Implement the stack ADT using array 3 TASKS public int size () { return top + 1; } public boolean isEmpty () { return (top == -1); } public String top () { if ( top == -1)...
QUESTION 1 What does the following code segment output? int red, blue; red = 7; blue...
QUESTION 1 What does the following code segment output? int red, blue; red = 7; blue = red + 2 * 5 red++; blue = blue + red; cout << blue; 4 points    QUESTION 2 Is the following statement true or false? The Boolean expression in the following if statement will be true for all values of x in the range from 10 to 20 (including the endpoints) and false for all other values: int x; if (x >=...
Description: In this assignment, you need to implement a recursive descent parser in C++ for the...
Description: In this assignment, you need to implement a recursive descent parser in C++ for the following CFG: 1. exps --> exp | exp NEWLINE exps 2. exp --> term {addop term} 3. addop --> + | - 4. term --> factor {mulop factor} 5. mulop --> * | / 6. factor --> ( exp ) | INT The 1st production defines exps as an individual expression, or a sequence expressions separated by NEWLINE token. The 2nd production describes an...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT