Quiz Discussion

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

Course Name: Java

  • 1]

    1

  • 2]

    32

  • 3]

    33

  • 4]

    31

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

Solution
2
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
3
Discuss

What will be the output of the following Java code?

    class Relational_operator 
    {
        public static void main(String args[])
        {
            int var1 = 5; 
            int var2 = 6;
            System.out.print(var1 > var2);
        } 
    }

 

  • 1]

    1

  • 2]

    0

  • 3]

    true

  • 4]

    false

Solution
4
Discuss

Which of these statements is correct?

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

Solution
6
Discuss

What will be the output of the following Java code?

    class operators 
    {
        public static void main(String args[]) 
        {    
             int x = 8;
             System.out.println(++x * 3 + " " + x);
        } 
    }

 

  • 1]

    24 8

  • 2]

    24 9

  • 3]

    27 8

  • 4]

    27 9

Solution
7
Discuss

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

  • 1]

    true

  • 2]

    false

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