Java Programming Quiz

Java Programming Quiz

Professional Development

60 Qs

quiz-placeholder

Similar activities

Dev ilk 66 soru 9 haric

Dev ilk 66 soru 9 haric

Professional Development

65 Qs

BT - Ch-10 Indentifying and Preventing Fraud

BT - Ch-10 Indentifying and Preventing Fraud

Professional Development

55 Qs

python

python

KG - Professional Development

60 Qs

Spanish CC1-CC5

Spanish CC1-CC5

9th Grade - Professional Development

64 Qs

OIC Reviewer

OIC Reviewer

Professional Development

55 Qs

Mixed Review - Ch 7-8-9

Mixed Review - Ch 7-8-9

University - Professional Development

55 Qs

DEP Start Guide Test

DEP Start Guide Test

12th Grade - Professional Development

63 Qs

Java Programming Quiz

Java Programming Quiz

Assessment

Quiz

Other

Professional Development

Medium

Created by

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 greater = a -> a > 15; Predicate less = a -> a < 10; boolean bool = greater.test(20); boolean bool1 = less.test(5); System.out.println(bool); System.out.println(bool1); } }

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

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?