Quiz Discussion

Modulus operator, %, can be applied to which of these?

Course Name: Java

  • 1]

    Integers

  • 2]

    Floating – point numbers

  • 3]

    Both Integers and floating – point numbers

  • 4]

    None of the mentioned

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 is the output of relational operators?

  • 1]

    Integer

  • 2]

    Boolean

  • 3]

    Characters

  • 4]

    Double

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

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

  • 1]

    true

  • 2]

    false

Solution
4
Discuss

Decrement operator, −−, decreases the value of variable by what number?

  • 1]

    1

  • 2]

    2

  • 3]

    3

  • 4]

    4

Solution
5
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 = 3;
             a |= 4;
             b >>= 1;
             c <<= 1;
             a ^= c;
             System.out.println(a + " " + b + " " + c);
        } 
    }

 

  • 1]

    3 1 6

  • 2]

    2 2 3

  • 3]

    2 3 4

  • 4]

    3 3 6

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

Which operator is used to invert all the digits in a binary representation of a number?

  • 1]

    ~

  • 2]

    <<<

  • 3]

    >>>

  • 4]

    ^

Solution
8
Discuss

Which right shift operator preserves the sign of the value?

  • 1]

    <<

  • 2]

    >>

  • 3]

    <<=

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

 

  • 1]

    7 2

  • 2]

    7 7

  • 3]

    7 5

  • 4]

    5 2

Solution
# Quiz