Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A protected member of a class may be directly accessed by Select one: a. Methods of the same class b. Methods of a subclass c.

A protected member of a class may be directly accessed by Select one: a. Methods of the same class b. Methods of a subclass c. Methods in the same package d. All of these Question 2 A subclass class can directly access Select one: a. All members of the superclass class b. Only public and private members of the superclass class c. Only protected and private members of the superclass class d. Only public and protected members of the superclass class Question 3 All fields declared in an interface Select one: a. Are final and static b. Have protected access c. Must be initialized in the class implementing the interface d. Have private access Question 4 Given the following code which of the following is true?

Select one: a. ClassA must override each method in ClassB b. ClassB must override each method in ClassA c. ClassB is derived from ClassA d. ClassA is derived from ClassB Question 5 If a class contains an abstract method, Select one: a. You must create an instance of the class b. The method will have only a header, but not a body, and end with a semicolon c. The method cannot be overridden in derived classes d. All of these Question 6 If a subclass constructor does not explicitly call a superclass constructor, Select one: a. It must include the code necessary to initialize the superclass fields b. The superclass fields will be set to the default values for their data types c. Java will automatically call the superclass's default constructor immediately after the code in the subclass's constructor executes d. Java will automatically call the superclass's default constructor just before the code in the subclass's constructor executes Question 7 If a superclass does not have a default constructor, Select one: a. Then a class that inherits from it, must initialize the superclass values b. Then a class that inherits from it, must call one of the constructors that the superclass does have c. Then a class that inherits from it, does not inherit the data member fields from the superclass d. Then a class that inherits from it, must contain the default constructor for the superclass Question 8 If you do not provide an access specifier for a class member, the class member is given this access by default. Select one: a. Private b. Public c. Protected d. Package Question 9 If ClassA is derived from ClassB, then Select one: a. Public and private members of ClassB are public and private, respectively, in ClassA b. Public members in ClassB are public in ClassA, but private members in ClassB cannot be directly accessed in ClassA c. Neither public or private members in ClassB can be directly accessed in ClassA d. Private members in ClassB are changed to protected members in ClassA Question 10 In a class hierarchy Select one: a. The more general classes are toward the bottom of the tree and the more specialized are toward the top b. The more general classes are toward the top of the tree and the more specialized are toward the bottom c. The more general classes are toward the left of the tree and the more specialized are toward the right d. The more general classes are toward the right of the tree and the more specialized are toward the left Question 11 In an interface all methods have Select one: a. Private access b. Protected access c. Public access d. Packaged access Question 12 In the following statement, which is the interface?

Select one: a. ClassA b. ClassB c. ClassC d. Cannot tell Question 13 In the following statement, which is the subclass?

Select one: a. ClassA b. ClassB c. ClassC d. Cannot tell Question 14 In the following statement, which is the superclass?

Select one: a. ClassA b. ClassB c. ClassC d. Cannot tell Question 15 In UML diagrams, inheritance is shown Select one: a. With a line that has an open arrowhead at one end that points to the superclass b. With a line that has an open arrowhead at one end that points to the subclass c. With a line that has a closed arrowhead at one end that points to the superclass d. With a line that has a closed arrowhead at one end that points to the subclass Question 16 Look at the following code and determine what the call to super will do.

Select one: a. This cannot be determined form the code b. It will call the constructor of ClassA that receives an integer as an argument c. It will call the method super and pass the value 40 to it as an argument d. The method super will have to be defined before we can say what will happen Question 17 Look at the following code. The method in line ________ will override the method in line ________.

Select one: a. 4, 10 b. 5, 11 c. 10, 4 d. 11, 5 Question 18 Look at the following code. What is missing from ClassA?

Select one: a. It does not override methodA b. It does not have a constructor c. It does not overload methodA d. It is a complete class Question 19 Question text Look at the following code. Which line has an error?

Select one: a. 1 b. 2 c. 3 d. 4 Question 20 Look at the following code.

Which method will be executed as a result of the following statements?

Select one: a. Line 4 b. Line 9 c. Line 14 d. This is an error and will cause the program to crash

Question 21 Protected members are Select one: a. Not quite private b. Not quite public c. Both Not quite private and Not quite public d. Neither Not quite private nor Not quite public Question 22 What is wrong with the following code?

Select one: a. Nothing is wrong with the code b. The method super is not defined c. The call to the method super must be the first statement in the constructor d. No values may be passed to super Question 23 Which of the following statements declares Salaried as a subclass of PayType? Select one: a. public class Salaried extends PayType b. public class Salaried implements PayType c. public class Salaried derivedFrom(Paytype) d. public class PayType derives Salaried Question 24 Every class has a toString method and an equal's method inherited from the Object class. Select one: True False Question 25 If a method in a subclass has the same signature as a method in the superclass, the subclass method overloads the superclass method. Select one: True False

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Database Programming With Visual C# .NET

Authors: Ying Bai

1st Edition

0470467274, 978-0470467275

More Books

Students also viewed these Databases questions

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago