# Quiz Discussion

Which of these is returned by “greater than”, “less than” and “equal to” operators?

Course Name: Java

• 1]

Integers

• 2]

Floating – point numbers

• 3]

Boolean

• 4]

None of the mentioned

##### Solution
No Solution Present Yet

#### Top 5 Similar Quiz - Based On AI&ML

Quiz Recommendation System API Link - https://fresherbell-quiz-api.herokuapp.com/fresherbell_quiz_api

# Quiz
1
Discuss

Which of these statements are incorrect?

• 1]

Assignment operators are more efficiently implemented by Java run-time system than their equivalent long forms

• 2]

Assignment operators run faster than their equivalent long forms

• 3]

Assignment operators can be used only with numeric and character data type

• 4]

None of the mentioned

##### Solution
2
Discuss

Which of these statements are incorrect?

• 1]

The left shift operator, <<, shifts all of the bits in a value to the left specified number of times

• 2]

The right shift operator, >>, shifts all of the bits in a value to the right specified number of time

• 3]

The left shift operator can be used as an alternative to multiplying by 2

• 4]

The right shift operator automatically fills the higher order bits with 0

##### Solution
3
Discuss

What will be the output of the following Java code?

    class bool_operator
{
public static void main(String args[])
{
boolean a = true;
boolean b = !true;
boolean c = a | b;
boolean d = a & b;
boolean e = d ? b : c;
System.out.println(d + " " + e);
}
}

• 1]

false false

• 2]

true ture

• 3]

true false

• 4]

false true

##### Solution
4
Discuss

What should be expression1 evaluate to in using ternary operator as in this line?

 expression1 ?  expression2  :  expression3
• 1]

Integer

• 2]

Floating – point numbers

• 3]

Boolean

• 4]

None of the mentioned

##### Solution
5
Discuss

What is the order of precedence (highest to lowest) of following operators?

    1. &
2. ^
3. ?:
• 1]

1 -> 2 -> 3

• 2]

2 -> 1 -> 3

• 3]

3 -> 2 -> 1

• 4]

2 -> 3 -> 1

##### Solution
6
Discuss

What is the output of relational operators?

• 1]

Integer

• 2]

Boolean

• 3]

Characters

• 4]

Double

##### Solution
7
Discuss

What will be the output of the following Java program?

    class leftshift_operator
{
public static void main(String args[])
{
byte x = 64;
int i;
byte y;
i = x << 2;
y = (byte) (x << 2)
System.out.print(i + " " + y);
}
}

• 1]

0 64

• 2]

64 0

• 3]

0 256

• 4]

256 0

##### Solution
8
Discuss

What will be the output of the following Java code?

    class ternary_operator
{
public static void main(String args[])
{
int x = 3;
int y = ~ x;
int z;
z = x > y ? x : y;
System.out.print(z);
}
}

• 1]

0

• 2]

1

• 3]

3

• 4]

-4

##### Solution
9
Discuss

What will be the output of the following Java code?

class Output
{
public static void main(String args[])
{
int x=y=z=20;

}
}

• 1]

compile and runs fine

• 2]

20

• 3]

run time error

• 4]

compile time error

##### Solution
10
Discuss

Which of these lines of Java code will give better performance?

   1. a | 4 + c >> b & 7;
2. (a | ((( 4 * c ) >> b ) & 7 ))
• 1]

1 will give better performance as it has no parentheses

• 2]

2 will give better performance as it has parentheses

• 3]

Both 1 & 2 will give equal performance

• 4]

Dependent on the computer system

# Quiz