Search Header Logo

Lambdas e Interfaces Funcionales 2

Authored by Jose Diaz

Computers

1st Grade

Used 4+ times

Lambdas e Interfaces Funcionales 2
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

6 questions

Show all answers

1.

MULTIPLE SELECT QUESTION

3 mins • 1 pt

Which of the following expressions can be used to implement a Function<Integer, String> ?. Please select 3 options

(a)-> Integer.toHexString(a)

a -> Integer::toHexString

Integer::toHexString

i::toHexString
(Assume that i is a reference to an Integer object.)

(Integer a)-> Integer.toHexString(a)

2.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

Media Image

Please select 1 option.

Compilation error at //1

Compilation error at //2

15

-15

20

3.

MULTIPLE SELECT QUESTION

3 mins • 1 pt

Media Image

Please select 3 options.

process(fnames, t::eat);

process(fnames, t::calories);

process(fnames, TestClass::size);

process(fnames, Carnivore::calories);

process(fnames, Tiger::eat);

4.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

Which of the following interface definitions can be implemented using lambda expressions?. Please select 1 option.

interface A{

}

@FunctionalInterface

interface A{

default void m(){};

}

interface A{

void m(){};

}

interface A{

default void m1(){};

void m2();

}

@FunctionalInterface

interface A{

void m1();

void m2();

}

5.

MULTIPLE SELECT QUESTION

3 mins • 1 pt

Which of the following is/are a valid functional interface(s)?. Please select 3 options.

@FunctionalInterface
public interface FI{
   int m1();
   boolean equals(Object o);
}

@FunctionalInterface
public interface FI{
   String toString = "VALUE";
   int m1();
   String m2(String s);
}

public interface FI{
   int m1();
   String toString();
}

@FunctionalInterface
public interface FI{
   int m1();
   default int m2(){ return 10; }
   String toString();
}

@FunctionalInterface
public interface FI{
   String toString = "VALUE";
   boolean equals(Object o);
}

6.

MULTIPLE SELECT QUESTION

3 mins • 1 pt

Media Image

Please select 2 options.

int a; String b;
Doer d = (a,  b)->b.substring(0, a);

int a = 0; String b = "";
Doer d = (a,  b)->b.substring(0, a)

Doer d = (a, b)->b.substring(0, a);

Doer d = (int a, String b)->b.substring(0, a);

Doer d = a, b->b.substring(0, a);

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?