Logo Passei Direto
Buscar
Material
páginas com resultados encontrados.
páginas com resultados encontrados.
left-side-bubbles-backgroundright-side-bubbles-background

Crie sua conta grátis para liberar esse material. 🤩

Já tem uma conta?

Ao continuar, você aceita os Termos de Uso e Política de Privacidade

left-side-bubbles-backgroundright-side-bubbles-background

Crie sua conta grátis para liberar esse material. 🤩

Já tem uma conta?

Ao continuar, você aceita os Termos de Uso e Política de Privacidade

left-side-bubbles-backgroundright-side-bubbles-background

Crie sua conta grátis para liberar esse material. 🤩

Já tem uma conta?

Ao continuar, você aceita os Termos de Uso e Política de Privacidade

Prévia do material em texto

which of the following are not valid lambda expressions?-none
Parameter types be inferred in Lambda expressions ?-True
Object o = () -> {System.out.println( Example ); }; Object o can be replaced � �
with ?-runnable r
Which of the following are valid uses of lambda expressions?-run
Following lambda expression is valid (x, y) -> return x + y-false
Lambda Expressions in Java allow us to treat-code as data
Lambda Expressions are based on-functional programming
public interface Adder { String add(Function<String, String> f); 
void add(Consumer<Integer> f); } public class AdderImpl implements Adder 
{ @Override public String add(Function<String, String> f)
 { return f.apply("Welcome "); } @Override 
public void add(Consumer<Integer> f) {} } On calling add() method as 
described below, String r = adderImpl.add(a -> a + " lambda"); 
System.out.println(r); -runtime error
Which of the following is correct about Java 8 lambda expression?-both
public class App{ public static void main(String [] args){ String 
name="WelcomeJava"; 
Runnable r1=() -> System.out.println(name); String name1=""; 
name1=name.toUpperCase();
 Runnable r2=() -> System.out.println(name1); r1.run(); } } What is the o/p of 
the above program?-compilation error
====================
Which of these interfaces are functional interfaces?
public interface Cards{ int totalCount(int a, int b); }
A functional interface acts as target types for which of the following?-all
What functional interface would you use for the following? No parameters , 
returns a value-supplier
Which of the following functional interface represents an operation that accepts
a single input argument and returns no result?-Consumer t
Below code includes a valid Functional Interface ? package 
functionalInterfaceExample;
@FunctionalInterface public interface MyFirstFunctionalInterface { public void 
firstWork(); @Override public String toString();
@Override public boolean equals(Object obj); -True
}-
A FunctionalInterface annotation (@FunctionalInterface) is necessary for making 
an interface a functional interface-True
Which of the following functional interface represents an operation that accepts
an object-valued and an int-valued argument, and returns no result?-
objintconsumer t
Which of the following functional interface represents a function that accepts 
an int-valued argument and produces a long-valued result?-int to long function
Which of the following functional interface represents an operation upon two 
long-valued operands and produces a long-valued result?-long to binary
=============
Each pipeline ends with a-terminal
Terminal operation produces another stream as its output-false
Identify intermediate and terminal operations in the code. double average = 
roster .stream() .filter(p -> p.getGender() == Person.Sex.MALE) 
.mapToInt(Person::getAge) .average() .getAsDouble();
Intermediate: filter, mapToInt Terminal: average
Stream operations in java 8 can be divided into-false
Stream operation iterations are internal over the source of elements-false
The newly introduced Streams API is available in which package of java 8-
java.util.stream
Which of these does Stream filter() operates on-predicate
This study source was downloaded by 100000804099454 from CourseHero.com on 08-25-2021 23:41:10 GMT -05:00
https://www.coursehero.com/file/46921633/Java8innardstxt/
Th
is 
stu
dy
 re
so
ur
ce
 w
as
sh
are
d v
ia 
Co
ur
se
He
ro
.co
m
https://www.coursehero.com/file/46921633/Java8innardstxt/
If you wanted to process a stream of names, extract the male names, and store 
them in a new List, What is the appropriate operation to be used?-stream.collect
=============
Type annotation used to depict non blank string value-notblank
On which of these does annotations can be used on in Java 8-all
Optional type validation can be used to substitute runtime validations.-False
========
Library used to write reactive programs in java-RxJava
We need to override which Predicate method in Java 8. Which is the right method 
call-predict(T t)
Which of these should be used to show package-level and class-level dependencies
of Class files in Java 8-jdeps
 
DateTimeFormatter dateFormat=DateTimeFormatter.ISO_DATE;
 LocalDate dateOfBirth= LocalDate.of(2015,Month.FEBRUARY,31);
 System.out.println(dateFormat.format(dateOfBirth)); - Java date time 
exception
 ZoneId zoneId=ZoneId.of("Asia/Singapore");
 ZonedDateTime.of(LocalDateTime.now(),zoneId);
 System.out.println(ZonedDateTime.getOffset());
Assume that the offset value for Asia/Singapore time zone from UTC/Greenwich is 
+08:00. Choose the correct option.-Prints +08:00
Which class can be used Instead of System.getCurrentTimeMillis() to get a date 
and time in Java 8-clock
import java.time.Clock;
public class App{
 public static void main(String [] args){
 final Clock clock=Clock.systemUTC();
 System.out.println(clock.instant());
 System.out.println(clock.millis());
 }
} - compilation error
Example of functional interfaces in Java 8-both
LocalDate date1 = LocalDate.now();
 LocalDate date2 = date1.plus(1, ChronoUnit.MONTHS);
 Period period = Period.between(date2, date1);
 System.out.println("Period: " + period);
Choose the correct output.1
Which of the following is the correct lambda expression which add two numbers 
and return their sum?-(a, b) -> a + b
Which method is used to connect the consumer to the source in reactive 
programming-subscribe()
DateTimeFormatter formatter=DateTimeFormatter.ofPattern("EEEE",Locale.US);
 System.out.println(formatter.format(LocalDateTime.now())); - Friday
Which of the following can be a valid input for jdeps dependency analyzer-all
'map' and 'filter' are-intermediate
Method used to fetch the parameter types using method parameter reflection-
getParameterizedType()
In java 8, Static methods cannot be added to a Interface-False
In Functional Reactive Programming, we pull the stream of data-false
Which methods preserve parameter names in Java bytecode (through reflection 
API)-specify -parameters during compilation
Which is new command line tool for the Nashorn JavaScript engine in java 8-jjs
This study source was downloaded by 100000804099454 from CourseHero.com on 08-25-2021 23:41:10 GMT -05:00
https://www.coursehero.com/file/46921633/Java8innardstxt/
Th
is 
stu
dy
 re
so
ur
ce
 w
as
sh
are
d v
ia 
Co
ur
se
He
ro
.co
m
https://www.coursehero.com/file/46921633/Java8innardstxt/
This study source was downloaded by 100000804099454 from CourseHero.com on 08-25-2021 23:41:10 GMT -05:00
https://www.coursehero.com/file/46921633/Java8innardstxt/
Th
is 
stu
dy
 re
so
ur
ce
 w
as
sh
are
d v
ia 
Co
ur
se
He
ro
.co
m
Powered by TCPDF (www.tcpdf.org)
https://www.coursehero.com/file/46921633/Java8innardstxt/
http://www.tcpdf.org

Mais conteúdos dessa disciplina