Programming Right From the Start with Visual Basic.NET CHAPTER 6 Hands-on Introduction to Visual Basic.NET True-False Questions 1. VB.NET is the 6th version of Visual Basic created by Microsoft. Answer: False Level: Moderate Section: 6-1 Page: 106 2. GUI stands for Graphical User Interface. Answer: True Section: 6-1 Level: Easy Page: 106 3. The .NET framework is a platform created by Microsoft to facilitate the creation and implementation of Window and Web-based applications. Answer: True Level: Moderate Section: 6-1 Page: 106 4. Although not a full-fledged object-oriented programming language, VB.NET is compatible with other Microsoft languages, such as C++ and C#. Answer: False Level: Easy Section: 6-1 Page: 107 5. A GUI is an example of a computer-user interaction system where the user is forced to respond to the computer requests before the computer allows the user to proceed with the next task. Answer: False Level: Hard Section: 6-1 Page: 106 6. A project and solution are different names for the container that holds program files and forms. Answer: False Level: Moderate Section: 6-2 Page: 109 7. A project can hold multiple solutions. Answer: False Section: 6-2 Level: Easy Page: 109 8. Two types of window are tool windows and document windows. Answer: True Level: Easy Section: 6-2 Page: 108 9. A "Push Pin" can be used to lock down a tool window disabling the Auto Hide. Answer: True Level: Moderate Section: 6-2 Page: 108 6-1 Chapter 6 – Hands-on Introduction to Visual Basic .NET 10. Each Visual Basic Project can have only one application type. Answer: True Level: Hard Section: 6-2 Page: 109 11. Once you create a Visual Basic Project you should create a folder or sub-directory and save all the project files to that location. Answer: False Level: Hard Section: 6-2 Page: 109 12. The Designer Window holds the forms that belong to the project. Answer: True Level: Easy Section: 6-2 Page: 111 13. The bottom part of the Properties window contains a description of the property that is selected. Answer: True Level: Easy Section: 6-2 Page: 111 14. Controls, such as buttons and labels, can be found in the Toolbar. Answer: False Level: Moderate Section: 6-3 Page: 111 15. Painting and double clicking are two ways to put a control on a form. Answer: True Level: Easy Section: 6-3 Page: 111 16. Each type of control has a four letter prefix used in its name. Answer: False Level: Easy Section: 6-3 Page: 112 17. The only way to see the properties of a control is to go to the property window and select the control in the drop down box. Answer: False Level: Moderate Section: 6-3 Page: 113 18. The ampersand symbol (&) is used to create an access key. Answer: True Level: Easy Section: 6-3 Page: 114 19. To activate the access key of a control hold down the control key simultaneously with the letter and the underscore. Answer: False Level: Easy Section: 6-3 Page: 114 20. Comments begin with the double quote symbol (“). Answer: False Section: 6-3 6-2 Level: Easy Page: 114 Chapter 6 – Hands-on Introduction to Visual Basic .NET 21. The code editor will automatically create descriptive comments at the beginning of the project that can be modified. Answer: False Level: Easy Section: 6-3 Page: 114 22. It is better to let the Code Editor automatically create an event procedure declaration stub than to type it in by hand. Answer: True Level: Easy Section: 6-3 Page: 116 23. One reason Windows applications are efficient and intuitive is because there are many ways to accomplish a single task, such as close a program. Answer: True Level: Easy Section: 6-4 Page: 119 24. The disadvantage of using Visual Basic to create a windows application is that the developer uses graphical interface control objects that are re-usable. Answer: False Level: Easy Section: 6-5 Page: 120 25. Visual Basic allows developers to quickly create a Windows application by using pre-built components. Answer: True Level: Easy Section: 6-5 Page: 120 26. Objects typically input, process, and output data or information. Answer: True Level: Moderate Section: 6-5 Page: 120 27. A property contains both methods and objects. Answer: False Section: 6-5 Level: Easy Page: 120 The definition of a class is an object. Answer: False Section: 6-5 Level: Moderate Page: 120 28. 29. Two examples of pre-built graphical objects are Forms and Controls. Answer: True Level: Easy Section: 6-5 Page: 120 30. Graphical objects are the only type of objects available in Visual Basic. Answer: False Level: Easy Section: 6-5 Page: 120 31. Visual Basic is considered a Rapid Application Development system because it is easy to create new Windows application with the reuse of existing objects. Answer: True Level: Easy Section: 6-5 Page: 121 6-3 Chapter 6 – Hands-on Introduction to Visual Basic .NET 32. It is more common for a VB.NET developer to be a creator of objects than a user of objects. Answer: False Level: Easy Section: 6-5 Page: 121 33. The Control class has properties and methods shared by all non-graphical objects. Answer: False Level: Easy Section: 6-6 Page: 122 34. Top, Bottom, Left, and Right are all examples of control class properties. Answer: True Level: Moderate Section: 6-6 Page: 123 35. Cursor, Enabled, Location, and Visible are all examples of control class methods. Answer: False Level: Moderate Section: 6-6 Page: 123 36. Setting Enabled to false will make a text box unresponsive to user interaction, like a label. Answer: True Level: Hard Section: 6-6 Page: 123 37. The Focus method will make it easier to read the text of a control. Answer: False Level: Easy Section: 6-6 Page: 123 38. The Image property of the PictureBox control holds the graphics that are displayed on the form. Answer: True Level: Easy Section: 6-6 Page: 124 39. A Timer Control is used to raise an event at a time interval specified by the Interval property. Answer: True Level: Easy Section: 6-6 Page: 125 40. The component tray is used to hold both visual and non-visual components. Answer: False Level: Easy Section: 6-6 Page: 125 41. User generated events are the only type of events recognized by Visual Basic. Answer: False Level: Easy Section: 6-7 Page: 125 42. Every event in an object must have code written for it. Answer: False Section: 6-7 43. Level: Hard Page: 125 The Form’s Load event only occurs prior to the first time the form is displayed. Answer: True Level: Moderate Section: 6-7 Page: 126 6-4 Chapter 6 – Hands-on Introduction to Visual Basic .NET 44. The only way to write a comment in Visual Basic is to use the single quote (‘). Answer: False Level: Easy Section: 6-7 Page: 126 45. Document remarks are comments found at the beginning of a project file that state the author, purpose, and creation date of the project. Answer: True Level: Easy Section: 6-7 Page: 127 46. The Randomize statement will generate a random single precision value between 0.0 and 1.0. Answer: False Level: Moderate Section: 6-7 Page: 128 47. It is best to start the project development process with the design phase. Answer: False Level: Moderate Section: 6-8 Page: 129 48. The design phase should generate a detailed plan of the software to be developed similar to a blueprint. Answer: True Level: Easy Section: 6-8 Page: 129 49. It is okay if some errors are missed in the implementation phase, they can easily be fixed as a maintenance activity. Answer: False Level: Easy Section: 6-8 Page: 129 50. Testing is an essential practice in any development process whereas documentation is optional. Answer: False Level: Easy Section: 6-8 Page: 130 Multiple Choice Questions 51. Which language is not a true object-oriented programming language? a.) VB.NET b.) VB 6 c.) C++ d.) C# e.) Java Answer: b Section: 6-1 Level: Easy Page: 107 6-5 Chapter 6 – Hands-on Introduction to Visual Basic .NET 52. A GUI: a.) uses buttons, menus, and icons. b.) should be easy for a user to manipulate. c.) stands for Graphic Use Interaction. d.) Both a and b. e.) All of the above. Answer: d Section: 6-1 53. Level: Moderate Page: 106 Visual Studio .NET provides which feature: a.) debugging. b.) application deployment. c.) syntax checking. d.) Both a and b. e.) All of the above. Answer: e Section: 6-2 54. Level: Easy Page: 107 What does IDE stand for? a.) Integrated Development Environment b.) Integrated Design Environment c.) Interior Development Environment d.) Interior Design Environment e.) None of the above. Answer: a Section: 6-2 55. Level: Moderate Page: 107 Which type of project can a developer choose in the New Project dialog box? a.) Visual Basic Projects b.) Visual C# Projects c.) Visual C++ Projects d.) Both a and b. e.) All of the above. Answer: e Section: 6-2 56. Level: Easy Page: 108 Which is not a main component of the Visual Studio IDE? a.) Solution Explorer b.) Tool Box c.) Start Menu d.) Designer Window e.) Properties Window Answer: c Section: 6-2 Level: Easy Page: 110 6-6 Chapter 6 – Hands-on Introduction to Visual Basic .NET 57. Which does the solution explorer not display? a.) Form Properties b.) Reference Folder c.) Form File d.) Assemble File e.) All are part of the solution explorer. Answer: a Section: 6-2 58. Level: Easy Page: 111 Which is true about the name and text property of a control? a.) They are the same when the control is first created. b.) The text property changes to match any changes in the name property. c.) The name property changes to match any changes in the text property. d.) They are never the same unless the programmer makes it that way. e.) They are not allowed to be the same and an error will occur if they are. Answer: a Section: 6-3 59. Level: Hard Page: 113 For which task does the IDE provide multiple ways to accomplish the task? a.) Putting a control on the form b.) Running the program c.) Activating the property window for a control d.) Both a and b. e.) All of the above. Answer: e Section: 6-3 60. Level: Moderate Page: 111 Which are the standard prefixes for the Button and Combo box controls respectively? a.) btn and chb b.) btn and cbo c.) bto and chb d.) bto and cbo e.) cmd and cbo Answer: b Section: 6-3 61. Level: Moderate Page: 113 Which are the standard prefixes for the text box and label controls respectively? a.) tex and lbl b.) tex and lab c.) txb and lbl d.) txb and lab e.) txt and lab Answer: c Section: 6-3 Level: Moderate Page: 113 6-7 Chapter 6 – Hands-on Introduction to Visual Basic .NET 62. Which task is accomplished in the Code editor? a.) Adding forms to the project b.) Adding controls to the form c.) Adding event procedures to the form d.) Both a and b. e.) All of the above. Answer: c Section: 6-3 Level: Moderate Page: 115 63. Which is not a feature of a GUI that makes learning a program easy for users? a.) Online help b.) WYSIWYG formatting c.) Dialog boxes d.) Detailed key strokes and commands e.) Icons Answer: d Level: Easy Section: 6-4 Page: 119 64. An object is composed of: a.) properties. b.) methods. c.) events. d.) Both a and b. e.) All of the above. Answer: e Section: 6-5 65. Level: Easy Page: 120 Which statement about objects is true? a.) One object is used to create one class. b.) One class is used to create one object. c.) One object can create many classes. d.) One class can create many objects. e.) There is no relationship between objects and classes. Answer: d Section: 6-5 66. Level: Moderate Page: 120 Which is not true about forms and controls in Visual Basic? a.) They are pre-built. b.) They are graphical objects. c.) New versions of the classes must be created with each project. d.) Buttons can be created with the drag and drop method. e.) All of the above are true. Answer: c Section: 6-5 Level: Moderate Page: 120 6-8 Chapter 6 – Hands-on Introduction to Visual Basic .NET 67. Which is an example of Visual Basic Objects? a.) Control objects b.) ASP.NET c.) ADO.NET d.) Both a and b. e.) All of the above. Answer: e Section: 6-5 68. Level: Moderate Page: 120 The .Net class library: a.) contains over 25,000 classes. b.) uses namespaces to manage all of the classes. c.) has the System.Form namespace for classes used in Windows-based application. d.) Both a and b. e.) All of the above. Answer: d Section: 6-5 69. Level: Hard Page: 120 Which is not a property of the Common control class? a.) Show b.) BackColor c.) Font d.) ForeColor e.) Name Answer: a Section: 6-6 70. Level: Easy Page: 123 Which property determines whether a control is displayed to the user? a.) Hide b.) Show c.) Visible d.) Enabled e.) Cursor Answer: c Section: 6-6 71. Level: Hard Page: 123 The Button control can be activated: a.) programmatically through the click event. b.) by clicking the button with the mouse. c.) with the form’s DefaultButton property. d.) Both a and b. e.) All of the above. Answer: d Section: 6-6 Level: Moderate Page: 124 6-9 Chapter 6 – Hands-on Introduction to Visual Basic .NET 72. The CancelButton property belongs to which object? a.) Button b.) Form c.) Label d.) TextBox e.) Timer Answer: b Section: 6-6 73. Level: Moderate Page: 124 A click event procedure stud for the label control can be created by: a.) selecting the object and event from the code editor window’s drop-down boxes. b.) typing the code in the code editor window. c.) by double clicking the control. d.) Both a and b. e.) All of the above. Answer: e Section: 6-7 74. Level: Moderate Page: 126 In event-driven programming an event is generated by: a.) the system. b.) a user’s action. c.) the program itself. d.) Both a and b. e.) All of the above. Answer: e Section: 6-7 75. Level: Moderate Page: 125 Which is not a common control event? a.) Click b.) SingleClick c.) DoubleClick d.) MouseMove e.) MouseDown Answer: b Section: 6-7 76. Level: Easy Page: 125 The Tick event is found only in which object? a.) Form b.) Button c.) TextBox d.) Label e.) Timer Answer: e Section: 6-7 Level: Easy Page: 126 6 - 10 Chapter 6 – Hands-on Introduction to Visual Basic .NET 77. The Activated event is found only in which object? a.) Form b.) Button c.) TextBox d.) Label e.) Timer Answer: a Section: 6-7 78. Level: Easy Page: 126 The Rnd statement will generate a(n): a.) decimal value between 0.01 and 1.00. b.) integer value between 0.01 and 1.00. c.) decimal value between 0.0 and 1.0. d.) integer value between 0.0 and 1.0. e.) decimal value between 0.0 and up to 1.0, but not including 1.0. Answer: e Section: 6-7 79. Level: Moderate Page: 127 The analysis phase of software development involves: a.) collecting the requirements about what the program will accomplish. b.) creating a detailed plan on how the program will accomplish the requirements. c.) writing the software with a program such as VB.NET. d.) Both a and b. e.) All of the above. Answer: a Section: 6-8 80. Level: Moderate Page: 129 Which phase of project development typically costs the most? a.) Analysis b.) Design c.) Implementation d.) Maintenance e.) Documentation Answer: d Section: 6-8 Level: Easy Page: 129 Fill in the Blank Questions 81. 82. GUI stands for ____Graphical User Interface___. Level: Easy Section: 6-1 Page: 106 VB.NET, Java, C++ are all examples of ___Object-Oriented___ programming languages. Level: Moderate Section: 6-1 Page: 107 6 - 11 Chapter 6 – Hands-on Introduction to Visual Basic .NET 83. The Microsoft ___.NET Framework___ is a platform layered above the operating system which provides resources for the development and creation of web or desk-top applications. Level: Moderate Section: 6-1 Page: 106 84. The Microsoft integrated development environment that supports the creation of applications in multiple programming languages is called ___Visual Studio .NET___. Level: Moderate Section: 6-2 Page: 107 85. The solution can contain multiple ___projects___. Level: Moderate Section: 6-2 Page: 109 86. If you double click on the title bar of a floating window, it will become ___docked___. Level: Moderate Section: 6-2 Page: 108 87. Just like other Windows applications the ___menu bar___ of the IDE has File, Edit, and Help options. Level: Easy Section: 6-2 Page: 111 88. Controls are found in the ___Toolbox___ window. Level: Easy Section: 6-3 Page: 111 89. The value of the name property should be a(n) __unique___ and ___descriptive___ identifier. Level: Hard Section: 6-3 Page: 112 90. The prefix for the Timer control is ___tmr___. Level: Easy Section: 6-3 Page: 113 The prefix for the Radio button control is ___rad___. Level: Easy Section: 6-3 Page: 113 The prefix for the List control is ___lst___. Level: Easy Section: 6-3 Page: 113 The prefix for the Button control is ___btn___. Level: Easy Section: 6-3 Page: 113 91. 92. 93. 6 - 12 Chapter 6 – Hands-on Introduction to Visual Basic .NET 94. The ___text___ property of a control holds the text displayed on the control. Level: Easy Section: 6-3 Page: 114 95. The Method Drop-down list holds the ___Events___ associated with the control. Level: Moderate Section: 6-3 Page: 116 96. The Class Drop-down list holds the ___Objects___ on the form. Level: Moderate Section: 6-3 Page: 115 97. GUI-based applications have WYSIWYG formatting, which stands for ___What You See Is What You Get___ formatting. Level: Moderate Section: 6-4 Page: 119 98. The Alto computer from Xerox PARC is the first computer to have a complete set of ___GUI___ features. Level: Moderate Section: 6-4 Page: 119 99. A system that supports a developer’s ability to quickly create a new application is called a ___Rapid Application Development (RAD)___ system. Level: Moderate Section: 6-5 Page: 121 100. Using pre-built objects can increase the ___reliability___ of a program because the objects have already been tested. Level: Moderate Section: 6-5 Page: 121 101. To create a new type of object a developer must first write a new ___class___ for the object. Level: Hard Section: 6-5 Page: 120 102. One ___class___ in a program can be used to instantiate many ___objects___. Level: Moderate Section: 6-5 Page: 120 103. Using the ___Stretch___ setting of the SizeMode property in a PictureBox can degrade the quality of an image. Level: Moderate Section: 6-6 Page: 124 104. The Timer control will raise an event when the ___Enabled___ Property is set to true and the ___Interval___ property is greater than zero. Level: Moderate Section: 6-6 Page: 125 6 - 13 Chapter 6 – Hands-on Introduction to Visual Basic .NET 105. The ___Label___ control will display text that the user can not change. Level: Easy Section: 6-6 Page: 124 106. The words displayed on a Button control are found in the ___Text___ property. Level: Easy Section: 6-6 Page: 124 107. The ___Focus___ Method of a control will make it the active control on the form. Level: Moderate Section: 6-6 Page: 123 108. It is best to let the Visual Studio IDE create the ___procedure event stubs___ to avoid typographical errors. Level: Moderate Section: 6-7 Page: 126 109. Programs responding to mouse clicks is an example of ___event-driven___ programming. Level: Moderate Section: 6-7 Page: 125 110. The ___MouseMove___ event of a control occurs when the mouse pointer goes over the control. Level: Moderate Section: 6-7 Page: 125 111. The ___Click___ can be triggered by both a mouse and the Enter key. Level: Easy Section: 6-7 Page: 126 112. The comments associated with a single executable statement are called ___elemental remarks___. Level: Moderate Section: 6-7 Page: 127 113. The three initial phases of software development are ___analysis___, ___design___, and implementation___. Level: Moderate Section: 6-8 Page: 129 114. The three types of software maintenance are ___corrective___, ___adaptive___, and ___enhancement___. Level: Hard Section: 6-8 Page: 129 115. During every phase of software development the developer should include ___testing___ and ___documentation___ activities. Level: Hard Section: 6-8 Page: 130 6 - 14 Chapter 6 – Hands-on Introduction to Visual Basic .NET Essay Questions 116. How do objects improve the reliability of software programs? The key to the reliability of objects is the ability to reuse objects. Once a class for an object is created by Microsoft or any other developer it can be thoroughly tested by the company prior to release. Moreover, because it is used by many different users any hard to find bugs are more likely to be discovered. Thus recent versions of the classes will be stable and less prone to failure. When classes must be created from scratch each time a new application is developed, there is an increased chance the program will contain errors. 117. How is creating a software application analogous to building a house? Both processes require 4 phases: Analysis, Design, Implementation, and Maintenance. The Analysis phase is where information is collected about the requirements and desired features for the program. Potential users and clients are identified and interviewed. The analyst must come up with a summary of the requirements and confirm (test) that the requirements are accurate. A builder must determine the market for their homes and find out what features the typical home owner would like to have. The Design phase is where a detailed plan is made showing how the requirements will be implemented and what is needed to make sure the program functions properly. This will include screen layouts, required modules, pseudocode, etc. This is analogous to the detailed blueprints required for the construction of a house. The Implementation phase is similar to the actual construction of a house. This is when programmers and developers take the detailed Design plan and write the code to actually construct the application. The Maintenance Phase begins as soon as the application is developed. Very few new home owners are completely satisfied with every detail of the new house. Obvious errors in construction must be fixed right away. In a software application this is called the corrective maintenance phase. Some maintenance on a house is done to keep the facilities new and modern such as upgrading old water heaters and furnaces. This is the adaptive maintenance phase where software applications are modified to be compatible with new operating systems, networks, hardware, etc. Once a house has been lived in for a while the owners often decide that new features are needed. Users of a software application will typically decide that there are additional functions they would like from the application. These ‘renovations’ are part of the enhancement maintenance phase. 6 - 15