1. A constructor that has no arguments is called a ________.
A) parameterless constructor
B) main constructor
C) default constructor
D) zero-argument constructor
Points Earned: 1.0/1.0
Correct Answer(s): A
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.
Points Earned: 1.0/1.0
Correct Answer(s): C
3. A class's ____ initializes members of that class.
A) constructor
B) utility method
C) access modifier
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): A
4. 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
Points Earned: 1.0/1.0
Correct Answer(s): C
5. Indexers are defined with keyword ____.
A) this
B) index
C) indexer
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): A
6. 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.
Points Earned: 1.0/1.0
Correct Answer(s): D
7. Every class inherits directly or indirectly from class _________.
A) Super
B) object
C) Base
D) Inheritor
Points Earned: 1.0/1.0
Correct Answer(s): B
8. Which statement is false?
A) Clients generally care about what the class does but not how the class does it.
B) The actual data representation used within the class is of no concern to the class's clients.
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.
Points Earned: 1.0/1.0
Correct Answer(s): C
9. 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
Points Earned: 1.0/1.0
Correct Answer(s): B
10. Which of the following should usually be private?
A) methods
B) constructors
C) variables
D) All of the above
Points Earned: 1.0/1.0
Correct Answer(s): C
11. 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.
Points Earned: 1.0/1.0
Correct Answer(s): A
12. Which of the following is a valid indexer header?
A) accessModifer returnType this [ IndexType1 name 1, …]
B) this [ IndexType1 name 1, …] accessModifer returnType
C) returnType accessModifer this [ IndexType1 name 1, …]
D) this [ IndexType1 name 1, …] returnType accessModifer
Points Earned: 1.0/1.0
Correct Answer(s): A
13. When should a program explicitly use the this reference?
A) when accessing a public variable
B) when accessing a field that is shadowed by a local variable
C) when accessing a private variable
D) when accessing a local variable
Points Earned: 1.0/1.0
Correct Answer(s): B
14. Object orientation uses classes to ____.
A) develop algorithms
B) encapsulate data and methods
C) organize large amounts of data
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): B
15. 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.
Points Earned: 1.0/1.0
Correct Answer(s): B
16. 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
Points Earned: 1.0/1.0
Correct Answer(s): D
17. 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
Points Earned: 1.0/1.0
Correct Answer(s): C
18. 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.
Points Earned: 1.0/1.0
Correct Answer(s): D
19. 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.
Points Earned: 1.0/1.0
Correct Answer(s): A
20. An instance of a user-defined type is called a(n) ____.
A) class
B) interface
C) object
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): C
21. Which of the following does not contribute to improved software reusability?
A) Licensing schemes and protection mechanisms.
B) Cataloging schemes and browsing mechanisms.
C) Descriptions of classes that allow programmers to determine whether a class fits their needs.
D) Quickly creating new class libraries without testing them thoroughly.
Points Earned: 1.0/1.0
Correct Answer(s): D
22. A common result of reusing software is ____.
A) virus infection
B) naming collisions
C) insecure programs
D) None of the above
Points Earned: 1.0/1.0
Correct Answer(s): B
23. Instance variables declared readonly do not or cannot ____.
A) be initialized
B) cause syntax errors if used as a left-hand value
C) use the principle of least privilege
D) be modified once the object is constructed
Points Earned: 1.0/1.0
Correct Answer(s): D
24. In C#, classes can only be declared with ___________ modifer(s).
A) public
B) private
C) internal
D) A and C
Points Earned: 0.0/1.0
Correct Answer(s): C
25. The term information hiding refers to:
A) public methods
B) accessing static class members
C) the process of releasing an object for garbage collection
D) hiding implementation details from clients of a class
Points Earned: 1.0/1.0
Correct Answer(s): D
26. 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
Points Earned: 1.0/1.0
Correct Answer(s): D
27. A class is made into a ____ for use in other programs.
A) dynamic link library
B) data location library
C) data loading library
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): A
28. How many parameters does the default constructor that C# creates for you have?
A) 3
B) 0
C) 1
D) varies
Points Earned: 1.0/1.0
Correct Answer(s): B
29. 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.
Points Earned: 1.0/1.0
Correct Answer(s): B
30. Which statement is false?
A) 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.
B) Parameterless constructors do not have any arguments.
C) The compiler always creates a default constructor for a class.
D) 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.
Points Earned: 1.0/1.0
Correct Answer(s): C
31. 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.
Points Earned: 1.0/1.0
Correct Answer(s): A
32. 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.
Points Earned: 1.0/1.0
Correct Answer(s): C
33. Which of the following is not true?
A) A static method can be accessed even when no objects of its class have been instantiated.
B) A static method or property must be used to access private static instance variables.
C) A static method can call instance methods directly.
D) A static method has no this reference.
Points Earned: 1.0/1.0
Correct Answer(s): C
34. Keyword ____ is used for constants whose values cannot be determined at compile time.
A) const
B) readonly
C) static
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): B
35. Composition is sometimes referred to as a(n) ________.
A) is-a relationship
B) have-a relationship
C) has-a relationship
D) one-to-many relationship
Points Earned: 1.0/1.0
Correct Answer(s): C
36. 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.
Points Earned: 1.0/1.0
Correct Answer(s): A
37. The affect of software reuse on the development of powerful, high-quality software is sometimes known as ____ (RAD).
A) rapid application design
B) rapid application development
C) reusable application design
D) reusable applications development
Points Earned: 1.0/1.0
Correct Answer(s): B
38. If no modifier is included in the class declaration, the class defaults to _______ access.
A) readonly
B) protected
C) private
D) public
Points Earned: 1.0/1.0
Correct Answer(s): A
39. C# programmers do not focus on ____.
A) carefully testing classes they design
B) crafting new classes and reusing existing classes
C) carefully documenting classes they design
D) understanding class library implementations
Points Earned: 1.0/1.0
Correct Answer(s): D
40. A ____ data structure can be described as a "waiting line."
A) stack
B) queue
C) list
D) None of the above.
Points Earned: 1.0/1.0
Correct Answer(s): B
41. Indexers are defined as properties in a class.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
42. this is often used to distinguish between a local variable and class variable that share an identical name.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
43. Variables or methods declared with access modifier public are accessible wherever the program has a reference to an object of the class.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
44. Indexers can be overloaded like methods.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
45. Member access modifiers are used to limit how much memory is available for class members.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
46. A constructor should return either true or false to determine if the object was initialized properly.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
47. The this reference may be used to increase program clarity, even if its use is optional.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
48. The data components of a class are called instance variables.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
49. The purpose of utility methods is to support the operation of a class' other methods.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
50. Instances of a class are called class variables.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
51. An attempt by a method which is not a member of a particular class to access a private member of that class is a fatal runtime error.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
52. An object of a class that has a reference to another object of the same class may access all the private data and methods of that class.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
53. The public methods of a class present the services that a class provides.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
54. The this reference can refer implicitly to the instance variables, properties and methods of an object.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
55. Programmers should not take into consideration that their code will be modified.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
56. Indexers are capable of returning any data type, even one that is different from the type of data in the list of elements.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
57. Only certain objects have the this reference.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
58. Variables declared within class methods are called instance variables.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
59. C# invokes the appropriate constructor by matching the number, types and order of the parameters in the constructor call to those in each constructor definition.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
60. Objects have the ability to hide their implementation from other objects.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
61. A constructor may not call other methods.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
62. A program contains a copy of a static variable for each object that is instantiated.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
63. Only the first constructor for a class is defined without a return value. Subsequent constructors have the return type void.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
64. User-defined classes may be composed of other user-defined classes.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
65. Each object of a class has its own copy of all the instance variables of the class.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
66. The garbage collector looks for objects with no values.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
67. When overloading constructors, the order of arguments should be changed to prevent errors by the compiler.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
68. The compiler will create a default constructor for a class even if you already declared a constructor(s).A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
69. A static variable represents class-wide information.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
70. Classes may be composed of only one other class.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
71. Attempting to overload a constructor with another constructor that has the exact same signature (name and parameters) is a compilation error.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
72. A destructor has the same name as the class and its constructor.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
73. Composition is a form of software reuse.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
74. A constructor may not have a return value.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
75. C# is like C++ in that programmers must manage memory explicitly.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
76. A static method may access static and non-static members.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
77. The programmer cannot determine when the garbage collector will execute.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
78. Variables that are static have class scope.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
79. Every class must have at east one constructor.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
80. A class cannot have references to objects of other classes as members.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
Wednesday, June 3, 2009
Subscribe to:
Post Comments (Atom)
This comment has been removed by the author.
ReplyDelete