Quiz: Java Operators

To View Tricks: Login Required

Number of Questions: 20

Question: 6 -

Select from among the following character escape code which is not available in Java.

Options:
  1.  \t

  2. \a

  3. \\

  4. \v

  5. Answer:

    \a

    Solution not available.

Question: 7 -

Evaluate the value of the expression?

6 - 2 + 10 % 4 + 7

Options:
  1. 14

  2. 10

  3. 12

  4. 13

  5. Answer:

    13

    Solution not available.

Question: 8 -

Which of the following is the correct expression that evaluates to true if the number x is between 1 and 100 or the number is negative?

Options:
  1. 1 < x < 100 || x < 0

  2. ((x < 100) && (x > 1)) && (x < 0)

  3. ((x < 100) && (x > 1)) || (x < 0)

  4. (1 > x > 100) || (x < 0)

  5. Answer:

    ((x < 100) && (x > 1)) || (x < 0)

    Solution not available.

Question: 9 -

The && and || operators

Options:
  1. Combine two boolean values

  2. Compare two numeric values

  3. Compare two boolean values

  4. Combine two numeric values

  5. Answer:

    Combine two boolean values

    Solution:

    Logical AND(&&) and Logical OR(||) combine two boolean values.


Question: 10 -

What is/are highest order precedence operator(s) in Java?

Options:
  1. { }

  2. Both A & B

  3. None of these

  4. ( )

  5. Answer:

    Both A & B

    Solution:

    Parentheses(), Array subscript{} and Member selection- have the same precedence.