# Quiz Discussion

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;
Course Name: Java

• 1]

1, 2 & 3

• 2]

1 & 4

• 3]

1, 2, 3 & 4

• 4]

3 & 2

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

On applying Left shift operator, <<, on integer bits are lost one they are shifted past which position bit?

• 1]

1

• 2]

32

• 3]

33

• 4]

31

##### Solution
2
Discuss

What will be the output of the following Java program?

    class Modulus
{
public static void main(String args[])
{
double a = 25.64;
int  b = 25;
a = a % 10;
b = b % 10;
System.out.println(a + " "  + b);
}
}

• 1]

5.640000000000001 5

• 2]

5.640000000000001 5.0

• 3]

5 5

• 4]

5 5.640000000000001

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

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
5
Discuss

Can 8 byte long data type be automatically type cast to 4 byte float data type?

• 1]

true

• 2]

false

##### Solution
6
Discuss

What will be the output of the following Java code?

    class Output
{
public static void main(String args[])
{
boolean a = true;
boolean b = false;
boolean c = a ^ b;
System.out.println(!c);
}
}

• 1]

0

• 2]

1

• 3]

true

• 4]

false

##### Solution
7
Discuss

Which right shift operator preserves the sign of the value?

• 1]

<<

• 2]

>>

• 3]

<<=

• 4]

>>=

##### Solution
8
Discuss

What will be the output of the following Java program?

    class Output
{
public static void main(String args[])
{
int a = 1;
int b = 2;
int c;
int d;
c = ++b;
d = a++;
c++;
b++;
++a;
System.out.println(a + " " + b + " " + c);
}
}

• 1]

3 2 4

• 2]

3 2 3

• 3]

2 3 4

• 4]

3 4 4

##### Solution
9
Discuss

What will be the output of the following Java program?

class Output
{
public static void main(String args[])
{
int a,b,c,d;
a=b=c=d=20
a+=b-=c*=d/=20
System.out.println(a+" "+b+" "+c+" "+d);

}
}

• 1]

compile time error

• 2]

runtime error

• 3]

a=20 b=0 c=20 d=1

• 4]

none of the mentioned

##### Solution
10
Discuss

What will be the output of the following Java code?

    class operators
{
public static void main(String args[])
{
int var1 = 5;
int var2 = 6;
int var3;
var3 = ++ var2 * var1 / var2 + var2;
System.out.print(var3);
}
}

• 1]

10

• 2]

11

• 3]

12

• 4]

56

# Quiz