ch 10

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

1. The use of references to objects of preexisting classes as members of new objects is called . a) inheritance b) composition c) polymorphism d) None of the above.

b) composition

1. Object orientation uses classes to: a) develop algorithms b) encapsulate data and methods c) organize large amounts of data d) None of the above.

b) encapsulate data and methods

2. The term information hiding refers to: a) public methods b) hiding implementation details from clients of a class c) accessing static class members d) the process of releasing an object for garbage collection

b) hiding implementation details from clients of a class

3. A constructor that is invoked with no arguments is called a ________. a) zero-argument constructor b) parameterless constructor c) default constructor d) main constructor

b) parameterless constructor

4. A data structure can be described as a "waiting line." a) stack b) queue c) list d) None of the above.

b) queue

1. Keyword is used for constants whose values cannot be determined at compile time. a) const b) readonly c) static d) None of the above.

b) readonly

1. Failure to release resources when the program is no longer using them can cause . a) buffer overflows b) resource leaks c) exceptions d) None of the above.

b) resource leaks

2. In a method in which a parameter has the same name as an instance variable, using the this reference allows you to refer to ________. a) the parameter b) the instance variable c) varies depending on the situation d) None of the above

b) the instance variable

3. Composition is sometimes referred to as a(n) ________. a. is-a relationship b. has-a relationship c. have-a relationship d. one-to-many relationship

b. has-a relationship

2. How many parameters does the default constructor that C# creates for you have? a) 3 b) 1 c) 0 d) varies

c) 0

4. Which statement is false? a) The actual data representation used within the class is of no concern to the class's clients. b) Clients generally care about what the class does but not how the class does it. c) Clients are usually involved in a class's implementation. d) Hiding the implementation reduces the possibility that other program parts will become dependent on class-implementation details.

c) Clients are usually involved in a class's implementation.

2. Instance variables declared readonly do not or cannot: a) use the principle of least privilege b) be initialized c) be modified once the object is constructed d) cause syntax errors if used as a left-hand value

c) be modified once the object is constructed

3. Stacks are commonly referred to as data structures. a) first-in, last-out b) first-in, first-out c) last-in, first-out d) None of the above.

c) last-in, first-out

1. Object initializers (which initialize an object and its properties) use what syntax? a) new className ( property1 -> value1, ... ); b) new className ( property1 = value1, ... ); c) new className { property1 = value1, ... }; d) className { property1 = value1, ... };

c) new className { property1 = value1, ... };

2. An instance of a user-defined type is called a(n). a) class b) interface c) object d) None of the above.

c) object

2. Instance variables or methods declared with the modifier are accessible only in that class definition. a) protected b) static c) private d) None of the above.

c) private

1. The _________ of a class are also called the public services or the public interface of the class. a) public constructors b) public instance variables c) public methods d) All of the above

c) public methods

1. A constructor cannot: a) be overloaded. b) initialize variables to their defaults. c) specify return types or return values. d) have the same name as the class.

c) specify return types or return values.

1. Which of the following should usually be private? a) methods b) constructors c) variables d) All of the above

c) variables

1. displays the variables and methods for all classes in a project. a) Class View b) Object Browser c) Design View d) None of the above.

a) Class View

2. Which of the following statements is true? a) Methods and instance variables can both be either public or private. b) Information hiding is achieved by restricting access to class members via keyword public. c) The public members of a class are not directly accessible to the client of a class. d) None of the above is true.

a) Methods and instance variables can both be either public or private.

1. Which statement is false? a) The compiler always creates a default constructor for a class. b) If a class has constructors, but none of the public constructors are parameterless, and a program attempts to call a parameterless constructor to initialize an object of the class, a compilation error occurs. c) A constructor can be called with no arguments only if the class does not have any constructors or if the class has a public parameterless constructor. d) Parameterless constructors do not have any arguments.

a) The compiler always creates a default constructor for a class.

1. Which of the following describes a static variable? a) a variable with one copy shared by all class objects b) a variable whose value may not be changed c) all of the above d) None of the above.

a) a variable with one copy shared by all class objects

3. A class's ________ initializes members of that class. a) constructor b) utility method c) access modifier d) None of the above.

a) constructor

2. A can be defined in a class to perform termination housekeeping on an object before the garbage collector reclaims the object's memory. a) destructor b) property c) garbage collector d) None of the above.

a) destructor

1. An object's this reference refers to: a) the object itself b) what the programmer specified c) the entry point of the program d) None of the above.

a) the object itself

2. Which of the following is false? a) A static method or property must be used to access private static instance variables. b) A static method has no this reference. c) A static method can be accessed even when no objects of its class have been instantiated. d) A static method can call instance methods directly.

d) A static method can call instance methods directly.

1. Abstract Data Types: a) elevate the importance of data b) are only approximations or models of real-world concepts and behaviors c) capture two notions, data representation and operations d) All of the above

d) All of the above

2. Composition: a) Is a form of software reuse. b) Is using an object reference as a class member. c) Is a good design practice. d) All of the above.

d) All of the above.

2. The Object Browser _____________. a) lists all the classes in the C# library b) describes the functionality provided by a specific class c) is separated into 3 frames d) All of the above.

d) All of the above.

4. Having a this reference allows: a) A method to refer explicitly to the instance variables and other methods of the object on which the method was called. b) A method to refer implicitly to the instance variables and other methods of the object on which the method was called. c) An object to reference itself. d) All of the above.

d) All of the above.

2. Constructors: a) initialize instance variables b) when overloaded, can have identical argument lists c) when overloaded, are selected by number and types of parameters d) a and c

d) a and c

3. When should a program explicitly use the this reference? a) accessing a private variable b) accessing a public variable c) accessing a local variable d) accessing a field that is shadowed by a local variable

d) accessing a field that is shadowed by a local variable

5. Every class inherits directly or indirectly from class _________. a) Inheritor b) Base c) Super d) object

d) object


Kaugnay na mga set ng pag-aaral

Business Law - Vogel, Unit iv quiz, Vogel Business Law Test 4, TCU BLaw Vogel Final, Business Law TCU Vogel Unit IV, Business Law Midterm, business law chapter 17, Business Law Chapter 18 - Vogel TCU, Business Law Chapter 19 - Vogel TCU, Business Law...

View Set

Contract Law Exam Terms (Misrepresentation)

View Set

AP European History Enlightenment Test

View Set