Quiz Discussion

Which of these is returned by “greater than”, “less than” and “equal to” operators?

Course Name: Java

  • 1]

    Integers

  • 2]

    Floating – point numbers

  • 3]

    Boolean

  • 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 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
2
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
3
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
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,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
6
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
7
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
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

What will be the output of the following Java program?

    class Modulus 
    {
        public static void main(String args[]) 
        {    
             double a = 25.64;
             int  b = 25;
             a = a % 10;
             b = b % 10;
             System.out.println(a + " "  + b);
        } 
    }

 

  • 1]

    5.640000000000001 5

  • 2]

    5.640000000000001 5.0

  • 3]

    5 5

  • 4]

    5 5.640000000000001

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