01. Which of the following is a valid JavaBean method signature?
a) public void getArrow()
b) public void setBow()
c) public void setRange(int range)
d) public String addTarget(String target)
02. Of the following four modifiers, choose the one that is not implicitly applied to all interface variables.
a) final
b) abstract
c) static
d) public
03. Which three are advantages of the Java exception mechanism?
a) Provides a set of standard exceptions that covers all possible errors
b) Allows the creation of new exceptions that are customized to the particular program being created
c) Improves the program structure because exceptions must be handled in the method in which they occurre
d) Improves the program structure because the programmer can choose where to handle exceptions
e) Improves the program structure because the error handling code is separated from the normal program function
04. Restricting access to only the public methods of a class is related to which one of these concepts in Java?
a) Platform independence
b) Object orientation
c) Encapsulation
d) Inheritance
05. "You have a list orders of PurchaseOrder objects, each with a date, a Customer and a state. You want filter list in various ways"
Which of the following in built functional interface you are going to use for above?
a) UnaryOperator<T>
b) Consumer<T>
c) Supplier<T>
d) Predicate<T>
06. What is the value of that Number after the execution of the following code snippet?
long thatNumber = 5 >= 5 ? 1+2 : 1*1;
if(++thatNumber < 4)
thatNumber += 1;
a) 3
b) 4
c) 5
d) The answer cannot be determined until runtime.
07. Which usage represents a valid way of compiling java source file with the name "Main"?
a) javac Main.java
b) java Main.class
c) java Main.java
d) javac Main
e) java Main
08. If a try statement has catch blocks for both Exception and IOException, then which of the following statements is correct?
a) The catch block for Exception must appear before the catch block for IOException.
b) The catch block for IOException must appear before the catch block for Exception.
c) The catch blocks for these two exception types can be declared in any order.
d) A try statement cannot be declared with these two catch block types because they are incompatible.
09. You are writing a method that is declared not to return a value. Which two are permitted in the method body?
a) omission of the return statement
b) return null;
c) return void;
d) return;
10. Which statement best describes encapsulation?
a) Encapsulation ensures that classes can be designed so that if a method has an argument MyType x, any subclass of MyType can be passed to that method.
b) Encapsulation ensures that classes can be designed so that only certain fields and methods of an object are accessible from other objects.
c) Encapsulation ensures that classes can be designed so that their methods are inheritable.
d) Encapsulation ensures that classes can be designed with some fields and methods declared as abstract.