InstructionsTotal Questions: 24Total Minutes: 24This ExamTray Free Online Test or Quiz or Trivia tests your Programming Skills on Java Ternary Operator or Conditional Operator. 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 Ternary Operator before attempting this test. All the Best Challenge SCORE0 / 24Take 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*Q Buttons 1) What is the other name for a Question Mark - Colon (?:) operator in Java? A) Special Relational operator B) Special Logical Operator C) Ternary Operator D) None 2) Java Ternary operator is sometimes called ____. A) Relational Operator B) Conditional Operator C) Logical Operator D) None 3) The condition of a Java Ternary operator should evaluate to ___. A) 1 or 0 B) true or false C) TRUE or FALSE D) None 4) State TRUE or FALSE. True expression part comes first after ? (question mark) symbol and before : (colon) symbol. A) FALSE B) TRUE C) - D) - 5) Java Ternary operator can be used with ___. A) if-else statements B) while, do while loops C) for loop, enhanced for loop D) All 6) A java Ternary operator has priority less than ___. A) Relational operators B) Arithmetic operators C) Logical and bitwise operators D) All 7) Java assignment operator has priority more than ___. A) Assignment and Lambda operator B) Logical and bitwise operator C) Arithmetic operators D) Logical operators Ad 8) The True Part Expression of a Java conditional operator or Ternary operator ____ return a value. A) may B) can C) must D) None 9) The False Part Expression of a Java conditional operator or Ternary operator ____ return a value. A) may B) can C) must D) None 10) Choose a possible error with a Ternary operator while compiling a Java program. A) The left-hand side of an assignment must be a variable. B) void is an invalid type for the variable C) Type mismatch: cannot convert from void to int D) All 11) You can nest one Java Ternary operator inside another Ternary operator. State TRUE or FALSE. A) FALSE B) TRUE C) - D) - 12) What is the output of the code snippet with the ternary operator? int p=5; System.out.print("Hello "); (p<6)?5:6; A) Hello 5 B) Hello 6 C) Hello D) Compiler error 13) What is the output of the Java code snippet with Ternary operator? int num = false?10:20; System.out.println(num); A) 10 B) 20 C) 0 D) Compiler error 14) What is the output of the Java code snippet with Ternary operator? String name = "java"; int marks = name == "java"?10:20; System.out.println("Marks=" + marks); A) marks=0 B) marks=10 C) marks=20 D) Compiler error Ad 15) What is the output of the Java code snippet with a Ternary operator? String name = "cat"; int marks = name == "Cat"?10:20; System.out.println("Marks=" + marks); A) Marks=0 B) Marks=10 C) Marks=20 D) Compiler error 16) What is the output of the Java code snippet with a Ternary operator? String name1 = "pen"; String name2 = "pen"; int marks = name2.equals(name1)?50:80; System.out.println("Marks=" + marks); A) Marks=0 B) Marks=50 C) Marks=80 D) Compiler error 17) What is the output of the Java code snippet with a Ternary operator? void show() { int num = true ? getNumber() : 20; System.out.print("TOMATO=" + num); } void getNumber() { System.out.print(30); } A) TOMATO=0 B) TOMATO=20 C) TOMATO=30 D) Compiler error 18) What is the output of Java code snippet with a Ternary operator or Conditional operator? void show() { String name = true ? getName() : "FRANCE"; System.out.print(name); } void getName() { System.out.print("ENGLAND"); } A) Empty string B) FRANCE C) ENGLAND D) Compiler error 19) What is the output of Java code snippet with a Ternary operator? String forest = null; String output = forest != null ? "Goblin" : "Amazon"; System.out.println(output); A) null B) Goblin C) Amazon D) Compiler error 20) What is the output of the Java code snippet below? int a = 20, b=30; int total = a>10&&b<10?65:75; System.out.println(total); A) 0 B) 65 C) 75 D) Error: The left-hand side of an assignment must be a variable 21) What is the output of the Java code snippet below? int a = 20, b=30; boolean result = a&b?true:false; System.out.println(result); A) false B) true C) 0 D) Compiler error Ad 22) What is the output of the Java code snippet below? int a = 4, b=7; int result = (true?a&b:a|b)>3?120:150; System.out.println(result); A) 4 B) 120 C) 150 D) Compiler error 23) What is the output of Java code snippet below? final int a = 25, b=33; String name = !true?"Dino":"Tom"; System.out.println(name); A) Empty B) Dino C) Tom D) Compiler error 24) What is the output of Java code snippet below? int a = 25, b=33; String name = true?"CAT":; System.out.println(name); A) Empty B) CAT C) null D) Compiler error 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*PREVJava Bitwise Operators Online Test 2 NEXTJava IF ELSE IF Online Test Certification Group ID 3845