Java Programming Quiz

Java Programming Quiz

Professional Development

60 Qs

quiz-placeholder

Similar activities

cn java_hubt_1

cn java_hubt_1

Professional Development

56 Qs

Java Programming Quiz

Java Programming Quiz

Professional Development

60 Qs

MSTIP-CC103-Quiz3

MSTIP-CC103-Quiz3

Professional Development

60 Qs

MCQ- OIC751 TRANSDUCER ENGINEERING

MCQ- OIC751 TRANSDUCER ENGINEERING

Professional Development

61 Qs

OIC Reviewer

OIC Reviewer

Professional Development

55 Qs

OSI Model and Networking Concepts

OSI Model and Networking Concepts

Professional Development

60 Qs

CAEP Quiz

CAEP Quiz

Professional Development

57 Qs

BT - Ch-10 Indentifying and Preventing Fraud

BT - Ch-10 Indentifying and Preventing Fraud

Professional Development

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