Programming  Java  Operators

1. Which of the following can be operands of arithmetic operators?

Numeric Boolean Characters Both Numeric & Characters

Share this QA

2. Modulus operator, %, can be applied to which of these?

Integers Floating – point numbers Both Integers and floating – point numbers. None of the mentioned

Share this QA

3. With x = 0, which of the following are legal lines of Java code for changing the value of x to 1?
1. x++;
2. x = x + 1;
3. x += 1;
4. x =+ 1;

1, 2 & 3 1 & 4 1, 2, 3 & 4 3 & 2

Share this QA

4. Decrement operator, –, decreases value of variable by what number?

1 2 3 4

Share this QA

5. Which of these statements are incorrect?

Assignment operators are more efficiently implemented by Java run-time system than their equivalent long forms. Assignment operators run faster than their equivalent long forms. Assignment operators can be used only with numeric and character data type. None

Share this QA

6. What should be expression1 evaluate to in using ternary operator as in this line?
expression1 ? expression2 : expression3

Integer Floating – point numbers Boolean None of the mentioned

Share this QA

7. What is the value stored in x in following lines of code?
int x, y, z;
x = 0;
y = 1;
x = y = z = 8;

0 1 9 8

Share this QA

8. What is the order of precedence (highest to lowest) of following operators?
1. &
2. ^
3. ?:

1 -> 2 -> 3 2 -> 1 -> 3 3 -> 2 -> 1 2 -> 3 -> 1

Share this QA

9. Which of these statements are incorrect?

Equal to operator has least precedence. Brackets () have highest precedence. Division operator, /, has higher precedence than multiplication operator. Addition operator, +, and subtraction operator have equal precedence.

Share this QA

10. What is the output of relational operators?

Integer Boolean Characters Double

Share this QA

 

*Click on the QNo to display a Question.

Total Ans