"); document.writeln("Name: " + studentName + "
"); document.write("Score: " + numCorrect + " / " + numPossible + " (" + scorePercent + "%)"); if (numSubjective > 0) { document.write("     [" + numSubjective + " subjective "); if (numSubjective == 1) document.write("question"); else document.write("questions"); document.write(" not graded]"); } document.writeln("

"); document.writeln("
" + titleString + "

"); document.writeln(""); currentInstruction = 0; currentNarrative = 0; for (i=0; i < numQuestions; ++i) { if (currentInstruction < numInstructions) { if (instructionIndex[currentInstruction] == i) { document.writeln(""); ++currentInstruction; } } if (currentNarrative < numNarratives) { if (narrativeIndex[currentNarrative] == i) { document.writeln(""); ++currentNarrative; } } document.writeln(""); document.writeln(""); document.writeln(""); document.writeln(""); } document.writeln("

"); document.writeln(instructionText[currentInstruction]); document.writeln("
 
"); document.writeln("
"); document.writeln(narrativeText[currentNarrative]); document.writeln("
 
"); document.writeln("
" + prefixText[i] + "

" + numberText[i] + " 

" + questionText[i]); document.writeln("

"); document.writeln(""); if (listMap.charAt(i) != "1") { document.writeln(""); document.writeln(""); } document.writeln(""); document.writeln(""); if (showNotes) { document.writeln(""); document.writeln(""); } if (showRef) { document.writeln(""); document.writeln(""); } document.writeln("

RESPONSE: 

" + responseText[i] + "

ANSWER: 

" + answerText[i] + "

NOTES: 

" + notesText[i] + "

REF: 

" + refText[i] + "

"); document.writeln("
 
"); document.writeln("
"); document.writeln(""); document.writeln(""); document.write(""); document.writeln("
 
"); document.writeln("Retake Test"); document.write(""); document.writeln("Help"); document.writeln("
"); document.writeln(""); document.writeln("
Hosted by www.Geocities.ws

"); document.close(); return(false); } function GetResponse(answerIndex, answer) { var listIndex; var responseText; if (listMap.charAt(answerIndex) == "1") { listIndex = answer.selectedIndex; responseText = answer.options[listIndex].text; } else responseText = answer.value; return(responseText); } function ScoreAnswer(answerIndex, responseText) { var listIndex; var answerText; answerText = ansMap[answerIndex]; if (qtypeMap.charAt(answerIndex) == "4") return(NumericCompare(responseText, answerText)); else if (qtypeMap.charAt(answerIndex) == "5") return(MultiCompare(responseText, answerText)); else if (responseText.toUpperCase() == answerText.toUpperCase()) return(true); else return(false); } function BuildPrefixText(answerIndex, responseText, isCorrect) { var text; var listIndex; text = "
"
		if (isCorrect)
			text += ""
		else
			text += ""

		if (listMap.charAt(answerIndex) == "1") {
			if (responseText.length == 0)
				responseText = " ";
			text += " " + responseText + " ";
		}

		text += "
" return(text); } function StripSpaces(s) { var len; var i; len = s.length; for (i=len - 1; i >= 0 && s.charAt(i) == " "; --i) len = i; if (len == 0) s = ""; else if (len != s.length) s = s.substring(0, len); return(s); } function TranslateHtmlString(text) { var newText; var replaceString; var position; var length; var breakPos; var skipExtra; var i; newText = ""; position = 0; length = text.length; while (position < length) { skipExtra = 0; breakPos = -1; for (i=position; i < length && breakPos < 0; ++i) { switch(text.charAt(i)) { case '>': replaceString = ">"; breakPos = i; break; case '<': replaceString = "<"; breakPos = i; break; case '&': replaceString = "&"; breakPos = i; break; case '\r': if ((i + 1) < length && text.charAt(i + 1) == '\n') skipExtra = 1; replaceString = "
"; breakPos = i; break; case '\n': replaceString = "
"; breakPos = i; break; case ' ': if ((i + 1 < length) && text.charAt(i + 1) == ' ') { replaceString = " "; breakPos = i; } break; } } if (breakPos < 0) { newText += text.substring(position, length); position = length; } else { if (breakPos > position) newText += text.substring(position, breakPos); newText += replaceString; position = breakPos + 1 + skipExtra; } } return(newText); } function FixMCNotes(notesText, studentText) { var displayText; var searchText; var upperNotes; var charCode; var startIndex; var endIndex; displayText = ""; if (notesText.length > 0) { if (studentText.length > 0) { upperNotes = notesText.toUpperCase(); studentText = studentText.toUpperCase(); charCode = studentText.charCodeAt(0); searchText = "/" + String.fromCharCode(charCode) + "/"; startIndex = upperNotes.indexOf(searchText); if (startIndex >= 0) { startIndex += searchText.length; searchText = "/" + String.fromCharCode(charCode + 1) + "/"; endIndex = upperNotes.indexOf(searchText, startIndex); if (endIndex < startIndex) endIndex = notesText.length; displayText = notesText.substring(startIndex, endIndex); } } if (displayText.length == 0 && notesText.charAt(0) != "http://www.geocities.com/") displayText = notesText; } return(displayText); } function NumericCompare(s1, s2) { var s1Sign; var s2Sign; var tempString; var decimalCount; var decimalPos; var numToDelete; var len; var ch; var i; s1.toUpperCase(); s2.toUpperCase(); if (s1 == s2) return(true); else { s1Sign = 1; s2Sign = 1; tempString = ""; for (i=0; i < s1.length; ++i) { ch = s1.charAt(i); if (ch == "-" && tempString.length == 0) s1Sign = -1; else if ((ch >= "0" && ch <= "9") || ch == ".") tempString += ch; } s1 = tempString; decimalCount = 0; decimalPos = -1; for (i=0; i < s1.length; ++i) { if (s1.charAt(i) == '.') { ++decimalCount; if (decimalPos < 0) decimalPos = i; } } if (decimalCount == 1 && decimalPos >= 0) { len = s1.length; for (i=len - 1; i >= decimalPos; --i) { if (i == decimalPos || s1.charAt(i) == '0') len = i; else break; } if (len < s1.length) s1 = s1.substring(0, len); if (s1.length == 0) s1 = "0"; } numToDelete = 0; for (i=0; i < s1.length; ++i) { if (s1.charAt(i) == "0") ++numToDelete; else break; } if (numToDelete > 0) { if (numToDelete == s1.length) --numToDelete; if (numToDelete > 0) s1 = s1.substring(numToDelete); } ///////////////////////////////////////////// tempString = ""; for (i=0; i < s2.length; ++i) { ch = s2.charAt(i); if (ch == "-" && tempString.length == 0) s2Sign = -1; else if ((ch >= "0" && ch <= "9") || ch == ".") tempString += ch; } s2 = tempString; decimalCount = 0; decimalPos = -1; for (i=0; i < s2.length; ++i) { if (s2.charAt(i) == '.') { ++decimalCount; if (decimalPos < 0) decimalPos = i; } } if (decimalCount == 1 && decimalPos >= 0) { len = s2.length; for (i=len - 1; i >= decimalPos; --i) { if (i == decimalPos || s2.charAt(i) == '0') len = i; else break; } if (len < s2.length) s2 = s2.substring(0, len); if (s2.length == 0) s2 = "0"; } numToDelete = 0; for (i=0; i < s2.length; ++i) { if (s2.charAt(i) == "0") ++numToDelete; else break; } if (numToDelete > 0) { if (numToDelete == s2.length) --numToDelete; if (numToDelete > 0) s2 = s2.substring(numToDelete); } if (s1Sign == s2Sign && s1 == s2) return(true); } return(false); } function MultiCompare(responseText, answerText) { var startIndex; var endIndex; var partialText; responseText = responseText.toUpperCase(); answerText = answerText.toUpperCase(); startIndex = 0; do { endIndex = answerText.indexOf("\r", startIndex); if (endIndex < 0) partialText = answerText.substring(startIndex); else partialText = answerText.substring(startIndex, endIndex); if (responseText == partialText) return(true); startIndex = endIndex + 1; } while (endIndex > 0); return(false); } function FixMTF(f) { var text; var letter; var theList; var listIndex; var number; var i; for (i=0; i < f.length; ++i) { if (f.elements[i].name.indexOf("MTF:") == 0) { number = parseInt(f.elements[i].name.substring(4), 10); theList = f["MTF-" + number + "-1"]; if (theList) { listIndex = theList.selectedIndex; letter = theList.options[listIndex].text; } else letter = ""; text = StripSpaces(f["MTF-" + number + "-2"].value); if (text == "") f.elements[i].value = letter; else f.elements[i].value = letter + "," + text; } } } function AllowReset() { return(window.confirm("Do you want to clear all of your answers?")); } // -->
 
Name: 
 

Chapter 4 - Study Guide



Multiple Choice
Identify the letter of the choice that best completes the statement or answers the question.
 

1. 

Visual Basic .NET provides ____ to help programmers build Windows-based applications quickly and easily.
a.
data types
c.
controls
b.
code structures
d.
all of the above
 

2. 

The ____ symbol indicates that a number should be raised to a power using an exponent.
a.
*
c.
^
b.
&
d.
any of the above
 

3. 

RadioButton controls are commonly called ____ buttons.
a.
option
c.
search
b.
filter
d.
selection
 

4. 

You can change a GroupBox control name by changing the value of the ____ property to indicate the function of the controls it contains.
a.
Name
c.
Title
b.
Text
d.
Control Name
 

5. 

If you name a GroupBox control, you use the ____ prefix in the name.
a.
group
c.
grp
b.
GB
d.
box
 

6. 

When the Checked property of a RadioButton control in a group of RadioButton controls has the value ____, this indicates that the RadioButton control is selected, or checked.
a.
False
c.
Checked
b.
True
d.
Selected
 

7. 

RadioButton controls have the ____ property, whose value defines on which side of the control the option button displays.
a.
DisplayOption
c.
DisplayButton
b.
Side
d.
CheckAlign
 

8. 

The ____ toolbar contains tools that allow you to adjust the alignment, spacing, and size of any group of controls on a form.
a.
Display
c.
Alignment and Spacing
b.
Layout
d.
Controls
 

9. 

You select two or more controls on a form by selecting the first control, holding the ____ key down on the keyboard, and then selecting additional controls without releasing this key.
a.
Home
c.
Ctrl
b.
Insert
d.
F6
 

10. 

The ____ button allows you to make the space between the tops and bottoms of two or more controls the same.
a.
Top and Bottom
c.
Make Vertical Spacing Equal
b.
Equal Space
d.
Make Horizontal Spacing Equal
 

11. 

A default button on a form is specified by the ____ property, which tells the application that pressing the enter key on the form is equivalent to clicking the button specified in the property.
a.
DefaultButton
c.
ButtonClick
b.
AcceptButton
d.
ClickEvent
 

12. 

While a form and its controls are ____, they cannot be resized or moved.
a.
locked
c.
entered
b.
fixed
d.
constant
 

13. 

To lock an individual control, select the control and then click the ____ command on the Format menu.
a.
Individual Lock
c.
Fixed Controls
b.
Constant Controls
d.
Lock Controls
 

14. 

Which of the following is a data type supported by Visual Basic .NET?
a.
decimal
c.
date
b.
string
d.
all of the above
 

15. 

Which of the following is NOT a data type supported by Visual Basic .NET?
a.
medium
c.
char
b.
object
d.
none of the above
 

16. 

The ____ determines the data types that are allowed in Visual Basic .NET.
a.
DIM
c.
CLR
b.
CONST
d.
VAR
 

17. 

By default, Option Strict is set to ____, which means that Visual Basic .NET does not require a data type to be the same on each side of an assignment and that you do not need to declare a data type for each variable.
a.
On
c.
True
b.
Off
d.
False
 

18. 

Which of the following is a valid Option Strict statement?
a.
Option Strict = True
c.
Option Strict On
b.
Option Strict = On
d.
Option Strict
 

19. 

A numeric expression can contain ____.
a.
string variables
c.
objects
b.
string constants
d.
none of the above
 

20. 

4 ^ 2 is equal to ____.
a.
2
c.
16
b.
8
d.
64
 

21. 

5 \ 3 is equal to ____.
a.
1
c.
3
b.
2
d.
5
 

22. 

23 Mod 12 is equal to ____.
a.
1
c.
12
b.
11
d.
23
 

23. 

Given the statement A = 8 / 4 / 2, the expression will assign a value of ____ to A.
a.
1
c.
4
b.
2
d.
8
 

24. 

Unless parentheses dictate otherwise, reading from left to right in a numeric expression, which of the following is performed first?
a.
modulo arithmetic
c.
integer divisions
b.
additions
d.
exponentiations
 

25. 

Which of the following can be used to change the order of operations?
a.
commas
c.
periods
b.
parentheses
d.
all of the above
 

True/False
Indicate whether the sentence or statement is true or false.
 

26. 

If a user enters a number outside the range of a NumericUpDown control, the control changes the number to the closest allowable value within the pre-defined range.
 

27. 

You can validate program designs by stepping through the requirements and making sure that the design addresses each requirement.
 

28. 

The center of a GroupBox control contains a positioning grid, so that other controls can be drawn and positioned inside the GroupBox control.
 

29. 

If a RadioButton is added inside a GroupBox control that serves as a container, the RadioButton cannot also be part of a group.
 

30. 

When several RadioButton controls display in a group, as many as three of the RadioButtons controls can be checked at any time.
 

31. 

If RadioButton controls on a form are not placed inside one or more container controls, all of the RadioButton controls function as one group and only one can be selected at a time.
 

32. 

A GroupBox can have only a circular shape.
 

33. 

You must name all GroupBox controls on your form.
 

34. 

The Checked property of a RadioButton control can have the value of True or False.
 

35. 

The Format toolbar simplifies the task of changing the Size and Position property values by allowing you to adjust two or more controls automatically until they are properly aligned, spaced, or sized.
 

36. 

When you select multiple controls, the first control you select serves as the basis for aligning any additional controls you subsequently select.
 

37. 

When multiple controls used for input or output display in a column, it is good practice to size and align the controls together.
 

38. 

You can center a control on a form vertically or horizontally by using the Center Vertically or Center Horizontally buttons on the Layout toolbar.
 

39. 

If you select a control that is in a group and then another control not in the same group, an error message will display.
 

40. 

By choosing groups of controls selectively and using the functionality of the buttons on the Layout toolbar, you can size and align the controls on a form to achieve a polished and symmetrical appearance.
 

41. 

Regardless of how a form’s controls are initially added to the form, the steps to align and size the controls using the Layout toolbar are always the same.
 

42. 

Some user interface design changes are best left until the bulk of the work on the form is complete and most controls are added and their properties are set.
 

43. 

When the user clicks the default button on a form that has the AcceptButton property set, the Click event procedure of the button specified by the AcceptButton property executes.
 

44. 

Multiple buttons on a form can be set as the default buttons.
 

45. 

The black border around a Button control indicates that it is the default button.
 

46. 

Locking prevents the accidental resizing of controls on a form, but they can still be moved.
 

47. 

To lock two or more controls, use the alt key to select additional controls, and then click the Lock Controls command on the Format menu.
 

48. 

Variables and constants are used in code statements to store temporary values used by other code statements.
 

49. 

You do not need to declare a constant before you use it in code.
 

50. 

When you declare a constant, you tell Visual Basic .NET the name and data type of the constant you wish to use, along with the value of the constant.
 

51. 

If a variable or constant will contain a decimal amount, use an integral data type when you define that variable or constant.
 

52. 

If a variable or constant will not contain a decimal, you should use a nonintegral data type.
 

53. 

Always try to use the data type that takes up the smallest amount of memory.
 

54. 

Constant names must always begin with a number.
 

55. 

The names of constants can be up to 255 characters in length.
 

56. 

The names of constants can contain punctuation and blank spaces but not underscores.
 

57. 

Declaring a data type makes the code more readable to others.
 

58. 

Declaring a data type eliminates the time-consuming process of having Visual Basic .NET determine the data type during run time.
 

59. 

By declaring a constant outside of any event procedure, the constant can be used in any event procedure within the form.
 

60. 

The code you write for a form Load event is code that you want to execute after the CLR allows the user to begin to take action on the form, such as entering data.
 

61. 

If you leave the data conversions of variables to Visual Basic .NET, you might end up with a condition that causes a run time error to occur, in which the CLR will halt the program.
 

62. 

When you use an assignment statement, Visual Basic .NET requires you to use the same data type on both sides of the assignment.
 

63. 

Like a constant, a variable represents a location in computer memory that can change values as the code executes.
 

64. 

The rules for naming variables are significantly different from the rules for naming constants.
 

65. 

Depending on the name given to a variable, the scope of the variable can be limited to it is not usable everywhere in a project’s code.
 

66. 

A variable declared within an event procedure only has scope within that procedure.
 

67. 

Visual Basic .NET includes several functions that allow you to convert the value of a variable or constant to another data type, and then use the result in a statement.
 

68. 

A numeric expression can contain string constants but not string variables.
 

69. 

6.8 \ 3.2 is equal to 2.125.
 

70. 

Visual Basic .NET will reject the statement, A = 2B, because a constant and a variable within the same expression must be separated by an arithmetic operator.
 

71. 

For complex expressions, Visual Basic .NET allows parentheses to be contained within other parentheses.
 

72. 

In coding expressions, do not attempt to raise a positive value to a nonintegral value.
 

73. 

In coding expressions, do not attempt to determine the square root of a negative value.
 

74. 

Intrinsic functions are accessible to Visual Basic .NET only; they are not available in other .NET languages.
 

75. 

The final step of the development cycle is to document the application.
 

Completion
Complete each sentence or statement.
 

76. 

A(n) ____________________ control is used as a container for other controls.
 

 

77. 

A(n) ____________________ control serves as a holding area for other controls, indicating that the controls within it are somehow related.
 

 

78. 

A(n) ____________________ control presents a set of choices, such as the number of years in a loan.
 

 

79. 

RadioButton controls are placed in ____________________ that permit the user to make only one selection from a group of RadioButton controls.
 

 

80. 

The ____________________ property value of a RadioButton control determines which RadioButton control is selected.
 

 

81. 

The ____________________ toolbar includes buttons that map to all of the commands available on the Format menu.
 

 

82. 

Each time you click the ____________________ button on the Layout toolbar, Visual Basic .NET increases the horizontal spacing between the buttons.
 

 

83. 

The ____________________ button is used to align the tops of selected controls.
 

 

84. 

When you want one particular button on a form to execute the central task that the form was designed to accomplish, you should set that button to be the ____________________ button for the form.
 

 

85. 

A(n) ____________________ button on a form is specified by the AcceptButton property.
 

 

86. 

____________________ controls prevents them from being moved and prevents the control’s size from being modified on a form during design time.
 

 

87. 

A(n) ____________________ is a number or string that programmers use in the code.
 

 

88. 

A(n) ____________________ represents a location in computer memory that can change values as the code executes.
 

 

89. 

A(n) ____________________ represents a location in computer memory, but its value cannot change during execution of the code.
 

 

90. 

The ____________________ of a variable or constant determines what kind of data the variable or constant can store, such as numeric or character.
 

 

91. 

To declare a constant, you use the ____________________ keyword.
 

 

92. 

The form event procedure that executes whenever the form initially displays to the user is a form ____________________ event.
 

 

93. 

The ____________________ statement can be used to instruct Visual Basic .NET to force you to ensure that all assignment statements use the same data type on both sides of the assignment.
 

 

94. 

____________________ forces you to declare a data type for all variables and constants explicitly.
 

 

95. 

To declare a variable, you use the ____________________ statement.
 

 

96. 

____________________ refers to a variable or constant’s accessibility and is defined by the placement of the variable declaration in the code.
 

 

97. 

A variable is considered a(n) ____________________ variable if the variable only has scope within the procedure in which it is declared.
 

 

98. 

Variables that have scope for all of the procedures in the form are considered ____________________ variables.
 

 

99. 

____________________ are values that are passed to the function and are used by the function to perform its operation.
 

 

100. 

A(n) ____________________ can perform a calculation, manipulate characters, call a function, or test data.
 

 

101. 

A(n) ____________________ expression is any expression that can be evaluated as a number.
 

 

102. 

A(n) ____________________ operator is used to manipulate two or more numeric values.
 

 

103. 

Order of ____________________ is a predetermined order that defines the sequence in which operators are evaluated and resolved when several operations occur in an expression.
 

 

104. 

The ____________________ operator is used to divide two numbers and then return the remainder of the division operation as an integer.
 

 

105. 

Unless ____________________ dictate otherwise, reading from left to right in a numeric expression, all exponentiations are performed first, followed by multiplications and/or divisions, then all integer divisions, then all modulo arithmetic, and then all additions and/or subtractions.
 

 

106. 

Visual Basic .NET includes built-in, or ____________________, functions that you can use in your code.
 

 

107. 

The ____________________ function returns the payment for a loan based on periodic, constant payments and a constant interest rate.
 

 

108. 

The ____________________ function is an intrinsic function that takes the first argument in the function and formats it as specified by the second argument in the function.
 

 

109. 

___________________ is a common format for the Format$ function that displays at least one digit to the left and two digits to the right of the decimal separator.
 

 

110. 

___________________ is a common format for the Format$ function that displays the number with a thousands separator; if appropriate, it displays two digits to the right of the decimal.
 

 



 
Check Your Work     Reset Help
Hosted by www.Geocities.ws

1