Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1.) 1.) An object is a(n) ___________________ of a class. a.) Child b.) Institut

ID: 3552833 • Letter: 1

Question

1.)     1.) An object is a(n) ___________________ of a class.

a.)    Child

b.)    Institution

c.)     Instantiation

d.)    Relative

2.)     2.) A class header or class definition can contain all of the following except _____________

a.)    An optional access modifier

b.)    The keyword class

c.)     An identifier

d.)    Initial field values

3.)     3.) Most fields in a class are created with the __________________modifier

a.)    public

b.)    protected

c.)     new

d.)    private

4.)     4.) Most methods in a class are created with the ______________ modifier

a.)    public

b.)    protected

c.)     new

d.)    private

5.)     5.) Instance methods that belong to individual objects are ____________ static methods

a.)    Always

b.)    Usually

c.)     Occasionally

d.)    Never

6.)     6.) To allocate memory for an object instantiation, you must use the ____________operator

a.)    mem

b.)    alloc

c.)     new

d.)    instant

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

a.)    public void MyClass()

b.)    public MyClassConstructor

c.)     Either of these can be the constructor header

d.)    Neither of these can be the constructor header

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

a.)    public MyClass()

b.)    public MyClass (double d)

c.)     Either of these can be the constructor header

d.)    Neither of these can be the constructor header

9.)   

9.) 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:

Console.WriteLine(The Car gets {0} miles per gallon, myCar.ComputeMpg());

Within the Car class, the Compute Mpg()) method can be_______________

a.)    public and static

b.)    public and nonstatic

c.)     private and static

d.)    private and nonstatic

10.)

10.) 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?

a.)    The property name is letterGrade

b.)    The property is read-only

c.)     The property contains a set accessor that does not allow a grade lower then C

d.)    The property does not contain a get accessor

11.) 11.) A this reference is___________

a.)    Implicitly passed to nonstatic methods

b.)    Implicitly passed to static methods

c.)     Explicitly passed to nonstatic methods

d.)    Explicitly passed to static methods

12.) 12.) When you use an instance variable within a classs nonstatic methods, you_________ explicitly refer to the methods this reference

a.)    Must

b.)    Can

c.)     Cannot

d.)    Should (even though it is not required)

13.) 13.) A classs default constructor_____________

a.)    Sets numeric fields to 0

b.)    Is parameterless

c.)     Both of these

d.)    None of these

14.) 14.) 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?

a.)    Chair(int legs)

b.)    Chair(int height, int legs)

c.)     Both of these

d.)    None of these

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

a.)    House myHouse = new House();

b.)    House myHouse = new House(3, 125000.00);

c.)     House myHouse = House(4, 200,000.00);

d.)    Two of these

16.) 16.) You explicitly call a destructor____________

a.)    When you are finished using an object

b.)    When an object goes out of scope

c.)     When a class is destroyed

d.)    You cannot explicitly call a destructor

17.) 17.) In a program that creates five object instances of a class, the constructor executes____________ time(s) and the destructor executes __________ times(s)

a.)    one; one

b.)    one; five

c.)     five; one

d.)    five; five

18.) 18.) 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 objects wood type?

a.)    Furniture.Get(woodType[199])

b.)    myChairs[199].WoodType()

c.)     myChairs.Woodtype[199]

d.)    myChairs[199].WoodType

19.) 19.) A collection of methods that can be used by any class, as long as the class provides a definition to override the collections abstract definitions, is_________

a.)    A superclass

b.)    A polymorph

c.)     A perimeter

d.)    An interface

20.) 20.) 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 _________

a.)    Include at least one numberic field within the class

b.)    Write a CompareTo() method for the class

c.)     Be careful not to override the existing IComparable.CompareTo() method

d.)    Two of these are true

Explanation / Answer

1.)  c.)     Instantiation

2.) d.)    Initial field values

3.) b.)    protected


4.) a.)     public


5.)   d.)    Never

6.)  c.)     new

7.) d.)    Neither of these can be the constructor header

8.) c.)     Either of these can be the constructor header


9.) b.)    public and nonstatic

10.) a.)     The property name is letterGrade

11.)   a.)     Implicitly passed to nonstatic methods

12.) d.)    Should (even though it is not required)

13.)c.)     Both of these

14.) b.)    Chair(int height, int legs)

15.) b.)    House myHouse = new House(3, 125000.00);


16.) d.)    You cannot explicitly call a destructor

17.)d.)    five; five

18.) d.)    myChairs[199].WoodType

19.)d.)    An interface

20.) d.)    Two of these are true

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote