Visual Basic - Quiz on Chapter #3

True/False and Why

 

For all of the following questions answer True or False - for all things you designate as False, you must give a WHY. Due a week from Tuesday

1. T / F

The box that appears when you double-click on an object is called the private box.

2. T / F

The statement Picture1.Clear will erase all text and graphics from the picture box Picture1.

3. T / F

Assigning string values to numeric variables or numeric values to string variables results in the error message "Type mismatch".

4. T / F

Objects can be grouped together by attaching them to a picture box.

5. T / F

Input #n, var1, var2,, varj

will cause the same results as

Input #n, var1

Input #n, var2

Input #n, varj

6. T / F

For statements of the form Let object.property = settings, with properties Caption, Text or Font.Name, the settings must be surrounded by quotes.

7. T / F

Variables that are not declared with a Dim are called implicitly declared and are assigned a data type of Standard which can hold strings, numbers and several other kinds of information.

8. T / F

Spc(n) inserts n spaces between two items in a picture box.

9. T / F

Words such as Print, End, Call, If, Select and Sub are called restricted keywords and an error message appears as soon as the cursor is moved to another line. Other keywords such as Error, Height, Rate, Time, Val, Width and Year do not trigger an immediate warning but generate an error message when the program is run.

10. T / F

Let objectName.property = setting can be used to change properties of an object.

11. T / F

If Val or Str is omitted from a conversion statement, Visual Basic will attempt to make the conversion for you. However two text numbers such as 45 and 89 may endup as 4589 instead of 134 because Visual Basic does not perform the conversion until just before the assignment.

12. T / F

All of the parameters in the general form of the InputBox statement are optional except for prompt.

13. T / F

To view the character sets for the different fonts, Click on the Start button and then Programs, Accessories and Character Map. After selecting a font, use the left mouse button to enlarge the character and obtain the keystroke that produces the character.

14. T / F

The carriage return and the line feed can be suppressed by placing a semicolon at the end of the Print method. For example:

picAns.Print 5;

15. T / F

The Print method displays both the negative number -7 and the positive number 7 beginning directly at the left margin.

16. T / F

Numbers are stored in text boxes as strings. Therefore, they should be coverted to numbers before being assigned to numeric variables.

17. T / F

Although declaring variables with Dim statements is optional in Visual Basic, you can tell Visual Basic to make declarations manditory by including Option Explicit under General.

18. T / F

Most properties can be set or altered with code as the program is running instead of being preset from the Properties window.

19. T / F

The statement Let KeyAscii = 0 placed in a KeyPress event procedure discards the key pressed.

20. T / F

You can turn off the automatic List Properties/Method feature by pressing Tools/Options , selecting the Editor page and clicking on Auto List Members. You can still display a list manually be pressing Ctrl + L.

21. T/ F

Ucase converts all letters to uppercase and Lcase converts all letters to lowercase.

22. T / F

Private Sub event()

Statements

Sub Close

Is the structure that is used to code an event.

23. T / F

A null string can be represented by either "" (no space between quotes) or " " (one space between quotes).

24. T / F

With the Print method, semicolons cause the items to be displayed one after another and commas cause the items to be displayed in consecutive zones. A zone is 14 positions where the width of a position is the average width of the characters in the font.

25. T / F

The underscore character is a line continuation character. It must be preceded by a space.

26. T / F

Picture1.Print n will display a number on the screen in a picture box.

27. T / F

The Rnd function with Randomize generates the same sequence of numbers each time a program is run.

28. T / F

Because the expression in a Let statement is evaluated before an assignment is made, a statement such as Let n = n + 1 is meaningful and valid. It is called an assignment statement.

29. T / F

The quotation mark character (") can be placed into a string constant by using Chr(34).

30. T / F

The Print method displays a trailing space after every number.

31. T / F

Two strings can be combined to form a new string consisting of the strings joined together. This is called concatenation and can be represented by either the & or the +.

32. T / F

The format strings "Standard" and "Currency" convert numbers to string representations having two decimal places and commas every three digits to the left of the decimal point. Numbers less than 1 have a zero to the left of the decimal point. The format string "#,0" rounds numbers to whole numbers and places commas every three digits to the left of the decimal point.

33. T / F

Assuming a, b and c are numbers,

picBox.Print a; b; c or picBox.Print a; b; c;

displays the three numbers one after another separated only by their leading and trailing spaces.

34. T / F

When Format is used with the Currency format string, negative numbers are indicated by parentheses. If you prefer minus signs, use the format string "$#,0.00" instead.

35. T / F

Tab(n) inserts n spaces between two items in a picture box.

36. T / F

The strings produced by Left, Mid and Right are referred to as substrings of the strings from which they were formed.

37. T / F

Chr(x) where x is a charactercan be used to covert a character to ANSI/ASCII and Asc(x) where x is an ANSI/ASCII code can be used to covert the ANSI/ASCII code to a character.

38. T / F

A Dim statement is said to declare a variable. Dim statements are not required.

39. T / F

The statement picBox.Print with no strings or numbers is invalid.

40. T / F

In Visual Basic 5.0, the maximum allowable number of characters in a string is approximately 2 billion.

41. T / F

picAns.Cls; Let a = 5; Let b = 4; picAns.Print a * (2 + b)

is valid code - the four statements will be executed

42. T / F

Printform prints the contents of the form and Printer.NewPage starts a new page.

43. T / F

The Enter key is ANSI value 13.

44. T / F

The statement Close without any reference number is invalid.

45. T / F

You can display the type of variable by positioning the cursor over the word, pressing the right mouse and clicking on QuickInfo.

46. T / F

The KeyPress procedure can alter the character typed into the text box. For instance, if the statement Let KeyAscii = 65 is placed in a KeyPress event procedure, the letter A is displayed when any standard key is pressed.

47. T / F

If txtBox1 is empty, then the statement Let numVar = 3 * txtBox1.Text will result in a answer of 0 since empty will be treated as 0.

48. T / F

In a Dim statement, the term Single derives from single-precision real numbers and is used to specify that only numbers can be assigned to the named variable.

49. T / F

As with numbers, semicolons can be used with strings in picBox.Print statements to suppress carriage returns and line feeds. However, picBox.Print statements do not display leading or trailing spaces along with strings.

50. T / F

Open "filespec" for Input As #n will open a file, Input #n var will read one piece of data from the file and Close #n will close the file. The variable in the input statement should be the same type as the data from the file.