home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / vbcert / vbdemoq.nsd < prev    next >
Text File  |  1995-06-06  |  9KB  |  151 lines

  1. t01
  2. s01
  3. mult
  4. 1. Suppose x, j and n are globally declared as integers and x initially has a value of 3. If one calls the function MyFunc with the statement j = MyFunc (x) and the following function exists:~     Function MyFunc (n As Integer)~           n=4~          Debug.Print x~     End Function~What number is printed in the Debug window?
  5. a. 0
  6. b. 1
  7. c. 3
  8. d. 4
  9. ans-d
  10. Choice d is correct. By default, arguments are passed by reference and therefore can be changed by a procedure. VBPG p. 169.
  11. t01
  12. s10
  13. multmult
  14. 2. Which of the following describe valid ways to place a command button on an MDI form?
  15. a. place the command button directly on the MDI form
  16. b. draw a picture box on the MDI form, then draw the command button on the picture box
  17. c. draw a frame on the MDI form, then draw the command button on the frame
  18. d. no controls may be placed directly on an MDI form
  19. ans-b
  20. Only choice b is correct. MDI forms can contain only menu and picture box controls and custom controls that have an Align property. Therefore, one must place the command button on a picture box drawn on the MDI form. VBLR p. 365.
  21. t01
  22. s06
  23. multmult
  24. 3. Which are true of passing a property to a DLL?
  25. a. the property can be passed directly to the DLL by value
  26. b. an intermediate value must be used to pass a property to a DLL by value
  27. c. the property can be passed directly to the DLL by reference
  28. d. an intermediate value must be used to pass a property to a DLL by reference
  29. ans-ad
  30. Only choices a and d are correct. To pass a property by reference to a DLL, one must first assign the property to a string variable. VBPG p. 569.
  31. t01
  32. s02
  33. mult
  34. 4. Which of the following will NOT reduce the amount of stack space used by Visual Basic code?
  35. a. using global variables instead of passing values as arguments to procedures
  36. b. using the integer data type instead of the variant data type for local variables
  37. c. replacing local variable-length strings with local fixed-length strings
  38. d. declaring procedures with the Static keyword
  39. ans-c
  40. Choice c is correct. Local fixed-length string variables consume one byte on the stack for each character, while local variable-length strings always consume only four bytes on the stack per string. VBPG pp. 263-264.
  41. t01
  42. s08
  43. mult
  44. 5. Which statement is true of implementing transaction processing with multiple databases?
  45. a. transaction processing will function against all open databases at once
  46. b. transaction processing will function against only the databases that are open and specified
  47. c. one may roll back the transactions in one database without rolling back the pending transactions in all other open databases
  48. d. there is no limit on the number of transactions one may have pending
  49. ans-a
  50. Choice a is correct. Transaction operations are functionally global once one's application starts. Therefore, transaction processing will function against all open databases at once. VBPFB2 p. 107.
  51. t01
  52. s03
  53. mult
  54. 6. Suppose procedure A contains error handling code containing the statement Resume Next and procedure B contains no error handling code. What will happen if procedure A calls procedure B and procedure B contains an error?
  55. a. the error handling code in procedure A is invoked and the line in procedure A following the call to procedure B is executed
  56. b. the error handling code in procedure A is invoked and the line in procedure B following the error is executed
  57. c. the error handling code in procedure A is invoked and the call to procedure B is re-executed
  58. d. the error is not trapped since procedure B contains no error handling code
  59. ans-a
  60. Choice a is correct. If an error occurs, Visual Basic searches backward through the pending procedures. If Resume Next is encountered, the statement executed is in the procedure where the error-handling procedure is found. VBPG pp. 244-245.
  61. t01
  62. s07
  63. mult
  64. 7. Suppose a command string is sent from a destination application to a source application in a DDE conversation using the LinkExecute method. What event is triggered in the active form in the source application?
  65. a. LinkExecute
  66. b. LinkReceive
  67. c. LinkOpen
  68. d. LinkProcess
  69. ans-a
  70. Choice a is correct. The command string is passed as an argument to the source application when the destination application executes the LinkExecute method. The LinkExecute event is triggered in the source application. VBLR pp. 318-319.
  71. t01
  72. s02
  73. mult
  74. 8. Suppose MySub is declared as follows:~     Sub MySub (j$)~How would one pass the Caption property of Label1 to this procedure?
  75. a. MySub (Label1.Caption)
  76. b. MySub Label1.Caption
  77. c. Call MySub (Label1.Caption)
  78. d. the value of Label1.Caption must be assigned an intermediate string value and then passed
  79. ans-a
  80. Choice a is correct. Label1.Caption must be enclosed in parentheses before it is passed so that an expression is passed rather than a data type. VBPG p. 169. If Call is used, an extra set of parentheses is required. VBLR p. 55. A parameter type mismatch occurs if Label1.Caption is not passed correctly.
  81. t02
  82. s04
  83. mult
  84. 9. Suppose a label control is dragged over an image control and then dropped. Which events are generated?
  85. a. the image control's DragDrop event, only
  86. b. the label control's DragDrop event, only
  87. c. both the label's DragDrop event and the image control's DragDrop event
  88. d. neither the label's DragDrop event nor the image control's DragDrop event
  89. ans-a
  90. Choice a is correct. The DragDrop event occurs for a control as a result of a source control being dragged over the control and releasing the mouse button. VBLR p. 151.
  91. t02
  92. s04
  93. mult
  94. 10. Suppose the focus changes from Text1 on Form1 to Text1 on Form2. Which event occurs first?
  95. a. the GotFocus event for Text1 on Form2
  96. b. the LostFocus event for Text1 on Form1
  97. c. the GotFocus event for Form2
  98. d. the LostFocus event for Form1
  99. ans-b
  100. Choice b is correct. The LostFocus event for Text1 on Form1 occurs before any other event listed. VBLR p. 357.
  101. t02
  102. s01
  103. mult
  104. 11. Which statement should one place in the general declarations section of a form to require that variables be declared before they are used?
  105. a. Variables Explicit
  106. b. Option Explicit
  107. c. this is the default situation
  108. d. this is not possible
  109. ans-b
  110. Choice b is correct. The Option Explicit statement causes Visual Basic to require that variables be declared before they are used. This helps one avoid mistyping the name of an existing variable. Option Explicit can be automatically included by setting the Require Variable Declaration option to Yes under the Environment menu. VBLR p. 423.
  111. t02
  112. s09
  113. mult
  114. 12. Which syntax could one use to remove a picture from an image control named Image1?
  115. a. Image1.Clear
  116. b. Image1.Clr
  117. c. Image1.Picture = LoadPicture("")
  118. d. Image1.Picture = ""
  119. ans-c
  120. Choice c is correct. LoadPicture can be used to remove a picture at run time without replacing it with another picture. VBPG p. 325. The Cls method may also be used to clear an image control. VBLR p. 79.
  121. t02
  122. s11
  123. mult
  124. 13. In order to specify a Help file for an application:
  125. a. one may specify the Help file using the Project Options dialog, only
  126. b. one may specify the Help file at run time, only
  127. c. one may specify the Help file either at run time or by using the Project Options dialog
  128. d. one may specify the Help file neither at run time nor by using the Project Options dialog
  129. ans-c
  130. Choice c is correct. One may set the Help file at design time by selecting Options, Project and then entering the Help file. To set the Help file at run time, set the App.HelpFile property to the name of the Help file. VBPFB1, Help Compiler Guide, p. 158.
  131. t02
  132. s10
  133. mult
  134. 14. Which statement is true regarding loading MDI parent and child forms?
  135. a. if an MDI form is loaded, its child forms are automatically loaded
  136. b. a child form cannot be specified as an application's startup form
  137. c. if a child form is loaded, its parent form (the MDI form) is automatically loaded but not displayed
  138. d. if a child form is loaded, its parent form (the MDI form) is automatically loaded and displayed
  139. ans-d
  140. Choice d is correct. Loading an MDI form does not cause its child forms to be loaded. However, loading a child form causes its parent form to load and be displayed. A child form may be specified as the startup form. VBPG. p. 303.
  141. t03
  142. s05
  143. mult
  144. 15. Which syntax is used to populate a combo box?
  145. a. control.AddItem item [, index]
  146. b. control.AddNew item
  147. c. control.Add item [, index]
  148. d. control.ListAdd item index
  149. ans-a
  150. Choice a is correct. The AddItem method is used to add items to a combo box. Specifying an index is optional. VBLR p.27.
  151.