Java Programming Quiz

Java Programming Quiz

Professional Development

60 Qs

quiz-placeholder

Similar activities

Overall programming tests

Overall programming tests

Professional Development

60 Qs

CONTOH SOAL

CONTOH SOAL

Professional Development

62 Qs

Database and Lookup Functions Vocabulary

Database and Lookup Functions Vocabulary

Professional Development

65 Qs

Brand and Sales process

Brand and Sales process

Professional Development

60 Qs

SEPTEMBER 2024 LET ACTUAL QUESTIONS (GEN ED)

SEPTEMBER 2024 LET ACTUAL QUESTIONS (GEN ED)

Professional Development

55 Qs

DIP CBT-2

DIP CBT-2

Professional Development

60 Qs

JUNOS - 105

JUNOS - 105

Professional Development

65 Qs

Surgical Problems & Procedures: General Surgery Anesthesia

Surgical Problems & Procedures: General Surgery Anesthesia

Professional Development

63 Qs

Java Programming Quiz

Java Programming Quiz

Assessment

Quiz

Other

Professional Development

Hard

Created by

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 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

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

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?