Java Operators and Control Statements Mcqs

Our collections of Multiple choice questions and answers focuses on study of Java Operators and Control Statements. These questions are chosen from a collection of most authoritative and best reference books on Java. Our aim is to prepare an individual for competitive exams like NTS, GAT, ECAT, University and College entrance exams and various tests and job interviews. One should practice our Mcqs to assimilate jJava Operators and Control Statements topic comprehensively.

2.
Which of these statements are incorrect?

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

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

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

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

3.
What is the output of this program?

    class bitwise_operator 
    {
        public static void main(String args[])
        {
            int var1 = 42;
            int var2 = ~var1;
            System.out.print(var1 + " " + var2);      
        } 
    }

42 42

43 43

42 -43

42 43

4.
What is the output of this 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);
        } 
    }

7 2

7 7

7 5

5 2

9.
Which of these statements is correct?

True and false are numeric values 1 and 0

True and false are numeric values 0 and 1

True is any non zero value and false is 0

True and false are non numeric values

10.
What is the output of this program?

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

1

0

True

False

11.
What is the output of this program?

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

false false

frue ture

frue false

false true

16.
Which of these statements are incorrect?

Equal to operator has least precedence

Brackets () have highest precedence

Division operator, /, has higher precedence than multiplication operator

Addition operator, +, and subtraction operator have equal precedence

0Shares
0
Scroll to Top