Deck 9: Classes and Multiform Projects
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
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/89
Play
Full screen (f)
Deck 9: Classes and Multiform Projects
1
When a field's value is tightly dependent on other data and that field is not updated when the other data is changed, it is said that the field has become ____________.
A) archaic
B) stale
C) obsolete
D) frozen
A) archaic
B) stale
C) obsolete
D) frozen
B
2
The private field, which is known as the property's ____________, holds any data that is assigned to the property.
A) hidden value
B) shadow variable
C) backing field
D) data core
A) hidden value
B) shadow variable
C) backing field
D) data core
C
3
A(n) ____________ is a method that is automatically executed when an object is created.
A) actuator
B) loader
C) constructor
D) executable
A) actuator
B) loader
C) constructor
D) executable
C
4
Which one of the following statements calls the Jump method of the Animal class using a reference variable named fox?
A) Animal.fox.Jump();
B) Animal(fox) = Jump();
C) fox.Jump();
D) fox = new Jump();
A) Animal.fox.Jump();
B) Animal(fox) = Jump();
C) fox.Jump();
D) fox = new Jump();
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
5
The first line of a class declaration is known as the ____________.
A) object heading
B) class header
C) data title
D) class definition
A) object heading
B) class header
C) data title
D) class definition
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
6
A special set of methods, known as ____________ work in conjunction with a private field.
A) valuators
B) accessors
C) getters and setters
D) transport methods
A) valuators
B) accessors
C) getters and setters
D) transport methods
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
7
The ____________ is automatically created by the compiler, and its data type is the same as that of the property.
A) this variable
B) data parameter
C) copy variable
D) value parameter
A) this variable
B) data parameter
C) copy variable
D) value parameter
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
8
A ____________ is a special type of class member that allows an object to store and retrieve a piece of data.
A) variable
B) field
C) property
D) method
A) variable
B) field
C) property
D) method
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
9
When you pass an object that is an instance of a class as an argument, the thing that is passed into the parameter variable is a(n) ____________ to the object.
A) copy
B) reference
C) address
D) indicator
A) copy
B) reference
C) address
D) indicator
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
10
Classes are ____________ types.
A) reference
B) value
C) abstract
D) binary
A) reference
B) value
C) abstract
D) binary
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
11
A class's ____________ are the statements that define the class's fields, properties, and methods.
A) overall body
B) field definitions
C) private elements
D) member declarations
A) overall body
B) field definitions
C) private elements
D) member declarations
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
12
You create a class by writing a(n) ____________.
A) class declaration
B) object specification
C) preprocessor directive
D) code blueprint
A) class declaration
B) object specification
C) preprocessor directive
D) code blueprint
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
13
The ____________ is a method that returns the property's value.
A) Me method
B) get accessor
C) Show method
D) this.Value method
A) Me method
B) get accessor
C) Show method
D) this.Value method
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
14
Which one of the following statements declares a variable named fox that references an instance of the Animal class?
A) new Animal fox();
B) Animal fox = new Animal();
C) new Animal(fox);
D) Animal fox(new);
A) new Animal fox();
B) Animal fox = new Animal();
C) new Animal(fox);
D) Animal fox(new);
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
15
When adding a new class file to a Visual C# project, be sure that the filename ends with the ____________ extension.
A) .cls
B) .resx
C) .src
D) .cs
A) .cls
B) .resx
C) .src
D) .cs
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
16
Anytime a value is assigned to a property, the property's ____________ is executed, and the value being assigned is passed into the value parameter.
A) set accessor
B) get accessor
C) return statement
D) ToValue method
A) set accessor
B) get accessor
C) return statement
D) ToValue method
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
17
Each object that is created from a class is called a(n) ____________ of the class.
A) object
B) reference
C) instance
D) field
A) object
B) reference
C) instance
D) field
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
18
A ____________ can be read, but it cannot be modified.
A) private field
B) public field
C) read-only property
D) hidden property
A) private field
B) public field
C) read-only property
D) hidden property
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
19
By using the ____________ access modifier, a class can hide its data from code outside the class.
A) public
B) private
C) const
D) ref
A) public
B) private
C) const
D) ref
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
20
When you pass a property as an argument to a method, there is one restriction: Properties can be passed only ____________.
A) by reference
B) globally
C) by value
D) locally
A) by reference
B) globally
C) by value
D) locally
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
21
The process of matching a method call with the correct method is known as ____________.
A) pairing
B) signing
C) binding
D) matching
A) pairing
B) signing
C) binding
D) matching
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
22
When you have identified the actions that a class is responsible for doing, you have identified its ____________.
A) event handlers
B) methods
C) fields and/or properties
D) actions
A) event handlers
B) methods
C) fields and/or properties
D) actions
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
23
A method's ____________ is not part of the signature.
A) return type
B) name
C) parameter data type
D) argument kind
A) return type
B) name
C) parameter data type
D) argument kind
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
24
When you have identified the things that a class is responsible for knowing, then you have identified the class's ____________.
A) methods
B) names
C) fields and/or properties
D) objects
A) methods
B) names
C) fields and/or properties
D) objects
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
25
To add an object of a class to a List, you use the ____________ method.
A) Class
B) Add
C) Insert
D) New
A) Class
B) Add
C) Insert
D) New
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
26
Each of the ____________ in the description of the problem domain is a potential class.
A) verbs
B) articles
C) adjectives
D) nouns
A) verbs
B) articles
C) adjectives
D) nouns
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
27
If you write a class with no constructor whatsoever, the compiler provides a(n) ____________.
A) error message
B) default constructor
C) null reference variable
D) void constructor
A) error message
B) default constructor
C) null reference variable
D) void constructor
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
28
In Visual Studio, you can easily switch your view to another form by double-clicking the form's entry in the ____________ window.
A) Solution Explorer
B) Code
C) Designer
D) Data Sources
A) Solution Explorer
B) Code
C) Designer
D) Data Sources
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
29
The ____________ is the set of real-world objects, parties, and major events related to the problem.
A) virtual world
B) critical path
C) problem domain
D) project goal
A) virtual world
B) critical path
C) problem domain
D) project goal
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
30
A constructor that accepts arguments is known as a(n) ____________.
A) parameterized constructor
B) alternate constructor
C) constructor method
D) aliased constructor
A) parameterized constructor
B) alternate constructor
C) constructor method
D) aliased constructor
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
31
Consider you are developing an application for a local zoo, which one of the following nouns would not apply to the animal class?
A) lions
B) tigers
C) bears
D) zookeepers
A) lions
B) tigers
C) bears
D) zookeepers
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
32
When a method is ____________, it means that multiple methods in the same class have the same name but use different types of parameters.
A) parameterized
B) shadowed
C) aliased
D) overloaded
A) parameterized
B) shadowed
C) aliased
D) overloaded
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
33
If you wish to remove a form from a project and delete its file from the disk, first right-click on the form's entry in the Solution Explorer window, and on the pop-up menu, click ____________.
A) Erase
B) Remove
C) Delete
D) Purge
A) Erase
B) Remove
C) Delete
D) Purge
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
34
When you create an array of a class type, each element of the array is a ____________ variable.
A) reference
B) global
C) numeric
D) Boolean
A) reference
B) global
C) numeric
D) Boolean
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
35
When you create an array of a class type, each element of the array will be initialized with the value ____________ by default.
A) 0
B) null
C) false
D) void
A) 0
B) null
C) false
D) void
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
36
When working with multiple forms, you use the ____________ to change the name of the Form1.cs file to something more meaningful.
A) Standard Toolbar
B) Toolbox
C) Solution Explorer
D) Component Tray
A) Standard Toolbar
B) Toolbox
C) Solution Explorer
D) Component Tray
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
37
A(n) ____________ is a class constructor that accepts no arguments.
A) base constructor
B) parameterless constructor
C) overloaded constructor
D) standard constructor
A) base constructor
B) parameterless constructor
C) overloaded constructor
D) standard constructor
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
38
When you add additional forms to a project, you add additional ____________, which are stored in their own files.
A) classes
B) objects
C) methods
D) events
A) classes
B) objects
C) methods
D) events
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
39
The compiler uses a method's ____________ to distinguish it from other methods of the same name.
A) binding
B) return type
C) name
D) signature
A) binding
B) return type
C) name
D) signature
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
40
To add a new form to a project, first click ____________ on the Visual Studio menu bar, and then select Add Windows Form... from the PROJECT menu.
A) PROJECT
B) FILE
C) TOOLS
D) WINDOW
A) PROJECT
B) FILE
C) TOOLS
D) WINDOW
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
41
A class's constructor must always use the private access modifier.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
42
A property is a class member that behaves like a public field.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
43
If you want to show a form in modeless fashion, call its ____________.
A) this.Modeless method
B) Show method
C) ShowDialog method
D) PopUp method
A) this.Modeless method
B) Show method
C) ShowDialog method
D) PopUp method
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
44
When you create an object from a class, you use a reference variable to reference that object.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
45
The ____________ displays a form on the screen, and it gives that form the focus.
A) this.Focus method
B) ShowDialog method
C) Activate method
D) NewForm method
A) this.Focus method
B) ShowDialog method
C) Activate method
D) NewForm method
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
46
You should never store classes in their own files.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
47
If you wish to remove a form from a project but you do not want to delete its file from the disk, first right-click on the form's entry in the Solution Explorer window, and on the pop-up menu, click ____________.
A) Hide Form Only
B) Remove From Project
C) Archive Form Data
D) Exclude From Project
A) Hide Form Only
B) Remove From Project
C) Archive Form Data
D) Exclude From Project
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
48
Suppose a project has a form named SummaryForm, which one of the following statements creates an instance of the SummaryForm class?
A) SummaryForm.ShowDialog();
B) SummaryForm = this.Form();
C) new SummaryForm;
D) SummaryForm mySummaryForm = new SummaryForm();
A) SummaryForm.ShowDialog();
B) SummaryForm = this.Form();
C) new SummaryForm;
D) SummaryForm mySummaryForm = new SummaryForm();
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
49
When a class's fields are hidden from outside code, the data is vulnerable to accidental corruption.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
50
The name of a class's constructor is the same as the name of the class.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
51
A class's constructor header must specify a return type of void.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
52
The same rules for naming variables apply to naming classes.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
53
Writing each class in its own separate file makes your code more organized and helps keep your source code files to a manageable size.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
54
When a ____________ is displayed, no other form in the application can receive the focus until the form is closed.
A) static form
B) modal form
C) modeless form
D) primary form
A) static form
B) modal form
C) modeless form
D) primary form
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
55
The class header defines the class's fields, properties, and methods.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
56
Because classes are reference types, objects that instances of a class are always passed by reference.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
57
A class is not an object but a description of an object.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
58
A ____________ allows the user to switch focus to another form while it is displayed.
A) modeless form
B) subsidiary form
C) modal form
D) minimized form
A) modeless form
B) subsidiary form
C) modal form
D) minimized form
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
59
In code, you work with properties in the same way you work with variables.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
60
When a class contains a method that uses the public access modifier, the method can be called from code outside the class.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
61
You cannot overload methods by giving them different return types.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
62
When developing an object-oriented program, on of your first tasks is to identify the classes that you will need to create.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
63
If you try to pass a property to a ref or an out parameter, an error occurs.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
64
An error will occur if you to try to assign a value to a read-only property.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
65
The get accessor has an implicit parameter called value.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
66
It is important to realize that designing an object-oriented application is an iterative process.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
67
It is perfectly legal to write a class without any constructors.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
68
Once the classes have been identified in a problem description, the next task is to identify each class's responsibilities.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
69
Some programmers begin the names of backing fields with an underscore to eliminate confusion between the field name and the property name.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
70
Objects that are instances of a class cannot be stored in an array.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
71
Constructors cannot be overloaded, which means a class can have only one constructor.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
72
The set accessor is executed anytime that a property is read.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
73
Constructors cannot accept arguments in the same way as other methods.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
74
Class fields are almost always declared private in order to protect them from accidental corruption.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
75
When an accessor contains only a single statement, many programmers prefer to write the entire accessor in one line of code.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
76
When designing a class, you should take care that all data is stored in a field, especially any calculated data.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
77
All of the nouns that appear in the problem description should become classes.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
78
If you need to make a property read only, you simply do not write a get accessor for the property.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
79
When finding the classes in a problem description, sometimes a plural noun will indicate a class and a singular noun will indicate an object.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck
80
When you want to create a List object, you write the name of a class inside angled brackets, and it specifies that the List can hold only objects of that class type.
Unlock Deck
Unlock for access to all 89 flashcards in this deck.
Unlock Deck
k this deck