Quiz Discussion

What will be the output of the following Java code?

    class Output 
    {
        public static void main(String args[]) 
        {    
             boolean a = true;
             boolean b = false;
             boolean c = a ^ b;
             System.out.println(!c);
        } 
    }

 

Course Name: Java

  • 1]

    0

  • 2]

    1

  • 3]

    true

  • 4]

    false

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

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

  • 1]

    Integers

  • 2]

    Floating – point numbers

  • 3]

    Both Integers and floating – point numbers

  • 4]

    None of the mentioned

Solution
4
Discuss

Which of these have highest precedence?

  • 1]

    ()

  • 2]

    ++

  • 3]

    *

  • 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;
             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
6
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
7
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
8
Discuss

Which of these operators can skip evaluating right hand operand?

  • 1]

    !

  • 2]

    |

  • 3]

    &

  • 4]

    &&

Solution
9
Discuss

What will be the output of the following Java program?

    class increment 
    {
        public static void main(String args[])
        {
            double var1 = 1 + 5; 
            double var2 = var1 / 4;
            int var3 = 1 + 5;
            int var4 = var3 / 4;
            System.out.print(var2 + " " + var4);
 
        } 
    }

 

  • 1]

    1 1

  • 2]

    0 1

  • 3]

    1.5 1

  • 4]

    1.5 1.0

Solution
10
Discuss

What will be the output of the following Java code?

    class Relational_operator 
    {
        public static void main(String args[])
        {
            int var1 = 5; 
            int var2 = 6;
            System.out.print(var1 > var2);
        } 
    }

 

  • 1]

    1

  • 2]

    0

  • 3]

    true

  • 4]

    false

Solution
# Quiz