
Java Programming Quiz

Quiz
•
Other
•
Professional Development
•
Medium
Venubabu Venubabu
Used 1+ times
FREE Resource
60 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
What will be the output of the following program? interface I1 { default void m2() { System.out.println("bye"); } void m1(); } @FunctionalInterface interface I2 extends I1 { default void m2() { System.out.println("hello"); } } public class Test { public static void main(String[] args) { I2 x = () -> System.out.println("hi"); x.m1(); x.m2(); } }
hi bye
Compilation Error
hi hello
Runtime Error
2.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
What will the output of the following code? public interface A111 { String s = "yo"; public void method1(); } interface B { } interface C extends A111, B { public void method1(); public void method1(int x); }
Compilation succeeds.
Compilation fails due to multiple errors.
Compilation fails due to an error only on line 20.
Compilation fails due to an error only on line 21.
Compilation fails due to an error only on line 22.
3.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
What will be the output of the following program? import java.util.function.Predicate; public class Test { public static void main(String[] args) { Predicate
no output
true true
true false
true
true true
4.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
Is there any error in the following code? @FunctionalInterface public interface MyInterface { String myInterface(String a); int hashCode(); String toString(); }
The code will compile.
The code will give a compilation error.
5.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
What will be the output of the following program? @FunctionalInterface interface MyInterface { String cal(String value); } public class FunctionalInterfaceExample { public static void main(String[] args) { MyInterface myInterface = (String value) -> 75 + value; System.out.println(myInterface.cal("hi" + 25)); } }
hi7525
hi2527
75hi25
hi100
None of the above
6.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
What will be the output of the following program? @FunctionalInterface interface MyInterface { public String nit(String name); } public class FunctionalInterfaceExample { public static void main(String[] args) { MyInterface myInterface = (String name) -> "Welcome to "; System.out.println(myInterface.nit("Learning")); } }
Welcome to Learning
Learning Welcome to
No output
Compile time error
Welcome to
7.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
What will be the output of the following program? @FunctionalInterface interface Movie { String movieName(); } public class TestMcq { public static void main(String[] args) { Movie m = () -> return "DDLJ"; System.out.println(m.movieName()); } }
No output
DDLJ
ddlj
Movie
Compile time error
Create a free account and access millions of resources
Similar Resources on Wayground
55 questions
O2N2 Test 1

Quiz
•
Professional Development
63 questions
ESAS 8

Quiz
•
Professional Development
61 questions
PRUIN2

Quiz
•
Professional Development
60 questions
Placement Exam

Quiz
•
Professional Development
55 questions
SSA USPS

Quiz
•
Professional Development
60 questions
schema level called

Quiz
•
Professional Development
59 questions
dotNet bandomasis egzaminas

Quiz
•
Professional Development
Popular Resources on Wayground
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
10 questions
Ice Breaker Trivia: Food from Around the World

Quiz
•
3rd - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
20 questions
ELA Advisory Review

Quiz
•
7th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Multiplication and Division Unknowns

Quiz
•
3rd Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade