Unit 4: Sequential ProcessingPage 1

Name
Score / / 20
Update Value

Programming Logic - Beginning

152-101

Unit 4: Sequential Processing

This worksheet is based on the exercises starting on page 175 of the Lego book.

- ¼ point for each incorrect answer.

Review Questions & Exercises

  1. The ______control allows you to capture input the user type on the keyboard.
  2. ______is the standard prefix for Textbox control names.
  3. ______means that one string is appended to another.
  4. The ______character allows you to break a long statement into two or more lines of code.
  5. The ______character is actually two characters: a space followed by an underscore.
  6. The control that has ______is the one that receives the user’s keyboard input or mouse clicks.
  7. The order in which controls are accessed using the Tab key is called the ______,
  8. (not assigned)
  9. If you do NOT want a control to receive focus when the user presses the Tab key, set its ______property to ______.
  10. An access key is a key that you press in combination with the ______key to quickly access a control such as a button.
  11. You define a control’s access key through its ______property.
  12. A ______is a storage location in the computer’s memory used for holding information while the program is running.
  13. A ______is a statement that causes VB to create a variable in memory.
  14. A variable’s ______determines what kind of information a variable can hold.
  15. A ______variable is declared inside a procedure.
  16. A ______error is generated when your program attempts to convert non-numeric strings to numeric values.
  17. A ______is a specialized routine that performs a specific operation and then returns a value.
  18. ______converts a string to an integer.
  19. (not assigned)
  20. A ______is information being passed to a function.
  21. When two operators share an operand, the operator with ______executes first.
  22. A ______is like a variable whose content is read-only—it cannot be changed while the program is running.
  23. (not assigned)
  24. A form’s ______procedure executes each time a form is started.
  25. (not assigned)

True or False.If the answer is false, write why the answer is false.

  1. T FThe TextBox control’s Text property hold the text entered by the user.
  2. T FYou can access a TextBox control’s Text property in code.
  3. T FThe string concatenation operator automatically inserts a space between the joined strings.
  4. T FYou cannot break up a word with the line-continuation character.
  5. T FYou can put a comment at the end of a line, after the line-continuation character.
  6. T FOnly controls capable of receiving input, such as a TextBox or Button, may have focus.
  7. T FYou can cause a control to be skipped in the tab order by setting its TabPosition property to False
  8. (not assigned)
  9. T FA control whose Visible property is set to False can still receive focus.
  10. (not assigned)
  11. T FWhen you assign an access key to a button, the user can trigger a Click event by typing Alt+ the access key.
  12. T FA local variable may be accessed by any event procedure in an application.
  13. T FWhen a string variable is created in memory, VB assigns it a default value of 0.
  14. T FA variable’s scope is the time during which the variable exists in memory.
  15. T FA variable declared inside a procedure is only visible to statements inside the same procedure.
  16. T FThe CSng function converts a number to a string.
  17. T FIf the CSng function cannot convert its argument, it causes a runtime error.
  18. T FThe multiplication operator has a higher order of precedence than the addition operator.
  19. T FA named constant’s value can be changed by a programming statement while the program is running.
  20. T FThe statement lblMessage.BackColor = Green will set the lblMessage control’s background color to green.
  21. T FYou can select multiple controls simultaneously with the mouse.
  22. T FYou can change the same property for multiple controls simultaneously.
  23. (not assigned)
  24. (not assigned)

Multiple Choice (circle or highlight the BEST answer)

  1. When the user types input into a TextBox control, it is stored in which property?
  2. Input
  3. Text
  4. Value
  5. Keyboard
  6. Which character is the string concatenation character?
  7. *
  8. %
  9. @
  10. In code, you move focus to a control with which property?
  11. MoveFocus
  12. SetFocus
  13. ResetFocus
  14. Focus

  1. Which form property allow you to specify a button to be clicked when the user presses the Enter key?
  2. DefaultButton
  3. AcceptButton
  4. CancelButton
  5. EnterButton
  6. Which form property allow you to specify a button to be clicked when the user presses the Esc key?
  7. DefaultButton
  8. AcceptButton
  9. CancelButton
  10. EnterButton
  11. You ca modify a control’s position in the tab order by changing which property?
  12. TabIndex
  13. TabOrder
  14. TabPosition
  15. TabStop
  16. You can assign an access key to a button through which property?
  17. AccessKey
  18. AccessButton
  19. Mneumonic
  20. Text
  21. (not assigned)
  22. You declare a named constant with which keyword?
  23. Constant
  24. Const
  25. NamedConstant
  26. Dim
  27. The part of a program in which a variable is visible and may be access by programming statements is the variable’s
  28. segment
  29. lifetime
  30. scope
  31. module

  1. The time during which a variable exists in memory is the variable’s
  2. segment
  3. lifetime
  4. scope
  5. module
  6. Which string is returned from the function FormatPercent(0.25)?
  7. “0.25%”
  8. “2.50%”
  9. “25.00%”
  10. “0.25”

Short Answer (do only the numbers listed)

2.How do you erase the contents of TextBox using code?

7.How do you assign an access key to a button?

8.How does assigning an access to a button change it’s appearance?

11.Why should you always make sure a string variable is initialized or assigned a value before it is used in an operation?

12.When is a local variable destroyed (removed from memory)?

15.Complete the following table by providing the value of each mathematical expression.

ExpressionValue

5 + 2 * 8______

20 / 5 – 2______

4 + 10 * 3 – 2______

(4 + 10) * 3 – 2______

16.Complete the following table by indicating the format function’s return value.

Function CallReturn Value

FormatNumber(67521.584)______

FormatCurrency(67521.584)______

FormatNumber(46,0)______

FormatPercent(.284)______

17.Describe one way to select multiple controls in Design mode.

What do you think?

9.Suppose a number is used in a calculation throughout a program and must be changed periodically. What benefit is there to using a named constant to represent the number?