Deck 12: OOP: Creating Object-Oriented Programs
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
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/51
Play
Full screen (f)
Deck 12: OOP: Creating Object-Oriented Programs
1
When you add a class module to a project,any form in the same project will automatically recognize the class properties,methods,and events.
False
2
In a multitier application,the Presentation tier refers to the user interface.
True
3
Inheritance is the ability to create a new class from an existing class.
True
4
Forms are inherited from System.Windows.Forms.Form class.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
5
Declaring a variable for a class object sets up the memory location for the new object,but it does not actually create the object.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
6
A new class is created by choosing Add Module from the Project menu.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
7
A button on a form is an instance of the Button class.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
8
Microsoft recommends writing a Finalize procedure,a destructor,when an object goes out of scope.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
9
Property procedures are Public by default,so you can omit the optional Public keyword at the beginning of the Property procedure.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
10
To accomplish encapsulation,you must declare all variables in a class as Public.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
11
Objects have properties and methods.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
12
The middle tier,the Business tier,can be stored in a location other than where the Presentation tier is stored.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
13
The garbage collection feature releases memory and system resources used by unreferenced objects.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
14
Creating a class module defines a new class;it does not create any objects.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
15
Shared variables and instance variables are the same.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
16
The value of a property in a class module can be retrieved through the Get accessor method in the Property procedure.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
17
The acronym OOP stands for Object-Oriented Procedures.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
18
The Set accessor method in a Property procedure retrieves the value of a property from a class.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
19
Properties are actions that can be performed by a class of objects.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
20
When you have finished defining a class,you may then create as many instances of the class as you need using the New keyword.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
21
The _______ tier should contain the calculations that handle the data.
A)Class tier
B)Presentation tier
C)Data tier
D)Business tier
A)Class tier
B)Presentation tier
C)Data tier
D)Business tier
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
22
A _______ is a method that automatically executes when an object is instantiated.
A)constructor
B)destructor
C)overloaded method
D)derived class
A)constructor
B)destructor
C)overloaded method
D)derived class
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
23
Which of the following statements about class modules is NOT true?
A)Class modules only contain a code window.
B)Class modules can contain a code window and a form window.
C)Class modules contain Property procedures that have Get and/or Set accessor methods.
D)Class modules must be instantiated in order to be available to a project.
A)Class modules only contain a code window.
B)Class modules can contain a code window and a form window.
C)Class modules contain Property procedures that have Get and/or Set accessor methods.
D)Class modules must be instantiated in order to be available to a project.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
24
Which of the following is NOT true?
A)A constructor can be written without any arguments.
B)A constructor can contain multiple arguments.
C)Writing a constructor for a class module is not required.
D)Constructors begin with the code,"Public Sub Constructor()".
A)A constructor can be written without any arguments.
B)A constructor can contain multiple arguments.
C)Writing a constructor for a class module is not required.
D)Constructors begin with the code,"Public Sub Constructor()".
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
25
_______ refers to the combination of characteristics of an object along with its behaviors in a single definition.
A)Reusability
B)Inheritance
C)Encapsulation
D)Polymorphism
A)Reusability
B)Inheritance
C)Encapsulation
D)Polymorphism
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
26
You can use visual inheritance by designing one form and then inheriting any other forms from the first.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
27
The Get accessor method _______.
A)retrieves the current value of a property
B)allows you to get items from a listbox
C)allows a class to set its properties
D)returns the hidden enumerator
A)retrieves the current value of a property
B)allows you to get items from a listbox
C)allows a class to set its properties
D)returns the hidden enumerator
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
28
Property procedures are _______ by default.
A)Local
B)Module-level
C)Private
D)Public
A)Local
B)Module-level
C)Private
D)Public
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
29
Get and Set accessor methods must be _______ in order to allow other modules (forms or classes)to assign and retrieve their values.
A)Functions
B)Strings
C)Public
D)Private
A)Functions
B)Strings
C)Public
D)Private
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
30
When you create a method with the same name and the same argument list as a method in the base class,the new method is said to override the base-class method.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
31
Add a class module to a project by _______.
A)selecting Add Class from the Project menu
B)right-clicking on the project name and selecting Properties
C)clicking on a Class object in the Toolbox
D)right-clicking on the user interface and selecting Add Class from the menu
A)selecting Add Class from the Project menu
B)right-clicking on the project name and selecting Properties
C)clicking on a Class object in the Toolbox
D)right-clicking on the user interface and selecting Add Class from the menu
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
32
When methods have the same name,but a different list of arguments,it is called _______.
A)overriding
B)sharing
C)overloading
D)instantiation
A)overriding
B)sharing
C)overloading
D)instantiation
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
33
A class allows its properties to be retrieved through _______.
A)a Let block
B)a Get accessor method
C)a Set accessor method
D)the New keyword
A)a Let block
B)a Get accessor method
C)a Set accessor method
D)the New keyword
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
34
A big advantage of OOP over traditional programming is _______.
A)the objects are all declared Public
B)the ability to reuse classes
C)the convenience of giving all objects in a project the same name
D)none of these
A)the objects are all declared Public
B)the ability to reuse classes
C)the convenience of giving all objects in a project the same name
D)none of these
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
35
A derived class can inherit all public and protected members and methods of the base class,but it cannot inherit constructors from the base class.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
36
The acronym OOP stands for _______.
A)Object-Ordering Programs
B)Other-Object Procedures
C)Object-Organized Projects
D)Object-Oriented Programming
A)Object-Ordering Programs
B)Other-Object Procedures
C)Object-Organized Projects
D)Object-Oriented Programming
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
37
_______ refers to data hiding.
A)Encapsulation
B)Instantiation
C)Inheritance
D)Polymorphism
A)Encapsulation
B)Instantiation
C)Inheritance
D)Polymorphism
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
38
You can create a new class based on one of the existing VB classes or from one of your own classes.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
39
In a multitier application,which tier contains the user interface?
A)The Presentation tier
B)The Business tier
C)The Data tier
D)The Class tier
A)The Presentation tier
B)The Business tier
C)The Data tier
D)The Class tier
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
40
A constructor that requires arguments is called _______.
A)a Public constructor
B)a destructor constructor
C)a Sub New constructor
D)a parameterized constructor
A)a Public constructor
B)a destructor constructor
C)a Sub New constructor
D)a parameterized constructor
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
41
Give an explanation of each of the following OOP features: Encapsulation,Inheritance,and Polymorphism.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
42
The destructor method automatically executes _______.
A)when an object goes out of scope
B)when an object is destroyed
C)when an object is created
D)Answers A and B are correct.
A)when an object goes out of scope
B)when an object is destroyed
C)when an object is created
D)Answers A and B are correct.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
43
The quickest and most reliable way to look up the names of objects,properties,methods,events,and constants for Visual Basic objects is by using the _______.
A)toolbox
B)Class module
C)Object Browser
D)enumerator
A)toolbox
B)Class module
C)Object Browser
D)enumerator
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
44
You can create forms that look similar by using _______.
A)derived methods
B)constructors
C)the Overridable keyword
D)visual inheritance
A)derived methods
B)constructors
C)the Overridable keyword
D)visual inheritance
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
45
Which of the following is NOT true?
A)A separate memory location exists for each instance of a class.
B)Shared variables are available for all objects of a class.
C)Shared members can be accessed without instantiating an object of the class.
D)Instance members can be used as counters or accumulators.
A)A separate memory location exists for each instance of a class.
B)Shared variables are available for all objects of a class.
C)Shared members can be accessed without instantiating an object of the class.
D)Instance members can be used as counters or accumulators.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
46
Write the code to create a shared member that will accumulate the total of all sales.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
47
Write the code for a parameterized constructor that assigns the values to the FirstName and LastName properties in the class.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
48
How do you create properties in a class? Write the code needed to create a property called MyName and include code for Get and Set accessor methods.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
49
When using inheritance,you can call the base class constructor with this code: _______.
A)BaseClass.Inherit()
B)Inherit.Base()
C)MyBase.New()
D)New.BaseClass()
A)BaseClass.Inherit()
B)Inherit.Base()
C)MyBase.New()
D)New.BaseClass()
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
50
Which of the following is NOT true?
A)The code,"Private TheBookSale As BookSale()" creates an object.
B)The code,"Dim TheBookSale as New BookSale()" creates an object.
C)Button is a class.
D)A button created from the toolbox and named,ExitButton,is an object.
A)The code,"Private TheBookSale As BookSale()" creates an object.
B)The code,"Dim TheBookSale as New BookSale()" creates an object.
C)Button is a class.
D)A button created from the toolbox and named,ExitButton,is an object.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
51
To override a method,you must declare the original method with the _______ keyword and declare the new method with the Overrides keyword.
A)Overridable
B)Inherits
C)Derived
D)Inheritance
A)Overridable
B)Inherits
C)Derived
D)Inheritance
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck