Domanda di colloquio di Chewy

Interface Inherence A Java class or inherence may inherit from ______ interface(s) Pick ONE option Zero One Zero and One Zero, One, or more than One Class Inherence Java class may inherit from _______ other class(es) Pick ONE option Zero One Zero or One Zero, One, or more than One Abstract Methods If a class contains an abstract method then that class must be _______ Pick ONE option an interface declared to be abstract implemented completely annotated with @Native Member Variable Initialization Member variables containing the keyword _____must be initialized in the class constructor and cannot be modified thereafter Pick ONE option private static final volatile Constructor Ordering The constructor of a parent class will always be invoked ______ the constructor of its child Pick ONE option before concurrently after N/A, constructor ordering is not guaranteed by the language specification Access Modifiers Default Consider the following class: package com.example public class MyClass { void method 1 () { } } Which classes are permitted to invoke method 1 ()? Pick ONE option MyClass only MyClass and all classes that extend MyClass MyClass and all classes in the package com.example MyClass and all classes in the package com.example, and all classes that extend MyClass Exception Handling: Unchecked Exceptions Which of the following statements is true about unchecked exceptions? Pick ONE option Unchecked exceptions must be declared by methods that throw them Unchecked exceptions cannot be taught Unchecked exceptions must extend either java.lang.RuntimeException or java.lang.Error Unchecked exceptions can only be thrown by the Java SDK Operators and Types What is the result of compiling and executing the following code? if ((1/2) && false) { System.out.printin(“true”); } else { System.out.printin(“false”); } Pick ONE option true is output to stdout false is output to stdout Compilation error JVM exits with java.lang.ArithmeticException at runtime Java 8: default keyword In Java 8 the default keyword may be used to …… Select answers that make the preceding statement true. Pick ONE OR MORE options Specify the default behavior in a switch statement in the event that none of the case statements results in a match Indicate that a class, method, or member variable has a default (i.e. package- private) visibility Specify the default value for a constructor or method argument Specific the default implementation of a method in an interface Lambda Scope Consider the following method: List<Integrator> modPlusOneFilter(List<Integer>input, int mod) { mod ++ return input.stream() .filter(element ->element % mod = = 0) .collect(Collectors.toList()); The code does not compile because of a problem with the lambda’s use of the mod variable. In order to access mod from within the lambda function mod must be: Pick ONE option final or effectively final static a non-primitive type auto-boxed Thread Safety The ____ keyword can be used to define a critical selection in which only one thread can execute at any given time Pick ONE option private final volatile synchronized Thread Pools ____ may be submitted to an ExecutorService Pick ONE OR MORE options Timers Runnables Callables Threads