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(); } }

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
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 Quizizz
65 questions
Prueba Aviación Civil Drones

Quiz
•
Professional Development
60 questions
Calif. drivers permit test

Quiz
•
10th Grade - Professi...
64 questions
PRAXIS 5362

Quiz
•
Professional Development
60 questions
OSI Model and Networking Concepts

Quiz
•
Professional Development
56 questions
Day Off 2024 MP-Subscriptions & Recurring Engine

Quiz
•
Professional Development
60 questions
Real Estate Ch. 1

Quiz
•
Professional Development
55 questions
REVISION

Quiz
•
Professional Development
59 questions
Classroom Etiquette Quiz

Quiz
•
Professional Development
Popular Resources on Quizizz
15 questions
Multiplication Facts

Quiz
•
4th Grade
25 questions
SS Combined Advisory Quiz

Quiz
•
6th - 8th Grade
40 questions
Week 4 Student In Class Practice Set

Quiz
•
9th - 12th Grade
40 questions
SOL: ILE DNA Tech, Gen, Evol 2025

Quiz
•
9th - 12th Grade
20 questions
NC Universities (R2H)

Quiz
•
9th - 12th Grade
15 questions
June Review Quiz

Quiz
•
Professional Development
20 questions
Congruent and Similar Triangles

Quiz
•
8th Grade
25 questions
Triangle Inequalities

Quiz
•
10th - 12th Grade