TOTAL QS = 31Time [ 00 : 00 : 00 ]
00:00:00

Java Basics: IF ELSE IF Control Statements Online Test 1

Instructions

Total Questions: 31

Total Minutes: 31

This ExamTray Free Online Test or Quiz or Trivia tests your Programming Skills on core Java IF ELSE IF control statements. This test displays answers after finishing the exam for review. You can easily clear Competitive Exams and Job Interview Questions. Students can learn Java basics.

Go through Java Theory Notes on IF ELSE IF Statements before attempting this test.

All the Best

Challenge SCORE

0 / 31

Take This Exam
1) An IF-ELSE statement is also called ___.
2) An IF or ELSE IF statement accepts ___ as input before branching.
3) An IF statement in Java is also a ___ statement.
4) Java style IF-ELSE statements are similar to ___.
5) State TRUE or FALSE. Every IF statement must be followed by an ELSE of ELSE-IF statement.
6) An ELSE statement must be preceded by ___ statement in Java.
7) State TRUE or FALSE. A Single-Line comment or Multiline-comment is allowed in between if () and Left Brace ( { ).
8) State TRUE or FALSE. An IF statement code must be defined in between two Braces.
9) State TRUE of FALSE. The code inside an ELSE statement may be surrounded by Braces.
10) State TRUE or FALSE. An ELSE or ELSE-IF statement in Java can not exist alone without IF statement.
11) The condition of an IF statement evaluates to boolean only if the expression contains?
12) If the condition of an IF-statement is false, which is true below.
13) What is maximum lines of code that can be written inside a Java style IF, ELSE or IF-ELSE block?
14) An IF-ELSE statement is better than a SWITCH statement in which scenario below?
15) What is the maximum number of ELSE-IF statements that can present in between starting IF and ending ELSE statements?
16) Choose the correct syntax of Java IF statement below.
17) Choose a wrong statement on Java IF-ELSE syntax below.
18)
What is the output of Java program with IF statement?
if(1)
{
  System.out.println("OK");
}
19) What is the output of the Java program with IF-ELSE statements?
if(TRUE)
  System.out.println("GO");
else
  System.out.println("STOP");
20) What is the output of the Java program?
int a=10;
if(a==9)
  System.out.println("OK ");
  System.out.println("MASTER");					
else
  System.out.println("BYE");
21) What is the output of the Java program?
String name1="FOX", name2="DOG";
if(name1 == "FOX")
  System.out.print("FOX ");
  System.out.println("GOOD");					
if(name2 == "CAT")
  System.out.println("DINO");
22) What is the output of the Java program?
String name="dino";
if(name == "dino")
	System.out.print("DINO");
System.out.println("GOOD");	
23) What is the output of the Java program with IF-ELSE-IF statements?
int marks=55;
if(marks >= 80)
  System.out.println("DISTINCTION");
else if(marks >=35)
  System.out.println("PASS");
else
  System.out.println("FAIL");
24) What is is the output of the Java program?
int marks=85;
if(marks >= 80)
  System.out.println("DISTINCTION");
else if(marks >=35)
  System.out.println("PASS");
25) What is the output of Java program below?
float temp = 98.4f;
if(temp > 98.4)
{
  System.out.println("SUMMER");
}
else
{
  System.out.println("UNKNOWN");
}
26) What is the output of the Java program?
long num = 123L;
if(num > 123)
{
	System.out.println("TIGER");
}
else
{
	System.out.println("BIRD");
}
27) What is the output of the Java program?
int horses = 10;
int camels = 5;
if(horses > 5)
{
  if(camels > 3)
  {
    System.out.println("FOREST");
  }
}
else
{
   System.out.println("CITY");
}
28) What is the output of the Java program?
int horses = 10;
int camels = 5;
if(horses < 5)
{
  System.out.println("TOWN");
}
else if(horses >=5)
  System.out.print("FOREST ");
  System.out.println("AMAZON");
else
  System.out.println("UNKNOWN");
29) What is the output of the Java program?
int marks=29;
if(marks > 29);
   System.out.print("PASS ");
System.out.println("RANK");	
30) What is the output of the Java program below?
if(3>1)
{
  4;
}
31) What is the output of the Java program with IF statement?
if(true)
{
   break;
   System.out.println("ELEPHANT");
}

 

 

ExamTray App is now Available on Google Play EXAMTRAY android app link