InstructionsTotal Questions: 31Total Minutes: 31This 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 SCORE0 / 31Take This Exam 1*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18*19*20*21*22*23*24*25*26*27*28*29*30*31*Q Buttons 1) An IF-ELSE statement is also called ___. A) Branching statement B) Control statement C) Block statements D) All 2) An IF or ELSE IF statement accepts ___ as input before branching. A) boolean B) int C) float D) char 3) An IF statement in Java is also a ___ statement. A) boolean B) conditional C) iterative D) optional 4) Java style IF-ELSE statements are similar to ___. A) C style B) C++ Style C) Both C and C++ style D) None 5) State TRUE or FALSE. Every IF statement must be followed by an ELSE of ELSE-IF statement. A) TRUE B) FALSE C) - D) - 6) An ELSE statement must be preceded by ___ statement in Java. A) IF B) ELSE IF C) IF or ELSE IF D) None 7) State TRUE or FALSE. A Single-Line comment or Multiline-comment is allowed in between if () and Left Brace ( { ). A) FALSE B) TRUE C) - D) - Ad 8) State TRUE or FALSE. An IF statement code must be defined in between two Braces. A) FALSE B) TRUE C) - D) - 9) State TRUE of FALSE. The code inside an ELSE statement may be surrounded by Braces. A) FALSE B) TRUE C) - D) - 10) State TRUE or FALSE. An ELSE or ELSE-IF statement in Java can not exist alone without IF statement. A) FALSE B) TRUE C) - D) - 11) The condition of an IF statement evaluates to boolean only if the expression contains? A) logical operators B) relational operators C) boolean operands D) All 12) If the condition of an IF-statement is false, which is true below. A) IF block is executed. B) ELSE block is executed. C) Both IF and ELSE blocks are skipped. D) Both IF and ELSE blocks are executed. 13) What is maximum lines of code that can be written inside a Java style IF, ELSE or IF-ELSE block? A) 32 B) 64 C) 512 D) None 14) An IF-ELSE statement is better than a SWITCH statement in which scenario below? A) Checking for More-than condition B) Checking for Less-than condition C) Checking for Ranges D) All Ad 15) What is the maximum number of ELSE-IF statements that can present in between starting IF and ending ELSE statements? A) 32 B) 64 C) 128 D) None 16) Choose the correct syntax of Java IF statement below. A) if(condition) //statement B) if(condition) { //statement } C) if(condition) { //statement1 //statement2 } D) All 17) Choose a wrong statement on Java IF-ELSE syntax below. A) if(condition) //statement1 else //statement2 B) else //statement2 C) if(condition1) //statement1 else if(condition2) //statement2 D) if(condition1) //statement1 else if(condition2) //statement2 else //statement3 18) What is the output of Java program with IF statement? if(1) { System.out.println("OK"); } A) OK B) No output C) Compiler error D) None 19) What is the output of the Java program with IF-ELSE statements? if(TRUE) System.out.println("GO"); else System.out.println("STOP"); A) GO B) STOP C) Compiler error D) None 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"); A) OK MASTER B) BYE C) Compiler error D) None 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"); A) FOX DINO B) FOX GOOD DINO C) Compiler error D) None Ad 22) What is the output of the Java program? String name="dino"; if(name == "dino") System.out.print("DINO"); System.out.println("GOOD"); A) DINO GOOD B) DINO C) GOOD D) Compiler error 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"); A) DISTINCTION B) PASS C) FAIL D) Compiler error 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"); A) DISTINCTION B) PASS C) Compiler error D) None 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"); } A) SUMMER B) UNKNOWN C) Compiler error D) None 26) What is the output of the Java program? long num = 123L; if(num > 123) { System.out.println("TIGER"); } else { System.out.println("BIRD"); } A) TIGER B) BIRD C) Compiler error D) None 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"); } A) FOREST B) CITY C) Compiler error D) None 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"); A) TOWN B) FOREST AMAZON C) UNKNOWN D) Compiler error Ad 29) What is the output of the Java program? int marks=29; if(marks > 29); System.out.print("PASS "); System.out.println("RANK"); A) RANK B) PASS C) PASS RANK D) Compiler error 30) What is the output of the Java program below? if(3>1) { 4; } A) 0 B) 4 C) Compiler error D) None 31) What is the output of the Java program with IF statement? if(true) { break; System.out.println("ELEPHANT"); } A) No output B) ELEPHANT C) Compiler error D) None FINISH EXAM 1*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18*19*20*21*22*23*24*25*26*27*28*29*30*31*PREVJava Ternary Operator Online Test NEXTJava Switch Case Online Test Certification Group ID 3845