VB 2005 Sample Final Exam Questions
Transcription
VB 2005 Sample Final Exam Questions
VB 2005 Sample Final Exam Questions True/False - Indicate whether the statement is true or false and mark the answer on the ScanTron sheet. ____ 1. A printer is a peripheral device. ____ 2. Unicode is a digital code used to represent letters of the alphabet and symbols. ____ 3. Real numbers are numbers that contain decimal points. ____ 4. A Visual Basic project consists of several related files. ____ 5. A Windows application interface includes at least one form. ____ 6. An application with menus includes a MainMenu component. ____ 7. It is good programming style to begin MenuItem object names with mnu. ____ 8. Selecting from an AutoList reduces the chance of typing errors in code. ____ 9. More than one radio button in a set can be selected at a time. ____ 10. Comments affect the way statements execute. ____ 11. The statement lblMessage.Text="Smile!" sets the Text property of the lblMessage Label object to Smile!. ____ 12. A variable is a named memory location that stores a value. ____ 13. A numeric variable is automatically initialized to 1 in Visual Basic. ____ 14. A Single is a numeric value that can contain a decimal portion. ____ 15. 5.8=sngLength is a variable assignment statement that assigns the value 5.8 to the variable sngLength. ____ 16. An example of a Visual Basic keyword is Single. ____ 17. Boolean variables are initialized to True. ____ 18. A local declaration allows a variable to be used anywhere in the module or form. ____ 19. Trying to change the value of a declared constant with an assignment statement will generate an error. ____ 20. It is good programming style to keep the scope of variable declarations as wide as possible. ____ 21. The indentation used in an If…Then…Else statement has an effect on the execution of the statement. ____ 22. A Select…Case statement uses the result of an expression to determine which block of code to execute. ____ 23. Numbers generated by Rnd() are real numbers with a decimal portion. ____ 24. An algorithm is a set of steps that tell how to solve a problem. ____ 25. A static variable is declared with the keyword Dim. ____ 26. In logical expressions, And is evaluated before Not. ____ 27. A counter variable is a variable storing a number that is incremented by a constant value. ____ 28. A set of statements that perform a task over and over again based on a condition is called a loop. ____ 29. Repeating a set of statements is called iteration. ____ 30. The following statements would create an infinite loop. Dim intX As Integer = -2 Do While intX < 0 intX = intX + 1 Loop ____ 31. The For…Next statement executes a set of statements a fixed number of times. ____ 32. The Unicode value for an uppercase letter is the same for the corresponding lowercase letter. ____ 33. The order of arguments passed to a procedure needs to correspond to the order of the parameters declared in the procedure. ____ 34. The number of arguments in a procedure call must match the number of parameters in the procedure declaration. ____ 35. Only ByVal parameters should be declared in a function. ____ 36. The statement Me.lblAnswer.Text = Math.Sqrt(–36) generates a run-time error. ____ 37. The Val() function returns 0 when a string begins with $. ____ 38. A timer object is used to execute code at specified intervals. ____ 39. Using the FileStream class requires the Imports System.IO statement at the top of the code module. ____ 40. An MDI application is a multiple-document interface application. ____ 41. In order to designate a form as a parent form, the Form control IsMdiContainer property is set to False. ____ 42. The Compare() method of the String class can be used to alphabetically compare strings without considering the case of the strings. Multiple Choice - Identify the letter of the choice that best completes the statement or answers the question and mark you answer on the ScanTron sheet. ____ 43. RAM a. is memory where data and instructions are stored permanently. b. is memory where data and instructions are stored temporarily. c. is a set of circuits that connect the CPU to other components. d. is the computer’s clock rate. ____ 44. A program is a list of instructions a. that makes the computer think. b. written in a special language that the computer understands. c. written in English that tells the computer what to do. d. written in Basic that makes the computer think. ____ 45. Which element allows the user to enter values? a. buttons c. radio buttons b. check boxes d. text boxes ____ 46. Which is not a property of the Label control? a. Name c. Font b. Text d. Style ____ 47. Converting a program to a language the computer understands is a process called a. closing. c. terminating. b. conversion. d. compiling. ____ 48. A set of instructions that tells the computer how to perform a specific task is called a. a form. c. objects. b. an interface. d. program code. ____ 49. Which statement is used to stop program execution? a. End c. Stop Halt b. d. Quit ____ 50. Which statement indicates the end of an event procedure? a. End c. End Procedure End Sub b. d. Sub ____ 51. Which object is used to group related radio buttons? a. a Label object c. a MainMenu object b. a GroupBox object d. a Button object ____ 52. Which character begins a comment? a. a colon (:) c. a single quotation mark (') d. a question mark (?) b. a double quotation mark (") ____ 53. Which object allows users to enter values? a. a Label object c. a TextBox object b. a Button object d. a MainMenu object ____ 54. A label placed near a text box that describes its contents or purpose is called a a. text box label. c. question. b. prompt. d. content label. ____ 55. The TextBox control Text property a. sets the alignment of the text relative to the text box. b. sets the alignment of the text relative to the form. c. determines what text is displayed in the text box. d. identifies a control for the programmer. ____ 56. Which is true about identifier names? a. an identifier must begin with a letter c. an identifier can contains spaces b. an identifier must contain a digit d. an identifier can be a keyword ____ 57. Which is not a Visual Basic data type? a. Single c. Integer b. Currency d. Decimal ____ 58. Which data type should be used to represent values with a decimal portion? a. Single c. Short b. Integer d. Boolean ____ 59. Which data type should be used to represent single characters? a. Boolean c. String b. Char d. Long ____ 60. The statement sngWeight=Val("Forty-eight kilograms") returns a value of a. forty-eight. c. 0. b. 48. d. 48 kilograms. ____ 61. Which statement should be used to decide among three or more actions? a. If…Then statement c. nested If…Then…Else statement b. If…Then…Else statement d. If…Then…ElseIf statement ____ 62. Which statement generates random numbers in the range from 10 to 50? a. Int(41 * Rnd()) b. Int(10 * Rnd()) + 50 c. Int(50 * Rnd()) + 10 d. Int(41 * Rnd()) + 10 ____ 63. Which is not a logical operator? a. And c. Not b. Or d. If ____ 64. Which statement correctly updates the counter intIdentifier? a. intIdentifier = intIdentifier + 1 b. value = intIdentifier + intIdentifier c. intIdentifier = value + 1 d. value = intIdentifier + value ____ 65. Which character can be used to continue a statement onto the next line? a. an asterisk (*) c. a hyphen (-) b. an underscore (_) d. an exclamation mark (!) ____ 66. Which statement displays Name in the title bar of an input box? a. strName = InputBox("Name") b. strName = InputBox("Enter your Name", "Name") c. InputBox("Enter your Name", Name) = strName d. strName = InputBox("Name", "Enter your Name") ____ 67. Which function is used to convert a numeric entry in an input box to a number? a. Convert() c. Val() b. Number() d. String() ____ 68. Which method of the String class removes all spaces from the beginning and end of a String object? a. Remove c. TrimEnd b. Trim d. PadLeft ____ 69. The vbCrLf constant a. left aligns text. b. places a string into the next field of eight characters. c. is used to move text to a new line. d. places text in the center of a form. ____ 70. Which is not an Image file format? a. GIF c. TOP b. JPG d. BMP ____ 71. The arguments in a Call statement must a. correspond in order to the parameters in the procedure being called. b. have the same names as the corresponding parameters in the procedure being called. c. correspond to ByRef parameters only. d. correspond to ByVal parameters only. ____ 72. Function procedures a. perform several related tasks. b. alter arguments after they have been passed. c. must be called from another procedure using the Call statement. d. perform a specific task and then return a value. ____ 73. Which statement evaluates to True? a. IsNumeric("234") c. IsNumeric("3+6") ____ 74. ____ 75. ____ 76. ____ 77. ____ 78. ____ 79. ____ 80. b. IsNumeric("xyz") d. IsNumeric("92R5") Which function is used to determine the monthly payment on a mortgage loan? a. FV() c. Principal() b. Pmt() d. PV() Which ListBox control class method is used to delete the contents of a list box? a. Items.Add() c. Items.Delete() b. Items.Remove() d. Items.Clear() Which property is set to False to make an object appear dimmed? a. TaxIndex c. Visible b. Enabled d. Hide In an array, the index of the first item is a. 0 c. 2 b. 1 d. a Which statement changes the size of an existing array at run time? a. the Dim statement c. the Size statement b. the ReDim statement d. the Element statement The Timer control Interval property is specified in a. milliseconds. c. minutes. b. seconds. d. hours. Which sorting algorithm starts at the first element of a list of items and proceeds sequentially to the last, comparing each element with the next? a. bubble sort c. insertion sort b. selection sort d. sequential sort VB 2005 Sample Final Exam Questions - Answer Section TRUE/FALSE 1. ANS: 2. ANS: 3. ANS: 4. ANS: 5. ANS: 6. ANS: 7. ANS: 8. ANS: 9. ANS: 10. ANS: 11. ANS: 12. ANS: 13. ANS: 14. ANS: 15. ANS: 16. ANS: 17. ANS: 18. ANS: 19. ANS: 20. ANS: 21. ANS: 22. ANS: 23. ANS: 24. ANS: 25. ANS: 26. ANS: 27. ANS: 28. ANS: 29. ANS: 30. ANS: 31. ANS: 32. ANS: 33. ANS: 34. ANS: 35. ANS: 36. ANS: 37. ANS: 38. ANS: 39. ANS: TOP: 40. ANS: 41. ANS: 42. ANS: T PTS: 1 REF: T PTS: 1 REF: T PTS: 1 REF: T PTS: 1 REF: T PTS: 1 REF: T PTS: 1 REF: T PTS: 1 REF: T PTS: 1 REF: F PTS: 1 REF: F PTS: 1 REF: T PTS: 1 REF: T PTS: 1 REF: F PTS: 1 REF: T PTS: 1 REF: F PTS: 1 REF: T PTS: 1 REF: F PTS: 1 REF: F PTS: 1 REF: T PTS: 1 REF: F PTS: 1 REF: F PTS: 1 REF: T PTS: 1 REF: T PTS: 1 REF: T PTS: 1 REF: F PTS: 1 REF: F PTS: 1 REF: T PTS: 1 REF: T PTS: 1 REF: T PTS: 1 REF: F PTS: 1 REF: T PTS: 1 REF: F PTS: 1 REF: T PTS: 1 REF: T PTS: 1 REF: T PTS: 1 REF: T PTS: 1 REF: T PTS: 1 REF: T PTS: 1 REF: T PTS: 1 REF: The FileStream and StreamReader Classes T PTS: 1 REF: F PTS: 1 REF: T PTS: 1 REF: Section 1.10 Section 1.12 Section 1.13 Section 3.3 Section 3.4 Section 3.7 Section 3.7 Section 3.12 Section 3.13 Section 3.14 Section 3.11 Section 4.1 Section 4.1 Section 4.1 Section 4.2 Section 4.5 Section 4.6 Section 4.8 Section 4.4 Section 4.8 Section 5.3 Section 5.6 Section 5.8 Section 5.9 Section 5.10 Section 5.11 Section 5.13 Section 6.1 Section 6.1 Section 6.3 Section 6.7 Section 6.11 Section 7.3 Section 7.3 Section 7.9 Section 8.1 Section 8.6 Section 10.6 Section 12.4 TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: The Personal Computer Number Systems Storing Data in Memory Creating a New Project The Windows Form The MainMenu Control The MainMenu Control Using AutoList The RadioButton Control Commenting Code Assignment Statements Variables Variables Variables Variable Assignment Choosing Identifiers Built-In Data Types Scope Using Named Constants Scope The If…Then…Else Statement The Select…Case Statement Generating Random Numbers Algorithms Static Variables Logical Operators Counter Variables Looping Looping Infinite Loops The For…Next Statement Unicode Value Parameters Value Parameters Function Procedures The Math Class Processing Business Data The Timer Control Section 14.1 Section 14.2 Section 6.12 TOP: MDI Applications TOP: Creating an MDI Application TOP: Comparing Strings MULTIPLE CHOICE 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: ANS: B B D D D D A B B C C B C A B A B C D D D A B B C B C C A D A B D B A B A A PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: PTS: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: REF: Section 1.10 Section 1.4 Section 2.4 Section 3.5 Section 3.6 Section 3.9 Section 3.10 Section 3.10 Section 3.13 Section 3.14 Section 4.3 Section 4.3 Section 4.3 Section 4.5 Section 4.6 Section 4.6 Section 4.6 Section 4.3 Section 5.5 Section 5.8 Section 5.11 Section 5.13 Section 5.15 Section 6.4 Section 6.4 Section 6.8 Section 6.9 Section 7.2 Section 7.3 Section 7.9 Section 8.2 Section 8.5 Section 8.7 Section 8.9 Section 9.1 Section 9.6 Section 10.6 Section 13.1 TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: TOP: The Personal Computer The Stored Program Computer Dialog Boxes The Label Control Saving and Running an Application Program Code The Event Procedure The Event Procedure The RadioButton Control Commenting Code Obtaining a Value from the User Obtaining a Value from the User Obtaining a Value from the User Choosing Identifiers Built-In Data Types Built-In Data Types Built-In Data Types Obtaining a Value from the User The If…Then…ElseIf Statement Generating Random Numbers Logical Operators Counter Variables The Line-Continuation Character Using an Input Box Using an Input Box The String Class String Concatenation The PictureBox Control Value Parameters Function Procedures The IsNumeric() Function Business Functions The ListBox Control Windows Application Standards Arrays Dynamic Arrays The Timer Control The Bubble Search