Quiz Discussion

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);
        } 
    }

 

Course Name: Java

  • 1]

    7 2

  • 2]

    7 7

  • 3]

    7 5

  • 4]

    5 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

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

Which of these is not a bitwise operator?

  • 1]

    &

  • 2]

    &=

  • 3]

    |=

  • 4]

    <=

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

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

Which of these have highest precedence?

  • 1]

    ()

  • 2]

    ++

  • 3]

    *

  • 4]

    >>

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