Deck 12: Classes, Collections, and Inheritance
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/36
Play
Full screen (f)
Deck 12: Classes, Collections, and Inheritance
1
You access public members of a class object with ___________.
A) the getData method
B) the access operator
C) the dot operator
D) a public module
A) the getData method
B) the access operator
C) the dot operator
D) a public module
C
2
Which of the following statements will remove an object referred to by the object variable NewStudent?
A) NewStudent = String.Empty
B) NewStudent = Nothing
C) NewStudent.Delete
D) Remove.NewStudent
A) NewStudent = String.Empty
B) NewStudent = Nothing
C) NewStudent.Delete
D) Remove.NewStudent
B
3
Which of the following displays a message box saying "I have been created" every time a new instance of the class ShowMe is created?
A) Public Class ShowMe MessageBox.Show("I have been created")
End Class
B) Public Class ShowMe Public Sub Constructor()
MessageBox.Show("I have been created")
End Sub
End Class
C) Public Class ShowMe Public Sub Create()
MessageBox.Show("I have been created")
End Sub
End Class
D) Public Class ShowMe Public Sub New()
MessageBox.Show("I have been created")
End Sub
End Class
A) Public Class ShowMe MessageBox.Show("I have been created")
End Class
B) Public Class ShowMe Public Sub Constructor()
MessageBox.Show("I have been created")
End Sub
End Class
C) Public Class ShowMe Public Sub Create()
MessageBox.Show("I have been created")
End Sub
End Class
D) Public Class ShowMe Public Sub New()
MessageBox.Show("I have been created")
End Sub
End Class
D
4
A constructor is a method named ______found inside the class.
A) New
B) Constructor
C) Finalizer
D) the same as the class name
A) New
B) Constructor
C) Finalizer
D) the same as the class name
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
5
Which of the following displays a window that lets you browse the classes available to your project?
A) Component Browser
B) Class Browser
C) Object Browser
D) Module Browser
A) Component Browser
B) Class Browser
C) Object Browser
D) Module Browser
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
6
Client programs can query ______to get values, but they cannot modify them.
A) Read-Only properties
B) Get/Set properties
C) Private methods
D) Public properties
A) Read-Only properties
B) Get/Set properties
C) Private methods
D) Public properties
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
7
An instance of a class is also called ______________.
A) a tangible entity
B) an object
C) a method
D) a property
A) a tangible entity
B) an object
C) a method
D) a property
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
8
A function that is a member of a class is called ______.
A) a module
B) a method
C) a component
D) an element
A) a module
B) a method
C) a component
D) an element
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
9
The ______property is used to get the number of items in a collection.
A) accumulator
B) enumerator
C) index
D) count
A) accumulator
B) enumerator
C) index
D) count
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
10
The hiding of data and procedures inside a class is achieved through a process called ________.
A) data enclosing
B) encapsulation
C) modularization
D) components
A) data enclosing
B) encapsulation
C) modularization
D) components
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
11
Which of the following operators determines if two object variables reference the same object?
A) =
B) IsEqual
C) Is
D) SameAs
A) =
B) IsEqual
C) Is
D) SameAs
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
12
Class members declared with this access specifier are like private members, except they may be accessed by methods and property procedures in derived classes.
A) Private
B) Public
C) Protected
D) SubClass
A) Private
B) Public
C) Protected
D) SubClass
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
13
Which method is used to create a new item in a collection?
A) Store
B) Insert
C) Add
D) Create
A) Store
B) Insert
C) Add
D) Create
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
14
The following statements are true about user-defined collections except __________.
A) indexes for collections start at 0
B) collections can grow dynamically as items are inserted and removed
C) collections hold a variety of different objects
D) you can access the individual items in a collection using the Item property
A) indexes for collections start at 0
B) collections can grow dynamically as items are inserted and removed
C) collections hold a variety of different objects
D) you can access the individual items in a collection using the Item property
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
15
A variable declared inside a class is also known as a __________.
A) member variable
B) static variable
C) hidden variable
D) global variable
A) member variable
B) static variable
C) hidden variable
D) global variable
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
16
What happens when an object variable goes out of scope?
A) The object may be removed from memory by the garbage collector.
B) The object may be referred to using the dot operator.
C) An exception error will be generated.
D) The object becomes accessible again when the variable comes back into scope.
A) The object may be removed from memory by the garbage collector.
B) The object may be referred to using the dot operator.
C) An exception error will be generated.
D) The object becomes accessible again when the variable comes back into scope.
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
17
All of the following statements are true about the .NET garbage collection utility except __________.
A) The garbage collector is a utility program that removes objects from memory that are no longer needed.
B) As the amount of available memory decreases, the garbage collector removes unreferenced objects more often.
C) The garbage collector removes an object from memory immediately when the last reference to it has been removed.
D) The system uses an algorithm to determine when it should periodically remove unused objects.
A) The garbage collector is a utility program that removes objects from memory that are no longer needed.
B) As the amount of available memory decreases, the garbage collector removes unreferenced objects more often.
C) The garbage collector removes an object from memory immediately when the last reference to it has been removed.
D) The system uses an algorithm to determine when it should periodically remove unused objects.
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
18
The class is the portion of a class that is visible to the application programmer.
A) form
B) design
C) control
D) interface
A) form
B) design
C) control
D) interface
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
19
Object-oriented programming is a way of designing and coding applications such that interchangeable software can be used to build larger programs.
A) controls
B) structures
C) components
D) languages
A) controls
B) structures
C) components
D) languages
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
20
When creating a ToString method to return a string representation of the data stored in an object, you must __________.
A) override the ToString method, which is inherited from the built-in Object class
B) add a Protected ToString method to the class
C) do nothing as the ToString method automatically performs this for each class
D) a ToString method is a reserved word that cannot be added to a class
A) override the ToString method, which is inherited from the built-in Object class
B) add a Protected ToString method to the class
C) do nothing as the ToString method automatically performs this for each class
D) a ToString method is a reserved word that cannot be added to a class
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
21
When using the Remove method of a collection, what happens if the argument provided is a string expression?
A) The item at the index value represented by that string is removed if found in the collection.
B) The item with a key value that matches the string is removed, if the key was found in the collection.
C) A string expression may not be provided as an argument.
D) A syntax error occurs
A) The item at the index value represented by that string is removed if found in the collection.
B) The item with a key value that matches the string is removed, if the key was found in the collection.
C) A string expression may not be provided as an argument.
D) A syntax error occurs
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
22
Which of the following is the correct way to declare a public read-only property?
A) Public ReadOnly Property PropertyName() As DataType
Statements
End Property
B) Public Property ReadOnly PropertyName() As DataType
Get
Statements
End Get
End Property
C) Public ReadOnly Property PropertyName() As DataType
Get
Statements
End Get
End Property
D) ReadOnly Public Property PropertyName() As DataType
Set
Statements
End Set
End Property
A) Public ReadOnly Property PropertyName() As DataType
Statements
End Property
B) Public Property ReadOnly PropertyName() As DataType
Get
Statements
End Get
End Property
C) Public ReadOnly Property PropertyName() As DataType
Get
Statements
End Get
End Property
D) ReadOnly Public Property PropertyName() As DataType
Set
Statements
End Set
End Property
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
23
A ______is automatically called when an instance of the class is created.
A) Load method
B) constructor
C) instantiator
D) Initializer method
A) Load method
B) constructor
C) instantiator
D) Initializer method
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
24
Every class you create in Visual Basic is automatically derived from this built-in class.
A) Object
B) Base
C) Window
D) Application
A) Object
B) Base
C) Window
D) Application
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
25
______is a general model of something - it captures the general characteristics of an object.
A) A constructor
B) A collection
C) An instance
D) An abstraction
A) A constructor
B) A collection
C) An instance
D) An abstraction
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
26
Which of the following describes the primary reason that one would override a property or method?
A) the property or method in the base class was declared as Private and can't be used
B) the property or method in the base class has an error
C) the property or method in the base class is not appropriate for the derived class
D) the property or method does not exist in the base class
A) the property or method in the base class was declared as Private and can't be used
B) the property or method in the base class has an error
C) the property or method in the base class is not appropriate for the derived class
D) the property or method does not exist in the base class
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
27
A(n) ________is a class property that is defined by only a single line of code.
A) auto-implemented property
B) inline property
C) base property
D) derived property
A) auto-implemented property
B) inline property
C) base property
D) derived property
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
28
The ______access specifier permits class members to be accessed by statements both outside the class and outside the assembly.
A) Public
B) Protected
C) Private
D) Friends
A) Public
B) Protected
C) Private
D) Friends
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
29
Object oriented analysis starts with __________.
A) declaring the member variables
B) finding the classes
C) describing attributes and operations
D) defining the property procedures
A) declaring the member variables
B) finding the classes
C) describing attributes and operations
D) defining the property procedures
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
30
It's possible to access the items in a collection using __________.
A) an integer index of the item to be retrieved
B) the Item method to retrieve an item with a specific key value
C) a For Each loop
D) all of the above
A) an integer index of the item to be retrieved
B) the Item method to retrieve an item with a specific key value
C) a For Each loop
D) all of the above
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
31
The ___access specifier permits class members to be accessed only by statements inside the class.
A) Public
B) Protected
C) Private
D) Friend
A) Public
B) Protected
C) Private
D) Friend
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
32
A ______defines a special type of class member that contains Get and Set sections.
A) method
B) constructor
C) property procedure
D) member variable
A) method
B) constructor
C) property procedure
D) member variable
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
33
This key word is used to refer to properties and methods found in the base class.
A) Base
B) Me.Base
C) MyBase
D) Base.Class
A) Base
B) Me.Base
C) MyBase
D) Base.Class
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
34
You can __ a method or property procedure found in the base class by adding one with the same name to a derived class.
A) Overrule
B) Substitute
C) Inherit
D) Override
A) Overrule
B) Substitute
C) Inherit
D) Override
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
35
If there exists a class named Person and one wants to create a new class named Student based on the Person class, what code segment below shows the correct way to do so?
A) Public Class Student Inherits Person
B) Public Class Student Extends Person
C) Public Class Student Inherits From Person
D) Public Class Student :Person
A) Public Class Student Inherits Person
B) Public Class Student Extends Person
C) Public Class Student Inherits From Person
D) Public Class Student :Person
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
36
Why is important to remove objects that are no longer need in your program?
A) To prevent over writing new objects with old data
B) To prevent program crashes
C) To free up memory for other uses
D) So the same variable can be assigned to a different object
A) To prevent over writing new objects with old data
B) To prevent program crashes
C) To free up memory for other uses
D) So the same variable can be assigned to a different object
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck