Kamis, 13 April 2017

SECTION 2 QUIZ alternatif


 
  1.   The instanceof operator finds subclasses when they are passed as a superclass.
True or false?  Mark for Review
(1) Points
 
 
True (*)

 
False

 
  Correct

 
  2.   The instanceof operator only works with class instances.
True or false?  Mark for Review
(1) Points
 
 
True (*)

 
False

 
  Incorrect. Refer to Section 2 Lesson 2.

 
  3.   The instanceof operator works inside an if statement.
True or false?  Mark for Review
(1) Points
 
 
True (*)

 
False

 
  Correct

 
  4.   Virtual method invocation requires that the superclass method is defined as which of the following?  Mark for Review
(1) Points
 
 
A public final method.

 
A default final method.

 
A private final method.

 
A public static method.

 
A public method. (*)

 
  Incorrect. Refer to Section 2 Lesson 2.

 
  5.   An abstract class can implement its methods.  Mark for Review
(1) Points
 
 
True (*)

 
False

 
  Correct

6.   Virtual method invocation occurs when you call a method from a superclass.
True or false?  Mark for Review
(1) Points
 
 
True

 
False (*)

 
  Correct

 
  7.   Which of the following correctly initializes an object named cell of the class Telephones whose generic type is Cellular?  Mark for Review
(1) Points
 
 
Telephones cell = new Telephones(Cellular c);

 
Telephones(Cellular) cell = new Telephones(Cellular);

 
Telephones<> cell = new Telephones<>(Cellular c);

 
Telephones cell = new Telephones(); (*)

 
None of the above.

 
  Incorrect. Refer to Section 2 Lesson 3.

 
  8.   Which one of the following can be used to declare a generic type.  Mark for Review
(1) Points
 
 


 


 


 
All of the other responses (*)

 
  Correct

 
  9.   Wildcards in generics allows us greater control on the types that can be used.  Mark for Review
(1) Points
 
 
True (*)

 
False

 
  Correct

 
  10.   Interfaces define what?  Mark for Review
(1) Points
 
 
Some methods with implementations

 
All methods with implementations

 
All method definitions without any implementations (*)

 
Variables and methods

 
Constants and all methods with implementations

 
  Incorrect. Refer to Section 2 Lesson 1.

11.   An interface can implement methods.  Mark for Review
(1) Points
 
 
True

 
False (*)

 
  Incorrect. Refer to Section 2 Lesson 1.

 
  12.   Which one of the following would allow you to define an interface for Animal.  Mark for Review
(1) Points
 
 
public interface Animal {} (*)

 
public class Animal implements Interface {}

 
public class Animal {}

 
public Animal extends Interface {}

 
  Correct

 
  13.   Which one of the following statements is true?  Mark for Review
(1) Points
 
 
A class is an intance of an object

 
A Java program can only contain one super class

 
A class is a template that defines the features of an object (*)

 
A class is a Java primitive

 
  Correct

 
  14.   The state of an object differentiates it from other objects of the same class.  Mark for Review
(1) Points
 
 
True (*)

 
False

 
  Incorrect. Refer to Section 2 Lesson 1.

 
  15.   A method with default access level can be subclassed by?  Mark for Review
(1) Points
 
 
Only a subclass in the same package.

 
A subclass in any package.

 
A static nested class.

 
An instance nested class.

 
None of the above. We cannot subclass a method in Java. (*)

 
  Correct

1.   Which of the following would initialise a generic class "Cell" using a String type?
I. Cell cell = new Cell(); .
II. Cell cell = new Cell(); .
III. Cell cell = new String;
 Mark for Review
(1) Points
 
 
I only

 
II only

 
III only

 
I and II (*)

 
II and III

 
  Incorrect. Refer to Section 2 Lesson 3.

 
  2.   < ? > is an example of a bounded generic wildcard.  Mark for Review
(1) Points
 
 
True

 
False (*)

 
  Correct

 
  3.   The local petting zoo is writing a program to be able to collect be able to group animals according to species to better keep track of what animals they have. Which of the following correctly defines a collection that may create these types of groupings for each species at the zoo?  Mark for Review
(1) Points
 
 
public class
animalCollection {…}(*) (*)

 
public class
animalCollection(AnimalType T) {…}

 
public class
animalCollection {…}

 
public class
animalCollection(animalType) {…}

 
None of the above.

 
  Incorrect. Refer to Section 2 Lesson 3.

 
  4.   Modeling classes for a business problem requires understanding of the business not Java. True or false?  Mark for Review
(1) Points
 
 
True

 
False (*)

 
  Correct

 
  5.   Which one of the following would allow you to define an interface for Animal.  Mark for Review
(1) Points
 
 
public interface Animal {} (*)

 
public Animal extends Interface {}

 
public class Animal {}

 
public class Animal implements Interface {}

 
  Correct

6.   Immutable classes can be subclassed.
True or false?  Mark for Review
(1) Points
 
 
True

 
False (*)

 
  Correct

 
  7.   Classes define and implement what?  Mark for Review
(1) Points
 
 
All method definitions without any implementations

 
All methods with implementations

 
Constants and all methods with implementations

 
Some methods with implementations

 
Variables and methods (*)

 
  Incorrect. Refer to Section 2 Lesson 1.

 
  8.   A method with public access level can be subclassed by?  Mark for Review
(1) Points
 
 
Only a subclass in the same package.

 
A subclass in any package.

 
A static nested class.

 
An instance nested class.

 
None of the above. We cannot subclass a method in Java. (*)

 
  Incorrect. Refer to Section 2 Lesson 1.

 
  9.   An interface can implement methods.  Mark for Review
(1) Points
 
 
True

 
False (*)

 
  Incorrect. Refer to Section 2 Lesson 1.

 
  10.   The instanceof operator is a boolean comparison operator. True or false?  Mark for Review
(1) Points
 
 
True (*)

 
False

 
  Incorrect. Refer to Section 2 Lesson 2.

11.   Virtual method invocation occurs when you call a superclass method for a subclass with an overriding method of the same name.
True or false?  Mark for Review
(1) Points
 
 
True (*)

 
False

 
  Incorrect. Refer to Section 2 Lesson 2.

 
  12.   Virtual method invocation requires that the superclass method is defined as which of the following?  Mark for Review
(1) Points
 
 
A public final method.

 
A public static method.

 
A default final method.

 
A public method. (*)

 
A private final method.

 
  Incorrect. Refer to Section 2 Lesson 2.

 
  13.   Which one of the following would allow you to define the abstract class Animal.  Mark for Review
(1) Points
 
 
public abstract class Animal (*)

 
public Animal

 
public abstract Animal extends class

 
public abstract Animal

 
  Incorrect. Refer to Section 2 Lesson 2.

 
  14.   Calling a subclass method by referring to a superclass works because you have access to all specialized methods through virtual method invocation.
True or false?  Mark for Review
(1) Points
 
 
True

 
False (*)

 
  Correct

 
  15.   An abstract class can be instantiated.  Mark for Review
(1) Points
 
 
True

 
False (*)

 
  Incorrect. Refer to Section 2 Lesson 2.

1.   The instanceof operator works inside an if statement.
True or false?  Mark for Review
(1) Points
 
 
True (*)

 
False

 
  Incorrect. Refer to Section 2 Lesson 2.

 
  2.   A upward cast means all instance variables of the subclass are permanently lost to the instance.
True or false?  Mark for Review
(1) Points
 
 
True

 
False (*)

 
  Correct

 
  3.   Virtual method invocation is:  Mark for Review
(1) Points
 
 
When the method of a subclass is used on a superclass reference. (*)

 
When the method of a superclass is used on a superclass reference.

 
Not part of polymorphism.

 
When the method of a subclass is used on a subclass reference.

 
  Incorrect. Refer to Section 2 Lesson 2.

 
  4.   The instanceof operator is a boolean comparison operator. True or false?  Mark for Review
(1) Points
 
 
True (*)

 
False

 
  Incorrect. Refer to Section 2 Lesson 2.

 
  5.   An abstract class can be instantiated.  Mark for Review
(1) Points
 
 
True

 
False (*)

 
  Correct

6.   Calling a subclass method by referring to a superclass works because you have access to all specialized methods through virtual method invocation.
True or false?  Mark for Review
(1) Points
 
 
True

 
False (*)

 
  Correct

 
  7.   A method with public access can be subclassed.
True or false?  Mark for Review
(1) Points
 
 
True

 
False (*)

 
  Correct

 
  8.   A method with default access can be subclassed.
True or false?  Mark for Review
(1) Points
 
 
True

 
False (*)

 
  Incorrect. Refer to Section 2 Lesson 1.

 
  9.   You can only implement one interface in a class.  Mark for Review
(1) Points
 
 
True

 
False (*)

 
  Correct

 
  10.   You have an interface called Animal.
You wish to create an instance of Animal.
Which one of the following is correct?  Mark for Review
(1) Points
 
 
Animal animal = new Animal();

 
Animal animal = null;

 
Animal animal = new Animal("Bear");

 
None of the other choices. (*)

 
  Incorrect. Refer to Section 2 Lesson 1.

11.   Immutable classes do allow instance variables to be changed by overriding methods.
True or false?  Mark for Review
(1) Points
 
 
True

 
False (*)

 
  Correct

 
  12.   Making a class immutable means.  Mark for Review
(1) Points
 
 
That it cannot be extended. (*)

 
That it is directly subclassed from the Object class

 
To create a sub class from a parent class

 
To create an instance of the class.

 
  Incorrect. Refer to Section 2 Lesson 1.

 
  13.   Which one of the following can be used to declare a generic type.  Mark for Review
(1) Points
 
 


 


 


 
All of the other responses (*)

 
  Correct

 
  14.   public static void printArray(T[] array){….
is an example of what?  Mark for Review
(1) Points
 
 
A generic instance

 
A concreate method.

 
A generic method (*)

 
A generic class

 
  Incorrect. Refer to Section 2 Lesson 3.

 
  15.   A generic class increases the risk of runtime class conversion exceptions.  Mark for Review
(1) Points
 
 
True

 
False (*)

 
  Correct


0 komentar:

Posting Komentar

luvne.com ayeey.com cicicookies.com mbepp.com kumpulanrumusnya.com.com tipscantiknya.com