Programmin'

Ace your homework & exams now with Quizwiz!

Which of the following statements correctly instantiates a House object if the House class contains a single constructor with the declaration House(int bedrooms, double price)?

Two of these

A collection of methods that can be used by any class, as long as the class provides a definition to override the collection's abstract definitions, is ________________________.

an interface

When you use an instance variable within a class's nonstatic methods, you ________________________ explicitly refer to the method's this reference.

can

A class header or class definition can contain all of the following except ________________________.

initial field values

An object is a(n) ________________________ of a class.

instantiation

A this reference is ________________________.

implicitly passed to nonstatic methods

Assume that you have created a class named Chair with a constructor defined as Chair(int height). Which of the following overloaded constructors could coexist with the Chair constructor without ambiguity?

Chair(int height, int legs)

Assume that you have created a class named MyClass. The header of the MyClass constructor can be ________________________.

Either of these can be the constructor header.

Assume that you have created a class named MyClass. The header of the MyClass constructor can be ________________________.

Neither of these can be the constructor header.

Assume that you have created a class named TermPaper that contains a character field named letterGrade. You also have created a property for the field. Which of the following cannot be true?

The property name is letterGrade.

You explicitly call a destructor ________________________.

You cannot explicitly call a destructor.

In a program that creates five object instances of a class, the constructor executes ____________ time(s) and the destructor executes ________________________ time(s).

five; five

A class's default constructor ________________________.

is both of these

Suppose that you declare a class named Furniture that contains a string field named woodType and a conventionally named property with a get accessor. When you declare an array of 200 Furniture objects named myChairs, which of the following accesses the last Furniture object's wood type?

myChairs[199].WoodType()

Instance methods that belong to individual objects are ________________________ static methods.

never

To allocate memory for an object instantiation, you must use the ________________________ operator.

new

Most fields in a class are created with the ________________________ modifier.

private

Assume that you have created a class named DemoCar. Within the Main() method of this class, you instantiate a Car object named myCar and the following statement executes correctly:WriteLine("The Car gets {0} miles per gallon", myCar.ComputeMpg());Within the Car class, the ComputeMpg() method can be ________________________.

private and static

Most methods in a class are created with the ________________________ modifier.

public

When you create a class and want to include the capability to compare its objects so they can use the Array.Sort() or Array.BinarySearch() method, you must ________________________.

write a CompareTo() method for the class


Related study sets

4-22-22 COMBO ---- MGMT Exam 3 LS 14, MGMT 16, management 301 rfc 18

View Set

Chapter 1 Concepts Quiz: Techology in Society

View Set

955 Test Practice V-Belts And Pulleys

View Set

IB Computer Science SL (Chapter 2)

View Set

NASM Corrective exercise specialist

View Set

Drug Use and Abuse Chapter 12 Hallucinogen HIGHLIGHT Quiz

View Set

FSE-120 Mid Term Study Guide (FSE)

View Set