Skip to content
Home
About us
Quizzes
Practice Tests
o
o
o
o
o
o
IS5103 WEEK 4 QUIZ
Mark
August 13, 2024
IS5103
This study source was downloaded by 100000903174213 from CourseHero.com on 01-12-2026 11:43:17 GMT -06:00
https://www.coursehero.com/file/250925556/Quiz-8docx/
, 1. What is the result of the following code?
1. interface Climb {
2. boolean isTooHigh(int height, int limit);
3. }
4.
5. public class Climber {
6. public static void main(String[] args) {
7. check((h, m) -> h.append(m).isEmpty(), 5);
8. }
9. private static void check(Climb climb, int height) {
10. if (climb.isTooHigh(height, 10))
11. System.out.println(“too high”);
12. else
13. System.out.println(“ok”);
14. }
15. }
A) Compiler error on line 7
2. Which lambda can replace the MySecret class to return the same
value?
interface Secret {
String magic(double d);
}
class MySecret implements Secret {
public String magic(double d) {
return “Poof”;
}}
Each correct answer represents a complete solution. Choose all that apply.
A) 1. (e) -> “Poof”
2. (e) -> { String f = “”; return “Poof”; }
3. Which of the following are valid lambda expressions?
Each correct answer represents a complete solution. Choose all that apply.
A) 1. (final Camel c) -> {}
2. (x,y) -> new RuntimeException()
4. What is the result of running the following class?
1. import java.util.function.*;
2.
3. public class Panda {
This study source was downloaded by 100000903174213 from CourseHero.com on 01-12-2026 11:43:17 GMT -06:00
https://www.coursehero.com/file/250925556/Quiz-8docx/
Home
About us
Quizzes
Practice Tests
o
o
o
o
o
o
IS5103 WEEK 4 QUIZ
Mark
August 13, 2024
IS5103
This study source was downloaded by 100000903174213 from CourseHero.com on 01-12-2026 11:43:17 GMT -06:00
https://www.coursehero.com/file/250925556/Quiz-8docx/
, 1. What is the result of the following code?
1. interface Climb {
2. boolean isTooHigh(int height, int limit);
3. }
4.
5. public class Climber {
6. public static void main(String[] args) {
7. check((h, m) -> h.append(m).isEmpty(), 5);
8. }
9. private static void check(Climb climb, int height) {
10. if (climb.isTooHigh(height, 10))
11. System.out.println(“too high”);
12. else
13. System.out.println(“ok”);
14. }
15. }
A) Compiler error on line 7
2. Which lambda can replace the MySecret class to return the same
value?
interface Secret {
String magic(double d);
}
class MySecret implements Secret {
public String magic(double d) {
return “Poof”;
}}
Each correct answer represents a complete solution. Choose all that apply.
A) 1. (e) -> “Poof”
2. (e) -> { String f = “”; return “Poof”; }
3. Which of the following are valid lambda expressions?
Each correct answer represents a complete solution. Choose all that apply.
A) 1. (final Camel c) -> {}
2. (x,y) -> new RuntimeException()
4. What is the result of running the following class?
1. import java.util.function.*;
2.
3. public class Panda {
This study source was downloaded by 100000903174213 from CourseHero.com on 01-12-2026 11:43:17 GMT -06:00
https://www.coursehero.com/file/250925556/Quiz-8docx/