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
•
Hard
Venubabu Venubabu
Used 1+ times
FREE Resource
60 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
hi bye
Compilation Error
hi hello
Runtime Error
2.
MULTIPLE CHOICE QUESTION
30 sec • 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
30 sec • 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
30 sec • 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
30 sec • 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
30 sec • 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
30 sec • 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
63 questions
DEP Start Guide Test

Quiz
•
12th Grade - Professi...
64 questions
C++ Quizz

Quiz
•
Professional Development
65 questions
Module 7 Vocabulary Terms - File Types and Data Formats

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

Quiz
•
Professional Development
60 questions
Real Estate Ch. 1

Quiz
•
Professional Development
60 questions
Soft Skills

Quiz
•
University - Professi...
55 questions
Assessment 1

Quiz
•
Professional Development
62 questions
FTCE- Media Specialist Test

Quiz
•
Professional Development
Popular Resources on Quizizz
15 questions
Character Analysis

Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
10 questions
American Flag

Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension

Quiz
•
5th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25

Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade