Quiz Discussion

Which right shift operator preserves the sign of the value?

Course Name: Java

  • 1]

    <<

  • 2]

    >>

  • 3]

    <<=

  • 4]

    >>=

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

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

  • 1]

    true

  • 2]

    false

Solution
2
Discuss

What will be the output of the following Java program?

    class bitwise_operator 
    {
        public static void main(String args[])
        {
            int var1 = 42;
            int var2 = ~var1;
            System.out.print(var1 + " " + var2);     	
        } 
    }

 

  • 1]

    42 42

  • 2]

    43 43

  • 3]

    42 -43

  • 4]

    42 43

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

Which of these have highest precedence?

  • 1]

    ()

  • 2]

    ++

  • 3]

    *

  • 4]

    >>

Solution
5
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
6
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
7
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
8
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
9
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

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

Solution
# Quiz