Java Programming Quiz

Java Programming Quiz

Professional Development

•

60 Qs

quiz-placeholder

Similar activities

Final Exam Practice

Final Exam Practice

Professional Development

•

60 Qs

HOMEWORK: COUNTABLE & UNCOUNTABLE NOUNS; PREPOSITIONS

HOMEWORK: COUNTABLE & UNCOUNTABLE NOUNS; PREPOSITIONS

Professional Development

•

60 Qs

P&C Basics

P&C Basics

Professional Development

•

64 Qs

Working Capital CCP Exam Quiz

Working Capital CCP Exam Quiz

Professional Development

•

60 Qs

FIRST PARTIAL L6

FIRST PARTIAL L6

University - Professional Development

•

57 Qs

022 instru

022 instru

Professional Development

•

59 Qs

Calif. drivers permit test

Calif. drivers permit test

10th Grade - Professional Development

•

60 Qs

PRAXIS 5362

PRAXIS 5362

Professional Development

•

64 Qs

Java Programming Quiz

Java Programming Quiz

Assessment

Quiz

•

Other

•

Professional Development

•

Practice Problem

•

Hard

Created by

Venubabu Venubabu

Used 2+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

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

Access all questions and much more by creating a free account

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

Already have an account?