
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
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
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 Wayground
61 questions
PRUIN2

Quiz
•
Professional Development
59 questions
dotNet bandomasis egzaminas

Quiz
•
Professional Development
55 questions
O2N2 Test 1

Quiz
•
Professional Development
60 questions
Test de positionnement Français I

Quiz
•
7th Grade - Professio...
60 questions
QUIZ MANAGEMENT 1ère STMG

Quiz
•
Professional Development
63 questions
ESAS 8

Quiz
•
Professional Development
56 questions
Chapter 3: General Regulations

Quiz
•
Professional Development
60 questions
Placement Exam

Quiz
•
Professional Development
Popular Resources on Wayground
18 questions
Writing Launch Day 1

Lesson
•
3rd Grade
11 questions
Hallway & Bathroom Expectations

Quiz
•
6th - 8th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
40 questions
Algebra Review Topics

Quiz
•
9th - 12th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
19 questions
Handbook Overview

Lesson
•
9th - 12th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade