CIS 306 Exam 1

¡Supera tus tareas y exámenes ahora con Quizwiz!

Which of the following is NOT a key component of object oriented programming? (a) Inheritance (b) Encapsulation (c) Polymorphism (d) Parallelism

(d) Parallelism

Which of the following statements about inheritance is false? A subclass is often larger than its superclass. A superclass object is a subclass object. The class following the extends keyword in a class declaration is the direct superclass of the class being declared. Java uses interfaces to provide the benefits of multiple inheritance.

A superclass object is a subclass object.

Which of the following statements are true? A. An interface can extend more than one parent interface and can implement B. An interface can implement more than one parent interface. Both A and B Neither A nor B

A. An interface can extend more than one parent interface and can implement

What is an abstract class?

An abstract class is class which cannot be instantiated.

What is an abstract class? a. An abstract class is one without any child classes. b. An abstract class is any parent class with more than one child class. c. An abstract class is class which cannot be instantiated. d. abstract class is another name for "base class."

An abstract class is class which cannot be instantiated.

Which of these is TRUE of the relationship between objects and classes? (a) A class is an instance of an object. (b) An object is the ancestor of its subclass. (c) An object is an instance of a class (d) An object is the descendant of its superclass.

An object is an instance of a class

Which of the following is correct about automated testing? A - Automation runs test cases significantly faster than human resources. B - Test cases are executed by using automation tool so less tester are required in automation testing. C - Both of the above. D - None of the above.

C - Both of the above.

Which concept of Java is a way of converting real world objects in terms of class? A. Polymorphism B. Encapsulation C. Abstraction D. Inheritance

C. Abstraction

Which of the following should usually be private? Methods. Constructors. Instance Variables (or fields). All of the above.

Instance Variables

Which of the following is not true about constructors? (a) It initializes an object immediately upon creation (b) It is syntactically similar to a method (c) The return type of a class construction is the class type itself. (d) All of the above

It is syntactically similar to a method

Who is credited with creating the Java programming language?

James Gosling

Which of the following is not a superclass/subclass relationship? Ford/Taurus. University/Boston University. Sailboat/Toy. Country/USA.

Sailboat/Toy.

In the header of a method In the header, the method name is always followed by this: a. parentheses b. return type c. data type d. braces

a. parentheses

What is the process of defining a method in subclass having same name & type signature as a method in its superclass? a) Method overloading b) Method overriding c) Method hiding d) None of the mentioned

b) Method

Which of these keyword must be used to inherit a class? a) super b) this c) extent d) extends

d) extends

Which of these is correct way of calling a constructor having no parameters, of superclass A by subclass B? a) super(void); b) superclass.(); c) super.A(); d) super();

d) super();

When a class serves as base class for many derived classes, the situation is called: (a) polymorphism (b) hierarchical inheritance (c) hybrid inheritance (d) multipath inheritance (e) none of these

hierarchical inheritance

A default constructor has A (a) no arguments B (b) a void return type C (c) one argument but no return type D (d) has two arguments

(a) no arguments

Which one of the following is NOT true? (a) A class containing abstract methods is called an abstract class. (b) Abstract methods should be implemented in the derived class. (c) An abstract class cannot have non-abstract methods. (d) A class must be qualified as 'abstract' class, if it contains one abstract method. (e) None of the above.

(c) An abstract class cannot have non-abstract methods.

Which one of the following is NOT true? (a) A class containing abstract methods is called an abstract class. (b) Abstract methods should be implemented in the derived class. (c) An abstract class cannot have non-abstract methods. (d) A class must be qualified as 'abstract' class, if it contains one abstract method. (e) None of the above. Answer: C

(c) An abstract class cannot have non-abstract methods.

The Java compiler translates source code into (a) machine code. (b) Assembly code. (c) Byte code. (d) JVM code

(c) Byte code.

Which of the following method of Assert class checks that two primitivesare equal? A - void assertEquals(boolean expected, boolean actual) B - void assert(boolean expected, boolean actual) C - void assertCheck(boolean expected, boolean actual) D - void assertChecks(boolean expected, boolean actual)

A - void assertEquals(boolean expected, boolean actual)

What is multiplicity for an association? A. The multiplicity at the target class end of an association is the number of instances that can be associated with a single instance of source class B. The multiplicity at the target class end of an association is the number of instances that can be associated with a number instance of source class C. All of the mentioned D. None of the mentioned

A. The multiplicity at the target class end of an association is the number of instances that can be associated with a single instance of source class

Which of the following statements which instantiates an arrayList of doubles called grades? ArrayList[] grades = new ArrayList(); double<ArrayList> = new ArrayList(); ArrayList<double> = new double(); ArrayList<double> grades = new ArrayList<double>();

ArrayList<double> grades = new ArrayList<double>();

When a method's return type is a class, what is actually returned to the calling program? A. A cloned object of that class B. A reference to an object of that class C. Only the values in the object that the method accessed D. Nothing, the return type is strictly for documentation in this situation.

B. A reference to an object of that class

Which of the following statements is NOT correct? (a) We can use a new operator on String to create a "String" object. (b) We can use the new operator on int to create an "int" object. (c) Variables of type "int" can be assigned a value just after being declared. (d) Variables of type "String" can be assigned a value just after being declared.

We can use the new operator on int to create an "int" object.

Which of these keywords is used to refer to member of base class from a sub class? a) upper b) super c) this d) None of the mentioned

b) super

What is stored by a reference variable? a. A binary encoded decimal b. A memory address c. An object d. A string

b. A memory address

Values that are sent into a method are called ____________. a. variables b. arguments c. literals d. types

b. arguments

To insert an item at a specific location in an ArrayList object, you use this method. a. store b. insert c. add d. get

c. add

If method A calls method B, and method B calls method C, and method C calls method D, when method D finishes, what happens? a. control is returned to method A b. control is returned to method B c. control is returned to method C d. the program terminates

c. control is returned to method C

Class objects normally have __________ that perform useful operations on their data, but primitive variables do not. a. fields b. instances c. methods d. relationships

c. methods

Which of the following is NOT an advantage to using inheritance? a. Code that is shared between classes needs to be written only once. b. Similar classes can be made to behave consistently. c. Enhancements to a base class will automatically be applied to derived classes. d. One big superclass can be used instead of many little classes.

d. One big superclass can be used instead of many little classes.

Can an abstract parent class have non-abstract children? a. No--an abstract parent must have only abstract children. b. No--an abstract parent must have no children at all. c. Yes--all children of an abstract parent must be non-abstract. d. Yes--an abstract parent can have both abstract and non-abstract children.

d. Yes--an abstract parent can have both abstract and non-abstract children.

Which of the following access keywords provides access to children of inherited classes only?

protected

A final field should also be declared ________ if it is initialized in its declaration. private. public. protected. static

static


Conjuntos de estudio relacionados

Chapter 3 All About Motherboards

View Set

Functional Area 15: U.S. Employment Law & Regulations

View Set

Giraffes Can't Dance by Giles Andreae

View Set

CH. 6 icomp 2 vocab-- not from class

View Set

Cancer and Oncology NCLEX Quiz 1

View Set

Finc415 Chapter 6 : international parity relationships

View Set