Quiz Discussion

Which of these is not a bitwise operator?

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

What will be the output of the following Java code?

    class ternary_operator 
    {
        public static void main(String args[]) 
        {        
             int x = 3;
             int y = ~ x;
             int z;
             z = x > y ? x : y;
             System.out.print(z);
        } 
    }

 

  • 1]

    0

  • 2]

    1

  • 3]

    3

  • 4]

    -4

Solution
2
Discuss

Which of these statements are incorrect?

  • 1]

    The left shift operator, <<, shifts all of the bits in a value to the left specified number of times

  • 2]

    The right shift operator, >>, shifts all of the bits in a value to the right specified number of time

  • 3]

    The left shift operator can be used as an alternative to multiplying by 2

  • 4]

    The right shift operator automatically fills the higher order bits with 0

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

What should be expression1 evaluate to in using ternary operator as in this line?

 expression1 ?  expression2  :  expression3
  • 1]

    Integer

  • 2]

    Floating – point numbers

  • 3]

    Boolean

  • 4]

    None of the mentioned

Solution
# Quiz