1 tom.com



chapter 10

The Professional Touch

True-False Questions

1. A good program will have menu items in unique locations to distinguish itself from other programs.

Answer: False Level: Easy

Section: 10-1 Page: 250

2. The main menu is a vertical menu.

Answer: False Level: Easy

Section: 10-1 Page: 250

3. The About option is typically found in the Help Menu.

Answer: True Level: Moderate

Section: 10-1 Page: 250

4. The only way to access the main menu is by using the mouse.

Answer: False Level: Easy

Section: 10-1 Page: 250

5. When the main menu control is added to a form, it resides in the component tray.

Answer: True Level: Moderate

Section: 10-1 Page: 251

6. A dialog box is used to enter the text and name of a menu item.

Answer: False Level: Moderate

Section: 10-1 Page: 252

7. Each menu item is an object with its own click event.

Answer: True Level: Moderate

Section: 10-1 Page: 252

8. It is best to rename menu items before writing code for the event procedure.

Answer: True Level: Moderate

Section: 10-1 Page: 252

9. The AddWindowsForm menu item is found in the Project Menu of the IDE.

Answer: True Level: Hard

Section: 10-1 Page: 254

10. Standard Dialog boxes provide functionality familiar to users of Microsoft products.

Answer: True Level: Easy

Section: 10-2 Page: 255

11. The only way to add a dialog box to a program is to add a component to the component tray.

Answer: False Level: Moderate

Section: 10-2 Page: 255

12. Implementing a standard dialog box in a program requires a lot of effort.

Answer: False Level: Moderate

Section: 10-2 Page: 255

13. Opening and saving files are two functions provided by dialog boxes.

Answer: True Level: Easy

Section: 10-2 Page: 255

14. Viewing Fonts and Monitor Display Size are two functions provided by dialog boxes.

Answer: False Level: Moderate

Section: 10-2 Page: 255

15. Before displaying a color dialog box, a new dialog variable must be declared in a sub procedure.

Answer: True Level: Moderate

Section: 10-2 Page: 255

16. The font dialog control has a property called Style.

Answer: False Level: Hard

Section: 10-3 Page: 256

17. After selecting a color in a color dialog box, the color of all the text on a form will automatically change to the new color.

Answer: False Level: Moderate

Section: 10-3 Page: 257

18. The Color dialog box allows the user to create custom colors.

Answer: True Level: Easy

Section: 10-3 Page: 256

19. The Font dialog box allows the user to select different sizes of the font.

Answer: True Level: Easy

Section: 10-3 Page: 256

20. A Color dialog box can be displayed with the ShowColorDialog method.

Answer: False Level: Moderate

Section: 10-3 Page: 256

21. A Font dialog box can be displayed with the ShowDialog method.

Answer: True Level: Moderate

Section: 10-3 Page: 256

22. The Open File Dialog box will display a directory for selecting files.

Answer: True Level: Easy

Section: 10-4 Page: 258

23. The Open File and Save File dialog controls use different properties for storing file and directory information.

Answer: False Level: Easy

Section: 10-4 Page: 258

24. The directory displayed when the Open File dialog box opens is stored in the InitialDirectory property.

Answer: False Level: Moderate

Section: 10-4 Page: 259

25. Once a file is selected in the dialog box the control will then transfer the data to or from the file.

Answer: False Level: Moderate

Section: 10-4 Page: 259

26. The DisplaySaveDialog method will open the Save File dialog box.

Answer: False Level: Moderate

Section: 10-4 Page: 258

27. The StreamReader is used to read data into a file.

Answer: False Level: Moderate

Section: 10-4 Page: 259

28. If the file specified in the ‘path’ parameter of the CreateText function is not valid an error will occur.

Answer: False Level: Moderate

Section: 10-4 Page: 259

29. The OpenText function is used before data is read from a file.

Answer: True Level: Moderate

Section: 10-4 Page: 259

30. The System.IO Namespace must be imported into the program to allow the use of StreamWriter and StreamReader.

Answer: True Level: Moderate

Section: 10-4 Page: 260

31. The StreamWriter flush method is used to clear the buffers of the current stream.

Answer: True Level: Easy

Section: 10-4 Page: 259

32. The user can select which page of a document to print with the PrintDialog control.

Answer: True Level: Easy

Section: 10-5 Page: 261

33. The PrintDialog control must be added to the component tray prior to displaying the dialog box.

Answer: False Level: Moderate

Section: 10-5 Page: 264

34. Every PrintDialog Object has a Document property.

Answer: True Level: Easy

Section: 10-5 Page: 262

35. The PrintPreview dialog Control is used to set up the margins of a document.

Answer: False Level: Moderate

Section: 10-5 Page: 262

36. The PrintPreview dialog Control does not have a Document property.

Answer: False Level: Easy

Section: 10-5 Page: 262

37. Setting the PrintPreview’s AntiAliasing property to true will make the text look smoother.

Answer: True Level: Moderate

Section: 10-5 Page: 262

38. The PrintPage event is raised once when the Print Method of a PrintDocument is called.

Answer: False Level: Moderate

Section: 10-5 Page: 262

39. The current Windows Media Player control can play video but not sound files.

Answer: False Level: Easy

Section: 10-6 Page: 265

40. The Windows Media Player control is not a standard element in the toolbox.

Answer: True Level: Easy

Section: 10-6 Page: 265

Multiple Choice Questions

41. Which menu item is not typically found in the File Menu?

a.) Close

b.) Copy

c.) Exit

d.) Print

e.) Save

Answer: b Level: Easy

Section: 10-1 Page: 250

42. What is the name of the control for putting menus on a form?

a.) FormMenu

b.) MenuForm

c.) MenuControl

d.) MainMenu

e.) Menu

Answer: d Level: Easy

Section: 10-1 Page: 251

43. The standard prefix for a menu item is:

a.) men.

b.) meu.

c.) mit.

d.) mni.

e.) mnu.

Answer: e Level: Easy

Section: 10-1 Page: 254

44. Which menu object property places a check mark in the display of the menu text?

a.) Check

b.) Checked

c.) CheckMark

d.) CheckOn

e.) RadioCheck

Answer: b Level: Moderate

Section: 10-1 Page: 253

45. Which symbol creates an access key in the text of a menu item?

a.) @

b.) #

c.) $

d.) %

e.) &

Answer: e Level: Moderate

Section: 10-1 Page: 252

46. Which is not a standard dialog box?

a.) ColorDialog

b.) FontDialog

c.) OpenDialog

d.) PrintDialog

e.) ZoomDialog

Answer: e Level: Easy

Section: 10-2 Page: 255

47. Why are standard dialog boxes used?

a.) They are easy to create.

b.) They provide functionality familiar to users.

c.) Developers can create their own versions of Dialog boxes.

d.) Both a and b.

e.) All of the above.

Answer: d Level: Moderate

Section: 10-2 Page: 255

48. How are dialog boxes implemented in a program?

a.) A dialog box is generated programmatically.

b.) A dialog control is placed in the component tray.

c.) A dialog control is placed on the form.

d.) Both a and b.

e.) All of the above.

Answer: d Level: Moderate

Section: 10-2 Page: 255

49. The standard prefix for a dialog control is:

a.) dal.

b.) dia.

c.) dil.

d.) dlc.

e.) dlg.

Answer: e Level: Easy

Section: 10-3 Page: 257

50. What is the method used to activate the color dialog box?

a.) ActivateDialog

b.) DisplayDialog

c.) ExhibitDialog

d.) ShowDialog

e.) StartDialog

Answer: d Level: Moderate

Section: 10-3 Page: 256

51. The name of the class used to programmatically create a color dialog box is:

a.) Color

b.) ColorBox

c.) ColorDialog

d.) ColorDisplay

e.) ColorDisplayBox

Answer: c Level: Moderate

Section: 10-3 Page: 257

52. The name of the class used to programmatically create a font dialog box is:

a.) Font.

b.) FontBox.

c.) FontDialog.

d.) FontDisplay.

e.) FontDialogBox.

Answer: c Level: Moderate

Section: 10-3 Page: 258

53. Which OpenFileDialog control property specifies the choices in the “Files of type” dropdown box?

a.) FileName

b.) FileNames

c.) FileType

d.) Filter

e.) FilterIndex

Answer: d Level: Moderate

Section: 10-4 Page: 258

54. Which property is the same in the OpenFileDialog and the SaveFileDialog control?

a.) FileName

b.) Filter

c.) InitialDirectory

d.) Both a and b.

e.) All of the above.

Answer: e Level: Moderate

Section: 10-4 Page: 259

55. Which method is found in both the StreamReader and StreamWriter class?

a.) Close

b.) Peak

c.) Flush

d.) Both a and b.

e.) All of the above.

Answer: a Level: Easy

Section: 10-4 Page: 259

56. The StreamReader and StreamWriter class are both subclasses of which class?

a.) IO

b.) Stream

c.) StreamIO

d.) Both a and b.

e.) All of the above.

Answer: b Level: Hard

Section: 10-4 Page: 260

57. Which dialog control allows the user to zoom in on a document?

a.) PrintDialog

b.) PrintPreview

c.) PageSetupDialog

d.) Both a and b.

e.) All of the above.

Answer: b Level: Moderate

Section: 10-5 Page: 262

58. Which dialog control has a Document property?

a.) PrintDialog

b.) PrintPreview

c.) PageSetupDialog

d.) Both a and b.

e.) All of the above.

Answer: e Level: Easy

Section: 10-5 Page: 264

59. Which object must be assigned to the Document property?

a.) Document

b.) DocumentPage

c.) DocumentPrint

d.) PageDocument

e.) PrintDocument

Answer: e Level: Hard

Section: 10-5 Page: 262

60. When is the PrintPage event activated?

a.) When the PrintDialog control is displayed.

b.) When an assignment is made to the Document property.

c.) The first time the Print method is called.

d.) Every time a page is printed after the Print method is called.

e.) None of the above.

Answer: d Level: Moderate

Section: 10-5 Page: 262

61. Which controls can activate the PrintPage event?

a.) PrintDialog

b.) PrintPreview

c.) PageSetupDialog

d.) Both a and b.

e.) All of the above.

Answer: d Level: Moderate

Section: 10-5 Page: 263

62. Which type of file can be played with the Windows Media Player control?

a.) MPEG

b.) AVI

c.) WAV

d.) Both a and b.

e.) All of the above.

Answer: e Level: Easy

Section: 10-6 Page: 265

63. The Windows Media Player control:

a.) is located in the toolbox by default.

b.) is located in the toolbar.

c.) can be added to the toolbar.

d.) Both a and b.

e.) All of the above.

Answer: c Level: Moderate

Section: 10-6 Page: 265

64. The Windows Media Player control can:

a.) display video output.

b.) create audio output.

c.) generate tactile output.

d.) Both a and b.

e.) All of the above.

Answer: d Level: Moderate

Section: 10-6 Page: 265

65. Which Windows Media Player control property will hide the player from user's view?

a.) Anchor

b.) FileName

c.) Location

d.) ShowControl

e.) Visible

Answer: e Level: Moderate

Section: 10-6 Page: 266

Fill in the Blank Questions

66. The ___MainMenu___ control will add a standard menu bar at the top of a form.

Level: Easy

Section: 10-1 Page: 251

67. The ___ampersand (&)___ symbol will create an access key in the menu text.

Level: Easy

Section: 10-1 Page: 252

68. The shortcut keys used to access a menu item will only be displayed if the ___ShowShortcut___ property is set to true.

Level: Moderate

Section: 10-1 Page: 253

69. The ___click___ event of the menu object is activated by the user selecting the menu item.

Level: Easy

Section: 10-1 Page: 252

70. The AddNewItem dialog box is used to add a new ___form___ to a project.

Level: Hard

Section: 10-1 Page: 254

71. Both the ___MainMenu___ and any of the standard ___dialog box___ controls can be added to a program by selecting controls from the toolbox.

Level: Hard

Section: 10-2 Page: 255

72. The ___SaveFileDialog___ control is familiar to any user who ever saved a file in the Microsoft Word program.

Level: Moderate

Section: 10-2 Page: 255

73. The ___FontDialog___ control allows a user to choose what font will be displayed on the form of a program.

Level: Easy

Section: 10-3 Page: 255

74. The ___ColorDialog___ control allows a user to choose a color that can be applied to any text box or label.

Level: Easy

Section: 10-3 Page: 255

75. The ___ShowDialog___ method will display any dialog box.

Level: Easy

Section: 10-3 Page: 255

76. The font that a user selects in a Font Dialog box is found as a(n) ___property___ of the dialog object.

Level: Moderate

Section: 10-3 Page: 256

77. The read method belongs to the ___StreamReader___ class.

Level: Easy

Section: 10-4 Page: 259

78. The WriteLine method belongs to the ___StreamWriter___ class.

Level: Easy

Section: 10-4 Page: 259

79. The ___InitialDirectory___ property determines which directory will be active when the open file dialog box is first displayed.

Level: Moderate

Section: 10-4 Page: 258

80. The ___ShowDialog___ method will display the Save File dialog control.

Level: Easy

Section: 10-4 Page: 258

81. The ___peek___ method will return the next character in a stream but will not advance to the next character.

Level: Moderate

Section: 10-4 Page: 259

82. The ___close___ method should be called when the program is done reading from or writing to a stream.

Level: Hard

Section: 10-4 Page: 261

83. The ___PrintDialog___ control allows the user to select which printer will print a document.

Level: Easy

Section: 10-5 Page: 261

84. Setting the ___AntiAliasing___ property of the PrintPreview control to true will smooth out the text.

Level: Moderate

Section: 10-5 Page: 262

85. The ___PrintDocument___ object must be assigned to the Document property.

Level: Moderate

Section: 10-5 Page: 262

86. The page orientation of a document can be changed with the ___PageSetupDialog___ control.

Level: Moderate

Section: 10-5 Page: 262

87. The ___PrintDocument___ object requires the System.Drawing.Printing namespace to be imported into the program.

Level: Hard

Section: 10-6 Page: 262

88. The ___FileName___ property of the Windows Media Player holds the file being run by the player.

Level: Easy

Section: 10-6 Page: 265

89. The ___EndOfStream___ event will activate when the Windows Media Player finishes running a file.

Level: Moderate

Section: 10-6 Page: 268

90. The files being played by the Windows Media Player should be located in the project’s ___bin___ directory.

Level: Hard

Section: 10-6 Page: 268

Essay Questions

91. Write the code to create a form called frmAbout and display the form that has an about message typed in a label on the form.

Write the code to create a dialog box called dlgColor and will allow the user to change the foreground color of the label lblMessage.

What are the similarities and differences between these two sets of code?

Dim myfrmAbout As New frmAbout()

myfrmAbout.ShowDialog() '.Show is also acceptable

myfrmAbout.Dispose()

Dim dlgColor As New ColorDialog()

dlgColor.ShowDialog()

lblMessage.ForeColor = dlgColor.Color

In both sets of code the first statement creates an instance of an object based on a class, using the ‘New’ keyword. Next both objects are displayed in the modal format, where the object must be closed before any other part of the program can be run.

The two sets of code are different in that the form object is explicitly removed from memory with the dispose method, while the Color Dialog is left to the automatic Garbage Collection methods of the .Net framework for removal from memory.

92. How can you add a menu to your program and how should it be setup? What is a menu item? Describe the menu option and underlying object that closes the program?

A menu is added to a program by adding the MainMenu control to the component tray of a form. The naming and placement of each menu item in a menu should match the standards established for menus in other Microsoft programs. For example the File menu should always be the first menu on the left hand side of the menu, followed by Edit menu and the Help menu item should be the last menu on the right hand side of the menu.

A menu item is an object that is associated with each menu option. When the menu option is selected by the user, its click event is activated. Any code in this event is then run.

The menu option that closes the program should be located in the File menu and it should be displayed as Exit, with an access key under the ‘x’. The menu item associated with this menu option should be named mnuExit.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download