Sams Teach Yourself Visual Basic 6 in 24 Hours

Sams Teach Yourself Visual Basic 6 in 24 Hours

By Greg Perry

Workshop

The quiz questions and exercises are provided for your further understanding. See Appendix B for the answers.

Quiz

  1. What preparation must you do before the built-in functions are available to you?

  2. What is the value stored in each of the following assignment statements?

    1. strA = Left("abcdefg", 3)
    2. strB = Right("abcdefg", 3)
    3. strC = Mid("abcdefg", 2, 3)
    4. strD = Mid("abcdefg", 2)
  3. Is the following Mid() a function or a statement?

    Mid(strTest, 2, 4) = "abcd"
    
  4. Is the following Mid() a function or a statement?

    strAns = Mid(strTest, 2, 4)
    
  5. What is the value stored in each of the following assignment statements?

    1. intA = Int(20.34)
    2. intB = CInt(20.34)
    3. intC = Fix(-2.8)
    4. intD = Int(-2.8)
  6. What value appears in varAns after the following assignment?

    varAns = Val(LTrim(Str("10")))
    
  7. What is the 24-hour time for 12:56 p.m.?

  8. What is a thousands separator?

  9. True or false: You must use Format() to properly format date and time values because the built-in date and time functions cannot interpret your International settings.

  10. True or false: Now returns information for both the current date and the current time.

Exercises

  1. Write a program that stores the 256 ASCII characters (from ASCII 0 to ASCII 255) in a string array that's defined to hold 256 characters.
  2. Write a subroutine procedure that asks the user for the time that he clocked into work and then for the time he clocked out. Display, in three labels, the total number of seconds worked, the total number of minutes worked, and the total number of hours worked.
  3. Write a subroutine procedure that asks the user for her birthday. If the user entered a valid date (check to make sure and keep asking if the user did not enter a date), display a message box telling the user how many years until she reaches the retirement age of 65. If the user is older than 65, congratulate her on a long life!

Share ThisShare This

Informit Network