Study questions for Quiz One - Wednesday, Oct 3rd, 2001
Note: More students questions to be added yet
1) What type of Loop allows you to execute an action a set number of
times?
2) What is the keystroke shortcut to get to the Macros menu?
3) All Visual Basic macros begin with the keyword "sub" which is followed
by the macro name. This name is called the macro __________ line.
4) What type of variable is available throughout the module to all macros
on your module sheet?
5) In excel, you have just typed in the command to generate a random
number in cell A1. You want cells A1 through D5 to also contain
random numbers. What is the quickest method of accomplishing this?
6) A "For Each Loop" only executes a predetermined number of times. (T/F)
7) What is the significance of the right most button in Excel's stop
recording toolbar?
8) What toolbar would you bring up if you wanted to type in text at
different angles and character spacing?
1. In our past visual basic assignment, what is meant by commenting
out sections of the program?
2. T or F Is it important to have comments throughout your program?
3. T or F The Do While command is a type of loop?
4. What is the purpose of indenting while you are writing code?
5. Describe, in brief, what a macro is.
6. What is a global variable?
7. What is an "if" statement?
8. What is a sleep function? a. darken b. dim c. shut
Blank Filling-Out Questions:
1. The formula "=int(rand()*60+20)" in a cell in an Excell worksheet will
produce a maximum value of ______.
2. To select a range of cells where work has been done, we hold down the
Ctrl key and the _____ and then press the * key.
3. To copy random numbers and devolatile them in the new cells in Excel,
we can use the Paste Special command in the Edit menu and select the
_______ radio button in the Paste section of the Paste Special dialog.
True or False Questions:
4. The statements ActiveCell.Value = " "
and Len(Trim(ActiveCell.Value)) = 0 are equivalent.
5. Both the "Do While ... Loop" and the "Do ... Loop While" execute at
least once regardless of the value of the logical expression that is
given after the While keyword.
Multiple Choice Questions:
6. Assume that you want to store whole numbers in the range of 5 through
100 in a numeric variable. The most efficient data type to use for the
variable is:
A. Currency B. Integer
C. Long D. Single
7. Which of the following are valid numeric literal constants?
A. "85" B. 85%
C. $85 D. None of the above.
8. Study the following code and determine the number of times the MsgBox
statement in the code will be processed.
Dim intCount As Integer
For intCount = 1 To 20 Step 2
MsgBox Prompt:="Number: " & intCount
Next intCount
A. 2 times B. 8 times
C. 10 times D. 11 times
1. Define a Global Variable. Define a Local Variable.
2. What is missing in the following code below:
Sub Pause()
stoptime = timer + delayamt
Do While Time < stoptime
DoEvents
End Sub
3. What does " _" mean when inserted at the end of a line?
4. Define the following reference types:
a. $A$12 =
b. A12 =
5. What does the term "static" imply?
6. How can you run a Macro from a keyboard shortcut?
7. Define a Macro. What is it used for?
8. True or False:
Using the Visual Basic Editor, you can edit macros, rename macros,
but you can not copy a macro from one workbook to another.
1. What is the correct way to enclose a string (text) so that it is
readable to the program?
2. Under which menu will you find the record, play and edit macros?
A. File B. Edit
C. Tools D. Options
3. The function =RAND( ) * 60 will produce random numbers in what range?
4. If you want a text effect or object to revolve 360 degrees in 12
degree increments, your for i statement would be For i = 1 to 36.
5. The screenupdating program is automatically set to false.
6. Sub Blank
stoptime = Timer + 1
DoWhile Timer < stoptime
DoEvents
Loop
End Sub
This macro will perform what action?
7. Boolean data is what type of data?
A. date B. objects
C. true/false D. numeric
8. Putting "dim" in front of a variable name does what?
True or False
1. The ' mark is used to designate comments in Visual Basic.
2. The Macros command is found under the View Toolbar.
3. The word Dim represents a global variable.
4. Each macros must end with the End Sub command.
Fill in the blank.
5. To represent the range A1 through D23 you would write this as how?
6. The & is used to represent what?
7. To get to the top of the page used the command Ctrl + what?
8. An if statement begins with an IF and ends with what?
1. The fill handle is located on the ________ corner
of each cell.
2. To activate the drawing toolbar which menu would pull
down:______.
3. R in RGB stands for:
a. right b. rounded c. random d. red
4. To fill a selected area with the data from one cell a
a person holds down the control and alt keys.
a. True b. False
5. A cmd is usually represents a _________ button.
6. For loops are normally ended by _______ .
7. If I double click on worksheet tab, I am trying to:
a. activate that worksheet b. move that worksheet
c. rename the worksheet d. select that sheet for visual basic.
8. Two or more loops that are combined are said to be:
a. nested b. linked c. connected d. grouped
T or F
1. To continue a line of code on the next line, type a space followed by a
hyphen ( - ).
2. To add a formula to the active cell of a selection of cells hold down
the ctrl key while hitting enter. If just enter is pressed the
formula will be used in all of the cells.
3. To add a comment to macrocode type a double quote (") followed by the
comment.
4. The macro must be in the active workbook in order for it to be
available to run.
5. The default step amount for a For loop is 1.
6. With VBA you can only construct a loop that executes as long as the
loop's determinant is True, and stops when the determinant condition
becomes false. You can not construct loops that execute as long as
the condition is False, and stops when the determinant becomes true.
Multiple Choice
1. If you type an A as the shortcut key for a macro, the actual shortcut
key is:
A. Ctrl + A
B. Ctrl + Alt + A
C. Ctrl + Shift + A
D. Shift + Alt + A
Fill in the blank.
1. Additional information that is passed to a procedure is referred to as
a(n) _________________________________ for that procedure.
1. True False In Excel, by using the shift key then *, your entire
selection will be highlighted.
2. In For i = 10 to 100, what is the test value?
a. 10 b. 100 c. i d. none of the above
3. What is & called?
a. concatenate operator b. variable
c. constant d. integer
4. True False You would store a macro in the Personal.xls workbook if
you wanted it available to any open workbook during any
work session.
5. True False You can change the number of times a For Next loop 0
executes?
6. Which set of words will get your loop to run?
a. doEvents b. Next i c. For i d. change = -change
7. By typing ___________ you will get random numbers in the cells
selected.
8. Dim delayAmt is a
a. global variable b. constant c. integer d. none of the above
1. What are the four major steps in recording a macro?
2. What does running or executing a macro mean?
3. What are the four controls in the Macro dialog box?
4. What do you use to edit the code of your macro?
5. What is the name of the error you get when you run a macro?
6. What is a variable?
7. What is a variable that all procedures and use called?
8. What code can you use to do repetitive tasks?
1. True or False - The Excel command Ctrl+Shift+*, selects all the cells
in the workbook sheet that have data.
2. The Excel formula Rand() produces numbers that are:
A) 1 <= n <100
B) 0 <= n < 1
C) 0 <= n <= 1
D) none of the above
3. If x > 0 Then
x = x +1
End If
Is and example of a 1 way selection. True or False
4. True or False Ctrl + Home in Excel selects the cell A1 at the
top of a worksheet.
5. In VBA, a variable declared as a variant can hold:
A) an integer
B) a string
C) an object
D) all of the above
6. In the following loop the test value is:
A) 1
B) 100
C) 10
D) none of the above
For i = 1 to 100 Step 10
the cell = "A" & i
next i
7. The following loop will put a pause in a VBA program. True of False?
stopTime = Timer + pauseAmt
Do while Timer < stopTime
DoEvents
Loop
8. True or False. An if statement ends with the statement "end loop"?
1. Why are both fixed loop structures
(For...Next, For Each Next...) called loops?
2. In a excel workbook what function establishes an initial condition?
3. What does & mean?
4. Give an example of a constant.
5. The If...Then statement provides a choice that allows
a single branch of execution in one's procedure?
True False
6. The mod function is a remainder of:
A. Subtraction
B. Multiplication
C. Division
7. Give an example of a shortcut.
8. Name the sheet that allowed us to enter the 50 states
into our tribute macro.
1. What is the & in this For i loop called?
For i = 1 To 10
TheCell= "A" & i
Range(theCell).Value = i*i
Next i
A. Variable B. Concatenate
C. Consonant D. Cantaloupe
2. True or False A collection of cells is called a range.
3. How long is the pause in
Sub Pause ()
stoptime = timer +1
DoWhile Time < stoptime
DoEvents
Loop
End Sub
A.1 second B. 1.5 seconds C. 2 seconds D. no pause
4. What is the keyboard command to go back to the beginning of the sub.
A. ctrl + end
B. ctrl + shift
C. ctrl + home
D. ctrl + spacebar
5. True or False Crtl + end will take you to the end of the current
line you are typing.
6. Yes or No Was there a pause included in our first assignment that
we did ?
7. Sub pause ()
stoptime = timer + pauseAmt
Do While timer < stoptime
DoEvents
Loop
End Sub
This pause includes a…
A. Do While loop B. For i loop C. For each loop D. No loop
8. The name of our first assignment was called ____________.xls.
1. Q: What is the range of "= (Int) Rnd()*100 + 100"?
2. Q: T or F, the following loop is correctly written
For each theCell In range ("A1:B3")
count = count + 1
next theCell
3. Q: Declare a global variable called "amountOfDelay"?
4. Q: Write a sub program that will delay a program for
5 seconds?
5. Q: What is the statement "31 mod 10" return?
a) 10 b) 1 c) 10.1 d) 0
6. Q: Write a "for loop" that counts from 1 to 100
7. Q: T or F, the selection. prefix, such as in
"selection.ShapeRange.IncrementRotation 5"
selects only one cell.
8. Q: What is the value of "delayAmount" in the following code?
Pause (10)
Dim delayAmount
sub Pause(delayAmount)
stopTime = Timer + delayAmount
Do While timer < stopTime
DoEvents
loop
end Sub
1. What does the shortcut (Ctrl + Alt + *) do in Microsoft excel
worksheets?
A. Selects current cell
B. Selects several active cells
C. Selects everything on the sheet
2. What min and max are searched for in this random function?
=INT(rand() * 60 + 20)
A. 0 <= n < 1
B. 20 <= n < 80
C. 21 <= n < 79
3. What is the difference between the area selected in:
Selection.Formula R1C1 = ""
Compared to
Activecell.Formula R1C1= ""
4. Static variables retain their values in between calls to that
particular function.
A. True
B. False
Sleep Function for questions 5 & 6:
Sub Pause()
stopTime = Timer + 2
DoWhile Timer < stopTime
Do Events
Loop
End Sub
5. What exactly is this sleep function going to do?
A. Pause only the first event for 2 seconds past midnight
B. Pause everything for 2 seconds past midnight
C. Do nothing
6. What does the "Do While loop" accomplish in the above function?
7. What is the name of this symbol "&" in VBA?
8. (For i = 2 to 12 step 2) What does the step 2 in this for loop do?
A. Allows the for loop to increment by 2 instead of the default of 1
B. Is the amount of seconds pause before the next part of the for
loop is executed
C. How many times the for loop will be executed
1. What is the short cut for selecting a region in excel?
2. To get a whole random number use the function
=INT(RAND)(). True or False
3. A macro in edit form begins with Sub() and ends with
a.) Finish Sub
b.) Last Sub
c.) End Sub
d.) Sub End
4. What is the purpose of using a macro in excel?
5. What is the short cut used to get to the top of a
page?
6. Which is the most used loop in visual basic:
a.) For i =
b.) For h =
7. The short cut for copying is control key + Enter.
True or False
8. Give an example of a global variable.
1. What is the key sequence that will select the current region around
the active cell. (The current region is an area enclosed by blank
rows and blank columns.)
a. Shift + F1
b. Ctrl + Shift + *
c. 1 + Spacebar
d. None of the above.
2. True/False : A "for each theCell" loop ends with a "Next theCell".
3. Write any "if" statement that utilizes: if, elseif, & else.
4. What is the Visual Basic that we put into our subs to allow the user
to stop or somehow interrupt the loop before it is finished executing?
5. Range("A1").Select would do what?
a. Select Cell A1
b. Select Row A
c. nothing... that is incorrect syntax
d. Selects Column 1
6. True/False: A global variable can be accessed throughout the program.
7. Holding down the _______ key while pressing Enter causes
the formula to be used in all the cells of the Selection.
8. True/False: If you were trying to jump down column A rows 1 through 10
and wanted to put the letter "b" in each cell, an appropriate for loop
would be:
For theRow = 1 To 10
theCell = "A" & theRow
Range(theCell).Select
ActiveCell.Value = "b"
Next theRow
1. T/F You can declare several variables on the same line, such
as :
Dim Profit, Income, Cost
2. What is a reason to have looping commands?
A. To perform one equation, once
B. To cause one or more statements to repeat
C. To create a circle
D. None of the above
3. What is another way to record this statement:
Range("A2").Select
Selection.EntireRow.Delete
4. What function key allows you to step through the Visual Basics Code
A. F7
B. F2
C. F5
D. None of the above
5. What Function is used if the user is required to enter data such as
the date?
6. Why would Dim be used?
7. What is a global variable?
8. When should you use Do Loop and when should you use For Loop?
A. use for loop to repeat a set number of times
B. use do loop to repeat a set number of times
C. use for loop if a it is unknown how many times a loop is needed
D. B & C
1) How do you declare a global variable that is available throughout
the module?
2) What type of loop is associated with the timer function?
A) For...Each B) For...Ever C) DO While D) Do Not
3) Which code represents these actions CTRL and Enter.
A) Selection.Formula B) ActiveCell.Formula
C) Special.Formula D) Selection.for09
4) What statement indicates you must declare all variables?
5) What process does a diamond shape represent in a flowchart?
6) In a For...Next Loop what is the default "Step"?
7) The AUTOFILL Cross can be visible when you run the arrow over the
top left corner of the cell in Excel (True or False).
8) The first step in recording a macro is to set up initial
conditions. (True or False)
1. What are the 2 ways to display a hidden toolbar?
2. What is an undocked toolbar?
3. True or False - It is not possible to dock a floating toolbar?
4. What would you need to add to this loop to count backwards by 1.
For k = uStart to uEnd _____________
uSum = uSum + k
Next k
5. True or False - The end count of a loop can be a
variable istead of just a constant number.
6. Which of the following is the reason we use
varying amounts of indentation in our source code
a. to make writing code harder.
b. to make the code more readable.
c. none of the above.
7. Finish the following If statement
__________ SheetExists(uStr) _________
MsgBox "Sheet : " & uStr & _
"DOES exist in current workbook."
__________
MsgBox "Sheet : " & uStr & _
"does NOT exist in the current workbook."
__________
8. Which of the following is used to represent a determinant condition in
a flowchart.
a. oval. b. square.
c. diamond. d. none of the above.