CIS Master's set
Array.Copy(waterDepth, 2, w, 0, 5); The Copy( ) method, shown above, is a(n) ____________ method.
"static or class"
The logical operators in C# are ____. >, =, && and || != and == ==, =, and !=
&& and ||
The ____________ property for the form can be set to a specific button to allow the Enter key to be associated with that button, so that pressing the Enter key is the same as clicking the button.
AcceptButton
____ are special methods used to read the current state or value of an object member's data. Mutators Setters Constructors Accessors
Accessors
The static method that stops the application and closes all of its windows is ____.
Application.Exit( )
All arrays, of any type, inherit characteristics from the ____________ class, which includes a number of predefined methods and properties.
Array
Using the tools available from the FORMAT menu can greatly reduce your development time. All of the following are menu options EXCEPT ____.
Attach to Process
___________ marks the end of a block comment.
*/
if (value1 > value2) largestOne = value1; else if (value1 < value2) largestOne = value2; else largestOne = -(value1); Using the nested if program statements, assuming value1 is 100 and value2 is 100, what is stored in largestOne above? value1 value2 -(value1) not enough information is given
-(value1)
The first element of an array is always referenced by index ____________.
0
The most appropriate sentinel value that might be selected for month of the year is ____. 0, 1, 6, 12
0
if (amount > 1000) result = 1; else if (amount > 500) result = 2; else if (amount > 100) result = 3; else result = 4; Using the above code segment, what is stored in result when amount is equal to 12000? Using the above code segment, what is stored in result when amount is equal to 14? Using the above code segment, what is stored in result when amount is equal to 876?
1, 4, 2
if (a > 10) if (b > 10) if (c > 10) result = 1; else if (b > 100) result = 2; else result = 3; else result = 4; else result = 5; Using the above code segment, what is stored in result when a, b and c are equal to 200? What is stored in result when a is equal to zero, b and c are equal to 100?
1, 5
int loopVariable = 0; do { Console.WriteLine("Count = {0:}", ++loopVariable); }while (loopVariable < 5); What will be printed during the first iteration through the loop? 0, 1, 10, none of the above How many times will be loop body be executed? 0, 4, 5, 6 How many times will be loop body be executed if the conditional expression is changed to (loopVariable == 5)? 1, 4, 5, 6
1, 5, 1
int counter = 0; while (counter < 100) { Console.WriteLine(counter); counter++; } Looking above, if the loop body was changed from counter++; to counter += 5;, how many times would the loop body be executed? 19, 20, 99, 100 The last value printed with the above program segment is ____. 0, 1, 99, 100 The first value printed with the program segment above is ____. 0, 1, 99, 100
20, 99, 0
Avoid writing long methods. Consider refactoring when the method exceeds ____________ lines of code
25
int inner; for (int outer = 0; outer < 3; outer++) { for (inner = 1; inner < 2; inner++) Console.WriteLine("Outer: {0}\tInner: {1}", outer, inner); } The nested for statement above displays how many lines of output? 2,3,5,6
3
for (int i = 0; i < 5; i++) Console.Write(i + "\t"); Given the code snippet above, how many times will the loop body be executed? 4, 5, 6, 10 The conditional expression used with the for statement ____. a) must involve a counter b) must evaluate to false in order for the loop body to be executed c) is evaluates after the loop body is performed once d) is written following the first semicolon
5 is written following the first semicolon
for (int outer = 0; outer < 2; outer++) { for (int inner = 0; inner < 3; inner++) { Console.WriteLine("Outer: {0}\tInner: {1}", outer, inner); } } How many lines will be printed for the above nested loop? 2, 3, 5, 6
6
double answer = Math.Pow(3, 2); The result of the call to Math.Pow( ) in the above statement is to store ____ in answer: 9 3, 2 6 an error message
9
The equality operator in C# is ____. = != == .equals
==
The files created using the ____________ class are readable by the computer but, unlike the files created by the StreamWriter class, you cannot simply open and read the contents of the file using Notepad. A program is needed to interpret the file contents.
Binary Writer
Objects of streams can be wrapped with ____ objects to improve the speed and performance of file-handling operations.
BufferedStream
The most appropriate programmer-defined enumeration identifier for a card's color that has field values of Red, Blue, Yellow, Black, and Green would be ____.
CardColor
The method that converts all characters entered to and from their uppercase or lowercase equivalent is ____.
CharacterCasing
____ objects usually appear as small boxes that allow users to make a yes/no selection.
CheckBox
The default event-handler method for CheckBox objects is ____________.
CheckedChanged( )
What is the name of the default event handler method for RadioButton and CheckBox objects?
CheckedChanged( )
To ensure that the data is usable for the next application the ____________ method should be invoked before you exit the application.
Close( )
Which of the following is one of the pre-configured dialog boxes that can be added to an application?
ColorDialog
____________ objects have an added feature over a ListBox objects that they contain their own text box field as part of the object, but they allow only a single selection to be made.
ComboBox
ComboBox objects have an added feature over the ListBox controls in that ____.
ComboBox objects contain their own text box field
Objects like colorDialog, fontDialog, ToolTip and MenuStrip are added to the ____________ for the application when they are dragged and dropped onto the form.
ComponentTray
Which of the following statements would produce the output shown here? Live Life to the fullest
Console.WriteLine("Live\nLife to the \tfullest");
A method used to convert from one base type to another is ____. ChangeValue( ) Convert( ) ToDouble( ) Convert.ToDouble( )
Convert.ToDouble()
An added value of ComboBox objects is that compared to a ListBox object they ____.
save space on a form
The ____ of an identifier is the region of the program in which that identifier is usable.
scope
These categories are referred to as the basic programming constructs are simple sequence, iteration and ____________.
selection
You must tell the user what value to type to end the loop for ____. counter-controlled loops state-controlled loops sentinel-controlled loops any type of loop
sentinel-controlled loops
To define a property to change a data member of a class include a ____ clause. value set mutator get
set
To have the ListBox or ComboBox Items arranged in alphabetical order ____.
set the Sorted property to true
What does the following statement do? this.BackColor = System.Drawing.Color.Blue;
sets the form color to blue
With ____________, as soon as the value of the entire expression is known, evaluation stops.
short-circuit evaluation
All event-handler take two parameters. The first parameter, object sender, represents the source that raises the event, and the second parameter is the data for the event; thus, they normally have the same ____________.
signature
As with overloaded methods, ____________ must differ for constructors.
signatures
Array identifiers are normally defined using a(n) ____________.
singular noun
StreamWriter outputFile = new StreamWriter("someOutputFileName"); StreamReader inputFile = new StreamReader("someInputFileName"); If you browse using Windows Explorer or Computer, the physical file that already exists before the two statements from above are executed is ____.
someInputFile
To access an array element, you must specify which element is to be retrieved by placing an index inside ____________ following the array identifier
square brackets or [ ]
Instead of requiring that a dummy value be entered after all values are processed, a ____-controlled loop initializes a variable on the outside of the loop and then evaluates the variable to see when it changes values. Its value is changed inside the loop body when the loop should exit. counter sentinel state change
state
A flag-controlled loop is also called a ____. sentinel-controlled loop counter-controlled loop state-controlled loop posttest form loop
state=controlled loop
Calls to ____ methods use the class identifier instead of the object identifier as the method qualifier. value returning static private predefined
static
When a method uses a(n) ____________ modifier, the method belongs to the class itself, not to a specific object of the class and is thus called using the class name.
static
Unless a using statement is added to include the Math class, calls to members like Round( ), Max( ), and Exp( ), must be called using the class name, because they are all ____. static methods objects predefined methods private methods
static methods
PadRight( ) and PadLeft( ) methods of the ____________ class can be use to right or left align values.
string
StreamReader inFile = new StreamReader("name.txt"); while ((inValue = inFile.ReadLine()) != null) Using the above segment of code, inValue would be defined as what type of data?
string
You cannot use the ____________ statement to test for a range of values.
switch or case
When a single variable may need to be tested for five different values, the most readable solution would be a(n) ____. one-way if statement two-way if statement switch statement nested if....else statement
switch statement
C# has a set of rules, called _________, that must be followed.
syntax
The set of rules that a language such as C# has to follow are called ____ rules.
syntax
The compiler checks for ____.
syntax rule violations
Windows 10, Android, iOS, and Linux are types of _____________.
system software or operating system software
The conditional operator, also called the ____________ provides another way to express a simple if...else selection statement.
ternary operator
A conditional expression is also referred to as a(n) ____________.
test condition
Program execution halts in a C# program when ____.
the last statement in Main( ) is executed
In order to write a recursive solution ____. the simplest case should be determined you must create an infinite loop write the iterative solution first the most complicated approach must be identified
the simplest case should be determined
When you compare characters stored in char memory locations using relational operators, ____. they are compared lexicographically you receive an error message they are always considered equal you get inconsistent results
they are compared lexicographically
A good design principle to follow when developing Windows applications is ____.
to keep data entry to a minimum
You can assign a(n) ____________ to controls, such as text boxes or menu items, so that text is displayed when the cursor is rested on top of the component.
tool tip
A class named River will have a constructor named River. true or false
true
A data stream is the flow of data from a source to a receiver.
true
A restriction on using the foreach statement is that you cannot change values in the collection. The access to the elements is read-only. true or false
true
A sentinel controlled loop is also called a flag-controlled loop. true or false
true
A test plan to verify the accuracy of the application should be designed before coding the application. true or false
true
Additional controls can be bought from other vendors and added to the Toolbox. true or false
true
An example of an event that might be registered is the "Press the enter key." true or false
true
An exclamation point followed by a single equal symbol (!=) represents not equal in C#. true or false
true
An interpretation of the while statement is "while the condition is true, perform statement(s)". true or false
true
An off-by-one error is a common problem associated with counter-controlled loops where the loop body is performed one too many or one too few times. true or false
true
Arrays are reference variables. true or false
true
Arrays can be sent to methods as arguments, and methods can have arrays as their return type. true or false
true
Arrays can be used as fields or instance variables in classes; and, arrays of objects can be declared. true or false
true
As far as the compiler is concerned, you could actually type the entire program without touching the Enter key. true or false
true
Avoid using bright colors (such as reds), especially for backgrounds because they can result in user eye fatigue. true or false
true
Binary files can not be read using notepad.
true
C# offers both call by value and call by reference parameters. Call by value is the default type. true or false
true
Constructors are methods. true or false
true
Each instruction statement has a semantic meaning—a specific way in which it should be used. true or false
true
IDE stands for Integrated Development Environment true or false
true
If you use Visual Studio, most of the standard service plumbing code is added automatically for you. true or false
true
In C#, the && and || operators are also called the short-circuiting logical operators. true or false
true
In order to change the background color for the application, you could set the BackColor property of the form. true or false
true
In order to hold the screen when the program runs, programmers often add ReadKey( ) as a last statement. true or false
true
Instead of calling on the operating system with a request, as console applications do, Windows applications receive messages from the operating system that an event has occurred. true or false
true
Menus offer the advantage of requiring less real estate on the screen. true or false
true
Methods that use the static modifier are called class methods. true or false
true
No fall through is permitted in C# if the previous case label has code. true or false
true
One of the guidelines for good design is to keep an item the same as other items, unless you are trying to call attention to that item. true or false
true
One required entry for a method heading is the return type. true or false
true
One way to ensure that you have one entry and one exit from a method is to include a single return statement as the last statement in the method. true or false
true
Several third-party vendors are also marketing .NET-compliant languages. true or false
true
Since the data members of the class are defined as private, their public property counterpart must be used to assign new values to the data members. true or false
true
The Clear( ) method of the Array class sets all integer elements to zero. true or false
true
The Console class is defined in the System namespace. true or false
true
The Framework Class Library (FCL) consists of more than 2,000 classes. true or false
true
The GetAttributes( ) method of the File class returns a FileAttribute, like Archive, when it invoked.
true
The Items property can be used to set the initial values for a ListBox object. The Items editor is opened when you click the ellipsis to the right of the Collection property in the Properties window. true or false
true
The StreamReader's Peek( ) method returns the next available character but does not consume it.
true
The ToString( ) method is automatically invoked when the Write( ) or WriteLine( ) methods are called. true or false
true
The assignment operators and the conditional operator ? : are right-associative. true or false
true
The default setting for the ComboBox object's DropDownStyle property, is DropDown. Retaining this setting prohibits new text from being entered into the ComboBox. true or false
true
The delegate signature indicates what the method signatures must look like if they are to be referenced by the delegate. true or false
true
The do...while loop can be used to implement a counter-controlled, sentinel-controlled, or state-controlled loop. true or false
true
The expression, (5 > 57 % 8), evaluates to ____. true false 1 5 > 1
true
The not equal (!=), and equal (==) symbols are overloaded operators. true or false
true
The rule that every statement should end with a semicolon is an example of a syntax rule. true or false
true
The sentinel value is used as the operand in the conditional expression for an indefinite loop. true or false
true
The switch statement is considered a multiple selection structure and it also goes by the name case statement. true or false
true
The ternary operator ( ? : ) provides another way to express a simple if...else selection statement. true or false
true
The three basic programming constructs are simple sequence, selection, and iteration. true or false
true
Three of the contextual keywords associated with properties are get, set, and value. true or false
true
To declare an array, the value(s) used inside the square bracket can be a constant literal, a variable, or an expression that produces an integral value. true or false
true
To invoke File's Copy( ) method to make a copy of "source.txt", naming the new file "target.txt", you would write: File.Copy("source.txt", "target.txt"); because Copy is a static member of the File class.
true
To write a recursive solution, a base case needs to be identified. true or false
true
Unlike the sentinel-controlled loop, the variable used with a state-controlled loop differs from the variable used to store the data that is being processed. true or false
true
Use .NET predefined methods and properties whenever possible as opposed to writing new code. true or false
true
Use the Format>Align menu options to line up associated controls so controls are consistently placed in the same row or column. true or false
true
Using a single equal symbol inside a conditional expression, where a test was intended, causes a syntax error to be issued in C#. true or false
true
Using the break or continue statements with a loop violates the single entry and single exit guideline for developing a loop. true or false
true
When a method uses the params modifier, it indicates that the number of arguments to the method may vary. true or false
true
When strings are compared, the first character in the first operand is compared against the first character in the second operand. true or false
true
While in Design view, you can select controls from the Toolbox window and drag and drop them onto your form container. true or false
true
With an if statement, when you place a semicolon on the line that has the conditional expression, you create a null (empty) statement body for the true portion of the if statement. true or false
true
Without incrementing the counter used in the conditional expression with counter controlled loops, the loop would go on indefinitely. true or false
true
You can declare an array without dimensioning its size, but the size must be determined before you can access it. true or false
true
double [ ] price = new double [ ] {3, 2.2, 4.7, 6.1, 4}; Looking above, the value of price.Length is 5. true or false
true
The equality operator in C# is represented by ____________.
two equal symbols, ==
In order to provide a new definition for the ToString( ) method, ____. use the keyword override in the heading it must be defined using the new operator. there must be at least one constructor defined. both mutators and accessors must have been defined.
use the keyword override in the heading
Constructors differ from other methods in that constructors ____. are defined outside of the class always return a value are not defined by the programmer use the same identifier as the class
use the same identifier as the class
The keyword ____ can be used to define a scope for an object such that the CLR automatically disposes of, or releases, the resource when the object goes out of scope.
using
Call by ____________ is the default parameter type.
value
Calls to ____________ methods must be placed at a location in your code where the value could be accepted when the method is finished.
value-returning
Method names should be defined with meaningful names using ____. camel case singular nouns upper case characters verb phrases
verb phrases
When you place an @ in front of a string, the string becomes a(n) ____.
verbatim string
The term ____________ is often used to indicate where an identifier has meaning and can be used
visible or scope
Every method that has a return type other than ________ must have a return statement in the body.
void
____________ is used to indicate that no value is being returned from a method.
void
public static void Main( ) The return type for the method above is ____. public static void Main( )
void
Which of the following is NOT a keyword used to enable unconditional transfer of control to a different program statement? continue break goto while
while
Every member of the File class is static—meaning methods are called ____.
with the class name
The process that includes identifying an event, such as a button click as being of interest, and associating a method to be executed when the event occurs describes ____.
writing an event
When you place an if statement within another if statement, ____. a syntax error is generated curly braces are required you create a switch statement you create a nested if statement
you create a nested if statement
Which of the following statements is NOT true regarding switch statements? The expression is sometimes called the selector. Default is only executed when there is no match. Default is required. A variable cannot be used as the case label.
Default is required
The ____________ class provides static methods that aid in creating and moving through folders and subdirectories.
Directory
Parent and Root are two key properties of which class?
DirectoryInfo
If you attempt to access a file and have an invalid path listed in the constructor, a(n) ____________ exception is thrown.
DirectoryNotFoundException
What is the rule for lining up, or matching, elses? a) The first else goes with the first if. b) Else goes with the closest previous if that does not have its own else. c) The else goes with the one that is indented identically to it. d) Else matches the closest if that follows it.
Else goes with the closest previous if that does not have its own else.
One of the static methods of the File class is ____________. Prior to writing program statements that access data in a file, you should always check to make sure the file is available by invoking this method.
Exists( )
Which of the following is a static member of the Directory class?
Exists()
FileInfo and DirectoryInfo classes expose only static data members.
False
If an invalid path is listed in the constructor for the StreamWriter object, you will be prompted to reenter the file name.
False
The StreamReader class is used to create text files.
False
In order to remove a StreamWriter object named writer, which is associated with a file in the project directory called "test.dta", you would write ____.
File.Delete(writer)
Which of the following is an abstract class that cannot be instantiated?
FileDialog
The FileDialog class has a property called ____, which is used by both the OpenFileDialog and SaveFileDialog classes to set or get the name of the file using a dialog box.
FileName
Which exception is thrown when an attempt is made to access a file that does not exist?
FileNotFoundException
Which of the following class belongs to the System.IO namespace?
FileNotFoundException
Which method returns the largest whole number less than or equal to the specified number? Max( ) Ceiling( ) Floor( ) Largest( )
Floor()
The StreamWriter method(s) that clears all buffers for the current writer and causes any buffered data to be written to the underlying stream is ____.
Flush()
The ____ method of the Control class sets the input focus.
Focus( )
To cause the cursor to be positioned in a specific TextBox, invoke the ____________ method on that control.
Focus( )
The ____ property is used to determine whether a control is the one currently selected.
Focused
The top-level class used as a container to hold other controls for an application is called a ____.
Form
If you accidentally double-click on the form, you register the ____________ event.
Form1_Load( )
Which control is used for placing objects, like RadioButtons, together? This control not only offers the benefit of visual appearance, but also helps during design because you can set properties that impact all the associated objects.
GroupBox
The field of research that concentrates on the design and implementation of interactive computing systems is called ____.
Human Computer Interaction (HCI)
Which property is used with the PictureBox control to associate an actual picture to the control?
Image
In Visual Studio .NET, the feature that attempts to sense what you are going to type before you type it is called ____.
IntelliSense
In order to add values to the ListBox at run time, invoke the Add( ) method on the ____________ property.
Items
The ____________ event fires when a key is pressed while the control has focus.
KeyPress( )
A ____ control offers the advantage of multiple selections and the opportunity to add or remove items dynamically at runtime.
ListBox
____________ controls can be used to display a list of items from which the user can make single or multiple selections. A scroll bar is automatically added to the control if the total number of items exceeds the number that can be displayed.
ListBox
For both Windows applications, execution begins with the first statement in the ____________ method.
Main( )
Which of the following is NOT one of the inherited member methods of the object class? Equals( ) GetType( ) ToString( ) Main( )
Main( )
The method ______________ is the entry point for all applications. This is where the program begins execution.
Main()
Which of the following is a user-defined method? Parse( ) Write( ) Main( ) Pow( )
Main()
____________ is an overloaded method of the Math class that returns the larger of two specified numbers.
Max()
The ____ class in the System.Windows.Forms namespace enables you to add more functionality to your application by offering additional user options, such as adding layers of menus.
MenuStrip
Which TextBox property can be set to enable several lines of data to be entered by the user?
MultiLine
Given the following output statement, what would be displayed? Console.Write("Ok\\ \"I\'m sure\"");
Ok\ "I'm sure"
for (int outer = 0; outer < 2; outer++) { for (int inner = 0; inner < 3; inner++) { Console.WriteLine("Outer: {0}\tInner: {1}", outer, inner); } } During the last iteration through the nested loop, what numbers are printed? Outer: 1 Inner: 2 Outer: 2 Inner 3 Outer: 3 Inner 0 Outer: 1 Inner 0
Outer: 1 Inner: 2
In Visual Studio, the ____ window is used to view and change the design time properties and events of an object.
Properties
____ is added to hold the screen when the program runs.
Read()
The ____________ method of the StreamReader class enables you to retrieve one line of text from the file.
ReadLine( )
Which method of the Console class allows multiple characters to be input via the keyboard?
ReadLine()
Which of the following methods are not overloaded? WriteLine( ) Write( ) ReadLine( ) Abs( )
ReadLine()
Which property can be set to indicate whether text in the TextBox is read-only or not?
ReadOnly
StreamReader inFile = new StreamReader("name.txt"); while ((inValue = inFile.ReadLine()) != null) What does the above statement do?
Reads every line from an input file.
Double-clicking on the ListBox control registers which default event?
SelectedIndexChanged
SelectedItems and ____ properties can be used to retrieve items from a ListBox object.
SelectedItem
____________ loops are often used for inputting data when you do not know the exact number of values to be entered.
Sentinel-controlled
The _____________ method of the MessageBox class displays a predefined dialog box that can contain text, captions for the title bar, special buttons, and icons.
Show( ) or Show
The ____________ method associated with the predefined dialog classes, like FontDialog or ColorDialog causes the dialog box to be displayed.
ShowDialog( )
Which method is used to cause the dialog boxes to open?
ShowDialog()
Using the ____________ feature in Visual Studio, controls can be more easily aligned when they are initially added to the form.
SnapLine
After a project has been created and a new class added to your application, you can use the ____________ Window in Visual Studio to create a class diagram.
Solution Explorer
An entire array collection of data can be ordered alphabetically with a call to the Array class member method ____________.
Sort( )
Which of the following class has public constructors?
StreamReader
The ____ class has implementations for Write( ) and WriteLine( ) methods similar to the Console class methods.
StreamWriter
The ____________ class makes it easy to write data to a file because it has implementations for the Write( ) and WriteLine( ) methods.
StreamWriter
The Math class has a number of static methods located in the ____ namespace. Math System IO Arithmetic
System
NET Framework includes the ____________ namespace, which provides basic file and directory support classes. It also contains types that enable you to read and write files and data streams.
System.IO
The abstract classes of Stream, TextWriter, and TextReader are defined for dealing with files in the ____ namespace.
System.IO
Most classes, including control classes such as Label, Button, and TextBox, used with Windows application are defined in the ____________ namespace.
System.Windows.Forms
Most of the classes used to develop Windows-based applications are organized in which namespace?
System.Windows.Forms
You change the appearance of the tabs for a TabControl object using the ____ Collection Editor.
TabPage
The Form property used to set the title bar on the Windows form is ____.
Text
To retrieve data from a ListBox control as string data, use the ____ property.
Text
To retrieve multiple selections from a ListBox control, you can use all of the following properties EXCEPT ____.
Text
Which property is used to set or get the caption of the title bar for Windows applications?
Text
Probably the most commonly used control for input and output is the ____.
TextBox
Probably the most commonly used control is the ____________. It can be used to enter data or display text during run time.
TextBox
The StreamReader class extends the ____ class.
TextReader
What is a requirement of the sentinel-controlled loop shared by counter-controlled loops? a) The conditional expression must be set up prior to the loop. b) A counter must be initialized on the outside of the loop. c) A counter must be incremented inside the loop body. d) The expression must evaluate to false in order for the loop to be executed.
The conditional expression must be set up prior to the loop.
Which of the following is an advantage of a sentinel-controlled loop? The number of iterations does not have to be known. An extreme or dummy value can be entered. The loop is always performed at least one time. It could be used with the while form of the loop.
The number of iterations does not have to be known.
Which of the following statements regarding curly braces is NOT correct as they relate to their use with an if statement? a) They are required when there is more than one statement following the if or else. b) They can be added to increase readability. c) They are used to block three or more statements. d) They can be used with the true statements and omitted with the false statements.
They are used to block three or more statements.
One way to convert item objects retrieved from ListBoxes to strings for displaying is to use the Text property for retrieval. Another option is to retrieve the values as objects using the SelectedItem property and invoke the ____________ method.
ToString( )
After an application is debugged and you are ready to deploy or distribute it, you can build the most optimized solution,a Release version. To switch to the Release version, select Release from the Solution Configurations list box on the Standard Visual Studio toolbar.
True
During the first phase of software development, you should make sure you understand the problem definition. True or False
True
Streams are also used in C# to read and write data to binary files.
True
The Visual Studio IDE is an interactive environment that enables you to type the source code, compile, and execute without leaving the IDE program. True or False
True
The file, FileInfo, Directory, DirectoryInfo, classes are considered utility classes. They normally work with stream objects, allowing you to manipulate files and directory structures.
True
When you close a file, no arguments are sent to the method; however, the Close( ) method must be called with a file object such as fileObjectInFile.Close( ).
True
The ____________ method will convert a string value sent as an argument to its equivalent numeric value, but it doesn't throw an exception when the conversion fails.
TryParse()
WriteLine("Value = {0:N0}", 12345.9032); What will be displayed from the above line?
Value = 12,346
How does a Windows application differ from a console-based application?
Windows applications sit in a process loop, once executed, waiting for an event to execute.
The ToString( ) method is automatically invoked when an object reference is made in the ____. mutator method class constructor object class Write() method
Write() method
Which method, used with the StreamWriter class, can be invoked to write characters to the stream, followed by a line terminator?
WriteLine()
Which character is called the escape character in C#?
\
To create mutually exclusive options use ____.
a GroupBox object with RadioButton objects
With Windows Presentation Foundation (WPF) applications, ____.
a new XAML file, resembling an HTML file, is added to the solution
switch (phoneDigit) { case 1: num = 1; break; case 2: num = 2; break; case 3: num = 3; break; case 4: num = 4; break; default: num = 0; break; } Looking at the example above, what happens if the break is omitted? a syntax error is generated num is always assigned 0 num is never assigned a value num is assigned 1 Looking at the example above, when phoneDigit has a value of 'Q', what value is stored in num? 1 0 Q not enough information is given
a syntax error is generated, 0
____ is normally part of the analysis phase of software development. a) Making sure you understand the problem definition b) Designing a prototype of the desired output c) Coding the solution using an algorithm d) Developing an algorithm to solve the problem
a) Making sure you understand the problem definition
WriteLine("Final Grade = {0:N2}", CalculateGrade(90, 75, 83)); In the statement above, CalculateGrade(90, 75, 83) is ____. a) a method call b) a method declaration c) an identifier for the class d) a parameter for the WriteLine( ) method
a) a method call
WriteLine("Final Grade = {0:N2}", CalculateGrade(90, 75, 83)); In the statement above, the values placed inside the parentheses following CalculateGrade are ____. a) arguments to the method b) formal parameters of the method c) printed at runtime d) values being returned from the method
a) arguments to the method
The short-circuiting logical operators ____. a) enable doing as little as is needed to produce the final result b) produce a boolean result of true c) are performed before any other statements are executed d) cause the program to stop execution when the expression is evaluated
a) enable doing as little as is needed to produce the final result
The return type is physically placed ____. a) immediately preceding the name of the method b) inside the method c) as the first entry in the method heading d) immediately following the name of the method
a) immediately preceding the name of the method
To design a class that is flexible and full-featured, ____. a) include multiple constructors. b) define at least three constructors. c) define a default constructor. d) define a constructor for every possible combination of data members.
a) include multiple constructors.
The primary difference between call by reference using ref versus out is ____. a) ref requires the original argument be initialized, out doesn't b) out can only be used with integral memory types, ref can be used with any type c) ref requires the keyword ref be included in the call and heading, out doesn't d) ref is pass by reference
a) ref requires the original argument be initialized, out doesn't
Run-time errors are more difficult to find than syntax errors because ____. a) the program may compile and produce results with a run-time error b) run-time errors are violations in the rules of the language c) the program can never run if it has a run-time error d) the program will never stop if it has a run-time error
a) the program may compile and produce results with a run-time error
The compiler is responsible for ____. a) translating high-level programming language into machine-readable form b) controlling the operation of the system c) producing output from programming language such as C# d) producing UML diagrams during the design phase
a) translating high-level programming language into machine-readable form
A(n) ____________ is an underlined character in the text of an menu item or on the label of a control such as a button that enables user to click the button, without using the mouse, by pressing the Alt key in combination with the predefined character.
access key
In order to use the MessageBox.Show( ) method in your console application, you must ____. a) enclose the method call in a body of a loop b) add a reference to the System.Windows.Forms.dll. c) add a using System.MessageBox directive d) call on the method from within the WriteLine( ) or Write( ) methods
add a reference to the System.Windows.Forms.dll.
Double-clicking on the form when you are using the Form Designer brings up the Code Editor and also ____.
adds a form load method heading
A(n) ______________ is a clear, unambiguous, step-by-step process for solving a problem.
algorithm
Constructors ____. do not have to be written. can be overloaded. all of the above. do not return a value.
all of the above
When you define the class, you describe its ____ in terms of data and its behaviors, or methods, in terms of what kinds of things it can do. characteristics attributes fields all of the above
all of the above
Windows forms and controls offer a wide variety of changeable properties including ____.
all of the above
plush.PricePerSqYard = 40.99; If proper naming conventions were used in the above statement, which of the following statements is true? all of the above PricePerSqYard is a property plush is an object 40.99 is a numeric literal
all of the above
You can add a shortcut to a menu by preceding one of the characters in the menu name with a(n) ____. This places an underline under the next character typed.
ampersand (&)
If an invalid path is included with the constructor for a StreamWriter object, ____.
an IOEception exception is thrown
With a ListBox of numbers, the SelectedItem property returns ____.
an object representing the one selected.
During which phase of software development should questions be asked to clarify the problem definition?
analysis
The first step found in most software development methodologies is ____.
analysis
When should test plans be developed?
analysis and design phases
public static int Abs(int) Which of the following would be a valid call to the above method? answer = Abs(-23); answer = int Math.Abs(-23) answer = Math.Abs(-23) answer = int Abs(-23)
answer = Math.Abs(-23)
C# does not allow a fall through and requires the ____________ statement for any case that has an executable statement.
break
It is a good idea to consistently use an appropriate prefix for the user interface elements. You might prefix buttons with ____________.
btn
When a distinction is made between parameters and arguments, ____. a) actual arguments appear in the method heading b) parameters are the values used to call the method c) formal parameters appear in the method heading d) actual arguments are part of the formal parameters
c) formal parameters appear in the method heading
In order to call or invoke a nonvalue-returning method, enter the ____. a) access modifier followed by the method identifier and list of arguments b) return type followed by the method identifier and list of parameters c) method's identifier followed by list of arguments d) access modifier, return type, and method's identifier followed by list of parameters
c) method's identifier followed by list of arguments
A method that does not return any value on exit, ____. a) must be called with the void keyword b) cannot include the return keyword c) must be defined to have a void return type d) is not allowed in C#
c) must be defined to have a void return type
A quick way to identify a method is by looking for ____. a) the keyword class b) the {} combination c) parentheses d) a namespace
c) parentheses
To add full functionality to your classes, ____. a) write a default constructor b) omit writing a constructor so that the default one will be created for you c) write more than one constructor d) write at least five constructors for each class
c) write more than one constructor
An advantage of using named parameters is: ____. a) program runs more efficiently because the named parameters can be accessed b) program runs faster c) you can send in values through using the names of the parameters instead of having to worry about getting the exact order d) default values can be used
c) you can send in values through using the names of the parameters instead of having to worry about getting the exact order
When naming local variable identifiers and parameters, use ____________.
camel casing
The switch statement also goes by the name ____________.
case statement
With counter controlled loops, it is important to think through and ____________ to ensure they have been taken into consideration. You should always check the initial and final values of the loop control variable and verify that you get the expected results at the boundaries.
check endpoints
The ____________ property can be set for RadioButton controls to indicate which button is initially selected.
checked
By abstracting out the attributes (data) and the behaviors (processes on the data), you can create a(n) ____________ to serve as a template from which many objects of that type can be instantiated.
class
C# is an object-oriented language as such all the code that you write has to be placed in a(n) ____________.
class
C# is an object-oriented language. All the code for an application must be placed in a(n) ____. class file object method
class
Methods that use the static modifier are called _________ methods.
class
Using the object-oriented approach, a(n) ____ is a combined set of attributes and actions.
class
After the class diagram is created, add the names of data members or fields and methods using the_________________ section.
class details
The diagram used in object-oriented development to show the characteristics and behaviors of a class is a(n) ____.
class diagram
When you do a compile-time initialization of array elements, values are separated by ____________.
commas
The gray section below the Form object where dialog objects are placed in Visual Studio is called the ____.
component tray
if (examScore is less than 50) display message "Do better on next exam" In the statement above, the entry inside the parentheses is called the ____. conditional expression truth value selection construct statement body The result of the expression above is ____. true or false true numeric 100
conditional expression, true or false
What are objects, such as buttons, menus, and labels, that can display and respond to user interaction, called?
controls
When you know the number of times the statements must be executed, create a(n) ____________ loop.
counter-controlled
What is NOT required when a counter-controlled loop is created? a) Initializing loop control variable on the outside of the loop. b) Incrementing the loop control variable inside the loop. c) A conditional expression involving the loop control variable. d) Allowing the user to enter a value indicating the loop should stop.
d) Allowing the user to enter a value indicating the loop should stop.
Which of the following would display "Good day!" on the screen? a) WriteLine.Console("Good day!"); b) Console.WriteLine["Good day!"]; c) WriteLine.Console{"Good day!"}; d) Console.WriteLine("Good day!");
d) Console.WriteLine("Good day!");
Which of the following is NOT a true statement relating to constructors? a) To add full functionality to your classes, write multiple constructors b) Constructors are used to provide values to the object's data members. c) If you write one constructor, you lose the default one that is created automatically. d) The default constructor must be the first one written for the class.
d) The default constructor must be the first one written for the class
WriteLine( ) differs from Write( ) in that ____. a) WriteLine( ) does not automatically advance to the next line b) smaller items are printed using Write( ) c) WriteLine( ) was added in later releases of C# d) WriteLine( ) advances to the next line after it finishes displaying output
d) WriteLine( ) advances to the next line after it finishes displaying output
An IDE enables you to ____. a) type your program statements into an editor b) debug an application c) compile an application d) all of the above
d) all of the above
In order to test a class, ____. a) use the properties to assign and retrieve values. b) a different class is needed. c) invoke instance methods using the objects you construct. d) all of the above.
d) all of the above.
A(n) ____ version of software has not been fully tested and may still contain bugs or errors. a) alpha b) maintenance c) bug d) beta
d) beta
Console is a ____ and WriteLine( ) is a ____. a) method, class b) namespace, method c) class, namespace d) class, method
d) class, method
In a C# program, namespace is used to ____. a) display information on the monitor b) identify where the program begins c) add a reference to the most common classes in .NET d) group functionally related types under a single name
d) group functionally related types under a single name
The definition of the method ____. a) is the same as the heading for the method b) is the body of the method c) includes everything between the curly braces d) includes the heading and the body
d) includes the heading and the body
The Read( ) method ____. a) is a nonvalue-returning method b) returns a string c) returns a single char d) returns an int
d) returns an int
A property resembles a(n) ____, but is more closely aligned to a(n) ____. method, data field data field, method mutator, accessor object, mutator
data field, method
A(n) ____________ is considered a named collection of bytes having persistent or lasting storage.
data file
With a switch statement, if no match is made, the statements associated with ____________ are executed.
default
An instance of the delegate class is called a(n) ____.
delegate
Programmers commonly verify that their design is correct by doing a(n) _____________.
desk check
Instance methods manipulate data by ____. sending visible data in the Main( ) method. using constructors and accessors. passing information as arguments through parameters. directly accessing private data members.
directly accessing private data members.
When you use the ____________ approach to solving a problem, you break the problem into subtasks.
divide and conquer
The only posttest loop structure available in C# is _____. while for do...while foreach
do...while
The only posttest loop structure available with C# is the ____________ loop structure.
do...while or do
The _________ identifies the range of the values an input item includes.
domain
The switch statement case value can evaluate to all of the following EXCEPT ____. double int string char
double
The SelectionMode property of the ListBox object ____.
enables multiple selections to be made
Packaging data characteristics and behaviors into a class is called ____.
encapsulation
A class is normally associated with a(n) ____, which often describes a person, place, or thing and is normally a noun. entity method member data member behavior
entity
Archive is a(n) ____________ value for the Attributes property of the File class.
enumerated
A(n) ____________ is a special form of value type that supplies names for the values.
enumeration
A(n) ____ is a notification from the operating system that an action, such as the user clicking the mouse or pressing a key, has occurred.
event
Which of the following is NOT one of the basic programming constructs? simple sequence selection iteration event
event
When a button is clicked by a user, its ____________ is automatically called up.
event-handler method
if (examScore > 89) grade = 'A'; Console.WriteLine("Excellent"); Using the code snippet above, when does Excellent get displayed? whenever the score is greater than 89 when the score is less than or equal to 89 never, a syntax error is generated every time the program is run
every time the program is run
if (examScore > 89); grade = 'A'; Using the code snippet above, when does grade get assigned a value of 'A'? whenever the score is greater than 89 when the score is less than or equal to 89 never, a syntax error is generated every time the program is run The expression above is considered a(n) ____. iteration statement two-way if statement one-way if sttaement simple sequence instruction
every time the program is run, one-way if statement
A comparison to determine whether the uppercase character S is less than the uppercase character W produces false. true or false
false
A console-based application interface can include menus, buttons, pictures, and text in many different colors and sizes. true or false
false
A constructor is used to instantiate a class from an object. true or false
false
A forward slash followed by an asterisk /* marks the beginning of an in-line comment. true or false
false
A method call is the same as a method declaration. true or false
false
A private access modifier is always associated with data members, methods, and constructors of a class. true or false
false
A property looks like a method because it directly represents a storage location. true or false
false
A standard convention used by C# programmers is to use Pascal case style for class, data member identifiers, and method identifiers. true or false
false
A state-controlled loop should be designed when you know the number of times the statements must be executed. true or false
false
A structure is a special form of value type that supplies alternate names for the values of an underlying primitive type.
false
All attempts to access text files should be enclosed inside if...else blocks to check for exceptions.
false
All data types are initialized to 0 when an object is constructed. true or false
false
Array identifiers are normally defined using a plural noun. true or false
false
Associating a method in your program to an event is called delegating the event. true or false
false
Ceiling( ), Pow( ), and Floor( ) are all static members of the Console class. true or false
false
ComboBox objects save space on a form through their use of a predefined size property. true or false
false
File and Directory classes add functionality to their method members beyond that of FileInfo and DirectoryInfo classes.
false
For an array that is dimensioned with a Length of 100, valid subscripts are 0 through 100. true or false
false
Good programmers often build test plans while they are in the implementation stage. true or false
false
If a numeric variable is being changed by a consistent amount with each iteration through the loop, the while statement is the best choice of loop constructs. true or false
false
If you overwrite the ToString( ) method, you should also override the other methods of the object class. true or false
false
If you use the params parameter type, params must appear both in the formal parameter list of the method heading and in the actual argument list. true or false
false
In C#, it is tradition to name the file containing the class the same name as the class name, except the file name will have a .c# extension affixed to the end of the name. true or false
false
In order to indicate a value is constant and cannot be changed, the keyword constant is added. true or false
false
Included as part of .Visual Studio are a number of preconfigured dialog boxes Find and Replace, Spell Checker and File Save. true or false
false
Instance methods must have the static keyword in their heading. true or false
false
Iteration is a technique used where a method calls itself repeatedly until it arrives at the solution. true or false
false
Methods can be defined globally outside of a class in C#. true or false
false
Misspelling a name or forgetting to end a statement with a semicolon are examples of runtime errors. true or false
false
Multiple selections cannot be made from a ListBox control object. true or false
false
Mutators are special types of methods used to create objects. true or false
false
Probably the most commonly used control for both input and output is the button because it adds additional functionality to an application. true or false
false
Properties are added to a class to enable client applications to access public members. true or false
false
Semicolons are placed at the end of method headings. true or false
false
Since each delegate wraps a single method, there must be a one-to-one correspondence between the method and its delegate. true or false
false
String operands can be compared using the relational symbols. They are compared lexicographically using their Unicode character representation. true or false
false
The StreamReader class is most often used to retrieve single characters, one character at a time, from a file.
false
The accessibility modifier identifies what type of value is returned when the method is completed. true or false
false
The conditional expression true || false produces false. true or false
false
The definition for a method includes just the heading. The signature includes the heading and the body of the method. true or false
false
The do...while statement is a posttest loop, which means that the conditional expression is tested before any of the statements in the body of the loop are performed. true or false
false
The entries found inside the parentheses of the method heading are called the access modifiers. true or false
false
The first step in the program development process is design. true or false
false
The order of when labels, buttons and controls are placed on the form does not impact anything. true or false
false
The return keyword may not be included with a non-value returning method (void method). true or false
false
The rule for lining up, or matching, elses is that the else is matched with the first if, from top to bottom. true or false
false
The this keyword is used to indicate the current instance of the delegate. true or false
false
The while statement is the only type of loop construct that can be used to develop a sentinel-controlled loop. true or false
false
To add an icon for the application, add a PictureBox object and set the Image property to the desired .jpg image. true or false
false
To add functionality to the ListBox control object, you register the DoubleClick( ) event handler method. true or false
false
To set the background color for the ListBox control, use the Back property. true or false
false
Two equal symbol characters == are used as the assignment operator. true or false
false
Use a type prefix, such as C for class name. For example, a student class should be named CStudent. true or false
false
When a program is placed in a process loop, the program cannot be minimized, resized, or closed like other Windows applications. true or false
false
When you define a class method, you define its characteristics or fields in terms of the data. true or false
false
When you design Windows applications using Visual Studio, you must be sure to add program statements to call the Dispose( ) method to clean up or release unused resources back to the operating system. true or false
false
With Windows applications, you write methods called processors to indicate what should be done when a mouse is clicked on a button or the press of a key occurs. true or false
false
With a two-way if statement, either the true statement(s) is (are) executed or the false statement(s), or both. true or false
false
With console-based applications, you register events about which you want your program to receive notification. true or false
false
With nested loops, the outermost loop is always totally completed before the innermost loop is executed. true or false
false
With while loops, if the conditional expression evaluates to true, the body of the loop is not performed; control transfers to the statements following the loop. true or false
false
You can instantiate arrays of user-defined array objects and send in arrays as arguments to methods, but you cannot return arrays from methods. true or false
false
if (int.TryParse(inStringValue, out integerValue) == false) Console.WriteLine("Invalid input - 0 recorded for end value"); If a character such as "b" is entered by the user and stored in inStringValue, TryParse( ) returns ____________.
false
int [ ] anArray = new int[24]; For the above declaration, 25 cells are set aside for the array since the first element is referenced by index 0. true or false
false
int sum = 0; int number = 0; while (number < 10) { sum = sum + number; Console.WriteLine(sum); } The statement above prints the values of 0 through 9 on separate lines. true or false
false
public class aForm : Form With the heading above, Form is the derived class. true or false
false
s = num.Next(7); The statement above produces seven random numbers. true or false
false
The ____________ statement is a pretest form of loop which is considered a specialized form of the while statement and is usually associated with counter-controlled types of loops;
for
A large field of research in the field of computing is focused on ____________. The research concentrates on the design and implementation of interactive computing systems for human use.
human-computer interaction or HCI
A company issues $5,000.00 bonuses at the end of the year to all employees who earn less than $100,000. Salary and bonus are both defined as double data types. Which of the following selection statements would assign the correct amount to bonus? if (salary < 100000) bonus == $5000; if (salary < 100000) bonus = 5000; if (salary > 100000) bonus = 5000; if (salary > 100000) bonus = $5000;
if (salary < 100000) bonus = 5000;
If a StreamReader object named reader is instantiated and associated with a file stored in the project directory named "test.dta", which of the following statements would check to see if the "test.dta" exists?
if(File.Exists(reader))
The length or size of the array is specified using a(n) ____________ value in the form of a constant literal, a variable, or an expression that produces an integer value.
integral
When you define a class, you can use ____ to display all public members of the class (once an object is instantiated). class diagrams intellisense instance methods constructors
intellisense
The front end portion of the program that the user sees and responds to is called the ____.
interface
StreamReader inFile = new StreamReader("name.txt"); while ((inValue = inFile.ReadLine()) != null) With the above code segment, how could you programmatically avoid having a FileNotFoundException or DirectoryNotFoundException exception thrown?
invoke File.Exists( ) before the while loop
for (int i = 0; i < 10; i++) { Console.WriteLine("counter " + i); } The variable i defined in the program segment above ____. a) is out of scope when the loop terminates b) creates an error because it is changed in the update portion c) would have a value of 10 if it were printed on the outside of the loop d) can be displayed prior to the loop program statements
is out of scope when the loop terminates
The third programming construct repetition is also called ____________.
iteration or looping
One of the special properties in the Array class is ____________. It returns an int representing the total number of elements in an array.
length
When writing text files, if you add true to the constructor for the Append argument, ____.
lines are added onto the end of the file
By properly ____________ the else clauses with their corresponding if clauses, you encounter fewer logic errors that necessitate debugging.
lining up
If you write a program and, instead of multiplying two values together as intended, you divide one value by the other, you produce a(n) ____ error.
logic
In order for event handlers to be called using delegates, the delegate must ____.
maintain a list of the registered event handlers for the event
The preprocess directive #region can be added in the program to ____.
mark sections of code that can be expanded or collapsed
A(n) ____ is a collection of one or more program statements combined to perform some action.
method
A(n) ___________ is a collection of one or more statements combined to perform an action.
method
All programs consist of at least one ____________.
method
Delegate declarations resembles ____ declarations.
method
When naming a(n) ____________, use an action verb phrase.
method
Event handlers are ____.
methods
When the delegate wraps more than one method, it is called a(n) ____ delegate.
multicast
One of the advantages of a ListBox object over other types of objects used for input is ____.
multiple selections can be made
The most important and frequently used __________ is System.
namespace
The Framework Class Library (FCL) includes a number of different __________.
namespaces
Forms of the if statement include one-way, two-way, ____________, multiway, and compound.
nested
When one of the program statement included within the body of a loop is another loop, a(n) ____________ loop is created.
nested
Use the ____________ keyword to instantiate an object of an array.
new
Instance methods are ____. defined outside of the class. nonstatic methods. also called class methods. defined in the Main( ) method.
nonstatic methods
To reduce the chances that typing errors will corrupt your solutions, a good design principle to follow is ____.
not allow users enter values that can be calculated
Using the _________ approach, the focus is on determining the data characteristics and the methods or behaviors that operate on the data.
object-oriented
To program an object-oriented solution begin by determining what ____ are needed in the solution. processes objects methods data
objects
A common problem associated with counter-controlled loops is not executing the loop for the last value. This type of problem is labeled a(n) ____ error. off-by-one last-value counter controlled boundaries
off-by-one
BinaryReader and BinaryWriter classes ____.
offer streaming functionality oriented toward binary data types
Variables declared in the Main( ) method are ____. visible inside any method in the class. only visible inside Main( ). are automatically initialized to zero. must be defined as private data members.
only visible inside Main()
When you assign a default value to a parameter, it then becomes a(n) ____________ parameter.
optional
When you assign a default value to a parameter, it then becomes a(n) ____. named parameter static parameter method parameter optional parameter
optional parameter
When you assign a default value to a parameter, it then becomes a(n): _______________.
optional parameter
StreamWriter outputFile = new StreamWriter("someOutputFileName"); StreamReader inputFile = new StreamReader("someInputFileName"); The identifier that can be referenced in a WriteLine( ) method with the declaration above is ____.
outputFile
____ perform differently based on their operands. Overloaded operators Conditional expressions Boolean operators Relational operators
overloaded operators
With Windows applications, both the files, Form1.cs and Form1.Designer.cs, only include part of the definition for the class in their file. Thus, both include the keyword ____________ in their class heading definition.
partial
Class methods manipulate data by ____. passing information as arguments through parameters. sending visible data in the Main( ) method. directly accessing private data members. using constructors and accessors.
passing information as arguments through parameters.
With the while loop, the body of the loop is ____. a) always performed at least one time b) performed as long as the conditional expression evaluates to true c) must produce a boolean result d) must be enclosed in curly braces
performed as long as the conditional expression evaluates to true
In a Windows application, Application.Run(winForm); ____.
places the application in a process loop so that it recieves messages from the operating system
Data members should be defined with an access mode of ____________.
private
Normally data members are defined to have ____ access. protected private internal public
private
On a class diagram, the minus symbol shown beside the data member indicates the member is ____.
private
Placing a semicolon onto the end of the conditional one-way if statement ____. causes the expression to evaluate to false produces a syntax error causes the expression to evaluate to true produces a null empty bodied true statement
produces a null empty bodied true statement
It is important to name the button object, because once named ____.
program statements can be written to reference it.
A(n) ____________ is a mock-up of screens depicting the look of the final output.
prototype
Accessors, mutators, and other instance methods are normally defined with what type of access modifier? initial private public protected
public
Constructors should be defined with a ____ access modifier. static private protected public
public
____________ access modifier is always associated with constructors.
public
public static void Main( ) The access modifier in the heading above is the keyword ____.
public
Conditional expressions produce a(n) ____________ result.
boolean
The first line of a method is called the ____ of the method. signature definition heading declaration
heading
If you do not specify the full path for the filename, Visual Studio uses the ____________ subdirectory of the current project.
bin\Debug bin\Release
Local variables ____. must be defined as private are defined in classes are defined inside Main( ) and other methods determine the data characteristics for the class
are defined inside Main() and other methods
With the precedence rules or order of operations, ____________ operators are always listed at the bottom of the hierarchy.
assignment
The body of the constructor methods consist primarily of ____________.
assignment statements
When you define the class, you describe its ____________, or characteristics or fields, in terms of data.
attributes
After a button click event is registered, the associated method is called ____.
automatically when the button is clicked
One class predefined as part of .NET is ____. a) System b) Console c) namespace d) main
b) Console
Which of the following is true regarding methods of a class? a) You must use the keyword static. b) They are called instance methods. c) No return type is used when you define a class method. d) To call methods of the class in the class, you must prefix the method name with the class name.
b) They are called instance methods.
WriteLine("Final Grade = {0:N2}", CalculateGrade(90, 75, 83)); The {0:N2} above indicates the ____. a) first argument should display no digits to the right of the decimal b) first argument should display two digits to the right of the decimal c) the argument should be displayed with 0 digits to the left of the decimal and two digits to the right of the decimal d) the argument should be displayed with 0 digits to the right of the decimal and two digits to the left of the decimal
b) first argument should display two digits to the right of the decimal
The class heading that is generated by Visual Studio for Windows applications includes a colon (:) following the class name. The identifier following the colon is the ____.
base class
All data values placed in an array must be of the same ____________.
base type
Which of the following is an issue that you should consider and incorporate into your interfaces?
be consistent with placement of items
To "prime the read" with a loop, you place an input statement ____. inside the loop body before the loop body after the loop body as part of the loop conditional expression
before the loop body
An example for statement that has a compound initialization, compound test and compound update could be written as ____. for (int r = 0; c = 5; r 2; r++; c--) for (int r = 0; c = 5; r 2; r++; c--) for (int r = 0; c = 5; r 2; r++, c--) for (int r = 0, c = 5; r 2; r++, c--)
for (int r = 0, c = 5; r 2; r++, c--)
The ___________ loop structure, which restricts access to read-only, is used to iterate or move through a collection, such as an array.
foreach
The ____________ loop structure can be used to iterate through an array. However, it can be used for read-only access to the elements.
foreach
The loop control structure used to move through a collection (group of data items) that does not require you to increment a loop control variable or test the expression to determine when all data has been processed is the ____ statement. while for do...while foreach
foreach
Assume that an object of the DirectoryInfo is instantiated using the identifier dirListing. How could you retrieve the names of all files stored in dirListing that have a file extension of .cs?
foreach(FileInfo fil in dirListing.GetFiles("*.cs"))
Inheriting characteristics from base classes adds ____________ to your program without the burden of your having to do additional coding
functionality
Accessors are also referred to as ____. getters properties mutators classes
getters
The event-driven model used to create Windows applications ____. uses a counter-controlled form of loop uses a state-controlled form of loop uses a sentinel-controlled form of loop handles the repetition for you
handles the repetition for you
Which of the following is NOT a parameter type? out in ref params
in
Elements in an array are sometimes referred to as ____________ variables.
indexed
What object-oriented feature enables you to define subclasses that share some of the characteristics of other classes?
ineheritance
A(n) ____________ is a loop that has no provisions for termination.
infinite loop
A derived class ____ methods of another class.
inherits
The for statement is a compact method of writing the loops that can be written using while; it packages together the ____________, test, and update all on one line.
initialization
Comments that use two forward slashes are called ____.
inline
Accessor and mutators are ____________ methods
instance
An object is a(n) ________ of the class.
instance
The static keyword must not be used with ____. class methods instance methods all of the above data members
instance methods
Fields or data members are also called ____________.
instance variables
Constructors are used to ____________ a class.
instantiate
To create an array to hold the 5 numeric scores, you could write ____________.
int [ ] score = new int[5];
Values can be processed in any order. The fifth data record can be retrieved and processed before the first record is processed when ____________ access is used.
random
An option other than looping that can be used to repeat program statement is _____________. With this technique a method calls itself repeatedly until it arrives at the solution.
recursion
A method that calls itself repeatedly until it arrives at the solution is a(n) ____method. static recursive iterative instance
recursive
The ____ parameter type cannot be used unless the original argument is initialized before it is sent to the method. ref in out params
ref
Arrays are ____________ variables. The array identifier memory location does not actually contain the values, but instead stores an address indicating the location of the first element in the array.
reference
Delegates are special types of .NET classes whose instances store ____.
references to methods
How can the compound conditional expression ((average > 79 && average <= 89)) be written to eliminate the logical operator - without changing the logic? remove the && and create a nested if statement (average > 79 by replacing the && with || (79 > average
remove the && and create a nested if statement
if (aValue < largest ) result = aValue; else result = largest; What happens when aValue is equal to largest in the program segment above? result is assigned aValue result is assigned largest nothing, neither assignment statement is executed an error is reported
result is assigned largest
The ____________ type is always listed immediately preceding the name of the method.
return
Delegate signatures differ from method signatures in that the delegate also includes its ____.
return type
The ____ specifies what kind of information is returned when the body of the method is finished executing.
returnType