# Quiz Discussion

Which of these statements is correct?

Course Name: Java

• 1]

true and false are numeric values 1 and 0

• 2]

true and false are numeric values 0 and 1

• 3]

true is any non zero value and false is 0

• 4]

true and false are non numeric values

##### 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

What will be the output of the following Java code?

    class Output
{
public static void main(String args[])
{
int x , y = 1;
x = 10;
if (x != 10 && x / 0 == 0)
System.out.println(y);
else
System.out.println(++y);
}
}

• 1]

1

• 2]

2

• 3]

Runtime error owing to division by zero in if condition

• 4]

Unpredictable behavior of program

##### Solution
2
Discuss

Which of these statements are incorrect?

• 1]

Equal to operator has least precedence

• 2]

Brackets () have highest precedence

• 3]

Division operator, /, has higher precedence than multiplication operato

• 4]

Addition operator, +, and subtraction operator have equal precedence

##### Solution
3
Discuss

Which operator is used to invert all the digits in a binary representation of a number?

• 1]

~

• 2]

<<<

• 3]

>>>

• 4]

^

##### Solution
4
Discuss

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

• 1]

Integers

• 2]

Floating – point numbers

• 3]

Boolean

• 4]

None of the mentioned

##### Solution
5
Discuss

What will be the output of the following Java program?

    class rightshift_operator
{
public static void main(String args[])
{
int x;
x = 10;
x = x >> 1;
System.out.println(x);
}
}

• 1]

10

• 2]

5

• 3]

2

• 4]

20

##### Solution
6
Discuss

What will be the output of the following Java program?

    class bitwise_operator
{
public static void main(String args[])
{
int a = 3;
int b = 6;
int c = a | b;
int d = a & b;
System.out.println(c + " "  + d);
}
}

• 1]

7 2

• 2]

7 7

• 3]

7 5

• 4]

5 2

##### Solution
7
Discuss

Decrement operator, −−, decreases the value of variable by what number?

• 1]

1

• 2]

2

• 3]

3

• 4]

4

##### Solution
8
Discuss

Which of the following operators can operate on a boolean variable?

   1. &&
2. ==
3. ?:
4. +=
• 1]

3 & 2

• 2]

1 & 4

• 3]

1, 2 & 4

• 4]

1, 2 & 3

##### Solution
9
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
10
Discuss

What is the value stored in x in the following lines of Java code?

   int x, y, z;
x = 0;
y = 1;
x = y = z = 8;
• 1]

0

• 2]

1

• 3]

9

• 4]

8

# Quiz