Java - Control Statements

page 1 out of 3

page 1 out of 3


Question 1     

Which data types are checked in the switch-case statement?







Question 2     

Which data types are checked in switch-case statement?







Question 3     

Other names of IF-ELSE statement







Question 4     

IF-ELSE statements are similar to Java style







Question 5     

What will be the output of the below given code

public class Main {
    
    public static void main(String[] args){        
    if( 4 < 5 )
    {
        System.out.println("Hurray..\n");
    }
     System.out.println("Yes");

    }
}





Question 6     

What will be the output of below given code?

if( 5 > 4 )
        System.out.println("Hyderabad\n");
else if(2<3)
        System.out.println("England\n");
        System.out.println("USA");





Question 7     

What will be the output of the given code snippet

        String  name = "on";
        
        if(name = "on")
            System.out.println("On");
        else
            System.out.println("Off");





Question 8     

What will be the output of the given code snippet

int i = 8, j = 24;  
 if(i = 8) && if(j = 24)  
      System.out.println("Welcome Programmer");  




Question 9     

What will be the output of the given code?

public class Main {
    public static void main(String[] args){        
        String name = "on";
        String On="on";
        String off="off";
        boolean Off=On=="on";
        if(name == "on")
        {
           if(off=="Off")
           {
             System.out.println("Off");
           }
           else
           {    
             System.out.println(Off);
           }
       
        }
        elif
        {
          System.out.println("on");   
        }
        else

            System.out.println("Off");
    }
}





Question 10     

What will be the output of below given code snippet

String animal1="LION", animal2="COW";
if(animal1 == "LION")
  System.out.print("LION ");
  System.out.println("GOOD");					
if(animal2 == "CAT")
  System.out.println("NO");




page 1 out of 3

page 1 out of 3


Sign Up Page

Oops!!

To view the solution need to Login



Score : 0 / 0
L
o
a
d
i
n
g
.
.
.