adplus-dvertising

Welcome to the Operators and Control Statements MCQs Page

Dive deep into the fascinating world of Operators and Control Statements with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Operators and Control Statements, a crucial aspect of Java Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Operators and Control Statements, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Java Programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Operators and Control Statements. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Java Programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Operators and Control Statements. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Operators and Control Statements MCQs | Page 6 of 38

Explore more Topics under Java Programming

Q51.
What is the output of this 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);
        } 
    }
Discuss
Answer: (a).3 1 6
Q52.
What is the output of this program?
    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);
        } 
    }

a.

0

b.

1

c.

3

d.

-4

Discuss
Answer: (c).3
Q53.
What is the output of this program?
    class Output 
    {
        public static void main(String args[]) 
        {    
             int x , y = 1;
             x = 10;
             if (x != 10 && x / 0 == 0)
                 System.out.println(y);
             else
                 System.out.println(++y);
        } 
    }
Discuss
Answer: (b).2
Q54.
What is the output of this program?
    class Output 
    {
        public static void main(String args[]) 
        {    
             boolean a = true;
             boolean b = false;
             boolean c = a ^ b;
             System.out.println(!c);
        } 
    }
Discuss
Answer: (c).false
Q55.
What is the output of this program?
class Output 
{
        public static void main(String args[]) 
        {    
             int x=y=z=20;
 
        } 
}
Discuss
Answer: (d).compile time error
Q56.
Which of these lines of code will give better performance?
   1. a | 4 + c >> b & 7; 
   2. (a | ((( 4 * c ) >> b ) & 7 ))
Discuss
Answer: (c).Both 1 & 2 will give equal performance
Q57.
What is the output of this 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);
 
        } 
}
Discuss
Answer: (c).a=20 b=0 c=20 d=1
Q58.
What will be the output of the program?

class Test 
{
    public static void main(String [] args) 
    {
        int x=20;
        String sup = (x < 15) ? "small" : (x < 22)? "tiny" : "huge";
        System.out.println(sup);
    }
}
Discuss
Answer: (b).tiny
Q59.
What will be the output of the program?

class Test 
{
    public static void main(String [] args) 
    {
        int x= 0;
        int y= 0;
        for (int z = 0; z < 5; z++) 
        {
            if (( ++x > 2 ) && (++y > 2)) 
            {
                x++;
            }
        }
        System.out.println(x + " " + y);
    }
}
Discuss
Answer: (c).6 3
Q60.
What will be the output of the program?

class Test 
{
    public static void main(String [] args) 
    {
        int x= 0;
        int y= 0;
        for (int z = 0; z < 5; z++) 
        {
            if (( ++x > 2 ) || (++y > 2)) 
            {
                x++;
            }
        }
    System.out.println(x + " " + y);
    }
}
Discuss
Answer: (b).8 2

Suggested Topics

Are you eager to expand your knowledge beyond Java Programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!