CIS 230 Practice Exam #1 (Ch. 1 - 4)
Part ITRUE/FALSE
1 | When creating a project in Visual Basic you should always begin by writing the Basic code. |
2 | When you are designing the user interface and writing code you are in run time. |
3 | After you have added a command button to a form you can change what is displayed on the form (inside the button) by changing the Caption property. |
4 | Remark statements are not executable code. |
5 | If a project runs without halting, you can be assured that the code was written without error. |
6 | You write Visual Basic code statements during Design Time. |
MULTIPLE CHOICE
7 | Microsoft Windows uses GUI
environment. GUI (pronounced gooey) stands for
|
8 | Each Visual Basic project
consists of at least two files,
|
9 | Assume that you want to add a
control to a form, in which window in the Visual Basic environment would you get a command
button?
|
10 | Remarks, or comments, that
programmers add to their code in order to make the program more readable and
understandable
|
11 | Which of the following are coding
conventions required by the textbook?
|
12 | The code that is used in a sub
procedure to stop execution of a program is:
|
TRUE/FALSE
13 | You can select multiple controls by clicking on the first control and then hold the Ctrl key and click on each of the other controls in the group. |
14 | Setting the Cancel property of a command button to True will allow the user to press Enter to select the button. |
15 | If you have several option buttons that were created by double-clicking, you can make them belong to a frame by dragging them on top of the frame. |
16 | The statement: txtItem.SetFocus, will place the insertion point in the text box called txtItem. |
17 | You can make a label appear when the user pauses the mouse pointer over a control by setting the controls ToolTipText property. |
18 | The ToolTipText property of a control must be set to "Centered" so that text displaying on the control will appear centered. |
19 | When a checkbox is checked, the value property may be tested for a value of True. |
MULTIPLE CHOICE
20 | Your project will allow the user
to choose the background color for the form. You will offer them five choices. You should
use
|
21 | Image controls hold a graphic,
which is assigned to the
|
22 | Setting the TabIndex of a control
to 0 will
|
23 | Small labels that pop up when the
user pauses the mouse pointer over a control on the form are created by
|
24 | To load an icon into an image
control, change the controls _______ property.
|
25 | Which of the following property
settings should be used on an object named txtUserInput in order to make the insertion
point appear in the object when the form first appears?
|
26 | To determine whether an option
button is currently selected, check its _______ property.
|
27 | Which of the following is not a
valid value for the Shape property of a Shape control?
|
28 | When you are using the line
control you should remember that all lines
|
29 | The naming prefix for a label
control is __________ .
|
TRUE/FALSE
29 | Data whose value may not be changed during the execution of a project is referred to a constant. |
30 | If you are declaring a variable that will be used in calculations, you may use the currency datatype. |
31 | Numeric constants may contain only the digits ( 0 - 9 ), a decimal point, and a sign ( + or - ) at the left side. |
32 | A variable must be declared with a Dim statement before it is used. |
33 | A variable that is declared with the Dim statement in a local procedure is initialized to zero each time the procedure occurs. |
34 | Local variables can be used in any procedure in the module as long as they are declared somewhere in the project. |
35 | The Val function can be used to eliminate the problems encountered when the user does not enter a value into a field. |
MULTIPLE CHOICE
36 | Which of the following is not a
valid variable data type?
|
37 | If a declaration statement does
not specify a datatype, it will default to
|
38 | The datatype that is most
commonly used for decimal fractions is
|
39 | The length of identifiers is
limited to
|
40 | The statement to declare a local
variable called Index that will store whole numbers is:
|
41 | Which of the following is NOT a
rule for naming identifiers?
|
42 | If a procedure contains a Dim
statement and strName is assigned as the identifier, strName can be used
|
43 | A variable that is declared in
the general declarations module of a form is a(n)
|
44 | Which operator(s) has(have) the
highest order of precedence in arithmetic expressions?
|
45 | What will be the value of intTotal
after execution of this statement? Assume that intValue = 2. intTotal = ((intValue + 2) * (intValue + 4)) / intValue + 1 |
46 | Which of the following is not a
valid statement about the Val function?
|
47 | In order to control the way
information should appear when it is displayed or printed out, you can use
|
48 | Which of the following is not one
of the VB formatting functions?
|
TRUE/FALSE
49 | Each ELSE will be matched with the last unmatched IF, regardless of indentation. |
50 | Message boxes can be used to test if the user has input data that is a reasonable value. |
51 | If intA <> intB Then evaluates True when intA=3 and intB=5. |
MULTIPLE CHOICE
52 | When comparing strings, which one
of the following strings is less than the others, based on the ASCII code?
|
53 | The text property of a text box
behaves like a
|
54 | In order to determine if the user
has input a value, and not a string, into a text box, you can use
|
55 | You can use _______________ as
your project executes in order to view the values of data or messages.
|
Part II
Write a code segment that performs the following tasks. Follow the precise directions and do not add prefixes to specified identifiers.
1. Write the VB statement to clear a text box named txtName.
2. Write the VB statement to reset the insertion point into a text box named txtName.
3. Write the VB statement to make a label named lblAnswer become invisible.
4. Write the VB statement to assign the numeric value 4 into a variable named intNumber.
5. Write the VB statement to assign the value contained in a text box named txtWidth to a label named lblWidth.
6. Use a With statement to clear a text box named txtPlace and to reset the insertion point to that text box.
7. Write a statement that declares a variable named intQuantity of type Integer.
8. Write a statement that declares a variable named A to store monetary values.
9. Declare a string named UserName.
10. Write a statement that computes the average of variables named A, B, and C and stores the value in the variable named D.
11. Write a statement that formats a value to three positions past the decimal (thousandth's place).
12. Write a statement that sets the text box named txtPlace to the empty string.
13. Write a statement that uses the Val function to convert the string literal "123" to a value and assign it to the Integer variable, intQuantity.
14. Write an If statement that assigns the value of 10 to the variable intSum if intNum is greater than 19. Otherwise, the If statement will assign the value of 5 to intSum.
15. Write an If statement that assigns the string "hello" to the text box txtMessage if the value of intQuantity is less than 15 or greater than 44. The same If statement should also assign the string "goodbye" to txtMessage if the value of intQuantity is equal to 30.
CIS 230 Home Page | Exam Information