Deck 5: Menus, Common Dialog Boxes, Sub Procedures, and Function

ملء الشاشة (f)
exit full mode
سؤال
Functions perform an action and return a value.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
Sub procedures can return a value.
سؤال
If you want the user to be able to use the dialog boxes from the Windows environment so he can save files and change colors,you will need to add two common dialog components to your form,the SaveFileDialog for saving files,and the ColorDialog for changing colors.
سؤال
The default for passing arguments to function procedures and sub procedures is ByRef.
سؤال
A function procedure may perform an action,but it only returns a value if the program code requests a value to be returned.
سؤال
By default,all new menu items have their Enabled property set to True.
سؤال
You must declare the name of a function as a module-level variable if you want it to return values.
سؤال
If you click on an item in a menu that is grayed out,you will toggle it on,and it will appear in black text.
سؤال
After adding a common dialog component to a form,you can display a common dialog box at run time using the OpenDialog method.
سؤال
It is possible to create procedures that are not associated with click events.
سؤال
When creating menus with the MenuStrip component,the Name property is used to hold the words that will appear on the screen in the menu bar.
سؤال
If you use the ShowDialog method to display a common dialog box,the window that is displayed is modal.
سؤال
When you call a sub procedure or a function procedure,you can send values,called arguments.
سؤال
When an argument is sent ByVal,a copy of the argument's value is sent to the procedure so that the procedure cannot alter the original value.
سؤال
Right-clicking on an object will usually pop up a context menu.
سؤال
An enabled menu item appears in black text and is available for selection.
سؤال
A function cannot have multiple arguments.
سؤال
When creating a menu,if an item named "Help" is listed,it should be at the far right and the H should have keyboard access.
سؤال
The return value from a function procedure is contained in a variable with the same name as the function.
سؤال
You can pass arguments to sub procedures and function procedures.
سؤال
Which of the following statements about menus is NOT true?

A)Menu items are displayed in buttons at the top of the window.
B)Create a menu by adding a MenuStrip component to the form.
C)In a menu,submenus will be indicated by a filled triangle to the right of the command.
D)Each item in a menu can have keyboard access.
سؤال
Which of the following is not a type of common dialog box?

A)Color
B)Save
C)Edit
D)Open
سؤال
Which property in a menu item's property window is used to change the words that will display in the menu?

A)Name
B)Text
C)Visible
D)Index
سؤال
Which property of a menu must be set to True if you want an item to have a check mark next to it when the project runs?

A)Selected
B)Enabled
C)Visible
D)Checked
سؤال
Common Dialog Boxes _______.

A)allow Visual Basic programs to translate the text on the screen into another language
B)display the predefined Windows dialog boxes for open,save,fonts,and colors
C)can only be used on forms with menus
D)allow you to create message boxes that will pop up and prompt the user for text input
سؤال
Which of the following is NOT true about a menu item that has a check mark?

A)It is currently selected.
B)It can be deselected by changing its Checked property to False.
C)It can be toggled on and off.
D)It is shown in gray.
سؤال
Which of the following is the method for showing common dialog boxes?

A)ShowDialog
B)ShowOpen
C)ShowPrint
D)ShowColor
سؤال
Which of the following statements is NOT true?

A)A sub procedure is a procedure that performs actions.
B)A function procedure is a procedure that performs actions.
C)A sub procedure returns a value to the point from which it was called.
D)A function procedure returns a value to the point from which it was called.
سؤال
Which of the following is the correct way to assign a font to a label using common dialog boxes after the statement FontDialog1.ShowDialog()has been executed?

A)EmployeeLabel.Font = FontDialog1.Font
B)FontDialog1.Font = EmployeeLabel.Font
C)EmployeeLabel.Font FontDialog1.Font
D)FontDialog1.FontName = EmployeeLabel.FontName
سؤال
If you right-click an object,what type of menu pops up?

A)Menu
B)Control menu
C)Context menu
D)Submenu
سؤال
Which of the following statements is NOT true?

A)Functions perform an action and then return a value to the point from which they were called.
B)Function procedures and sub procedures can be supplied with arguments.
C)Arguments sent to sub procedures and functions procedures can be sent ByVal or ByRef.
D)Sub procedures and function procedures can return values to the point from which they were called.
سؤال
Assume that you are working on a VB project where you need to change the color of the text in a text box named InformationTextBox.The color is to be selected by the user of the project.Explain which CommonDialog component you need to add to your form,indicate where it appears,and write the code needed to change the color of the text box.
A.Add a ColorDialog component,ColorDialog1.
B.It will appear in the component tray.
C.This is the code to show the dialog box: ColorDialog1.ShowDialog()
This is the code to change the textbox font color -
InformationTextBox.ForeColor = ColorDialog1.Color
سؤال
Which of the following is NOT true about passing arguments to procedures or functions?

A)Arguments may be passed ByVal or ByRef.
B)An argument that is passed ByRef cannot alter the original value.
C)Specifying ByVal or ByRef is not required when passing arguments.
D)If ByVal or ByRef is not specified,the argument will be sent by value.
سؤال
Explain the differences between ByVal and ByRef when passing arguments.B.ByRef sends a reference indicating where the value is stored in memory,allowing the called procedure to actually change the argument's original value.
سؤال
Which of the following statements about context menus is NOT true?

A)A program can have more than one context menu.
B)You can assign the same context menu to more than one control on the form.
C)A context menu can be assigned to a control by setting the control's ContextMenuStrip property.
D)The user can access a context menu on a button by right-clicking on the form.
سؤال
Which of the following is NOT true about using keyboard access with a menu item?

A)The first menu's Text property should be &File.
B)Do not use the same access key on a main menu name as you use on a form control.
C)When the program is running,use the Alt key with the letter in the menu that is underlined,in order to access that procedure.
D)Menu items will not function correctly if keyboard access is not assigned.
سؤال
Which of the following is NOT true about menu items in Visual Basic?

A)Menus appear at the top of a window.
B)Menus can contain keyboard access keys.
C)You can add a separator between menu items by using the Line control from the toolbox.
D)Create a menu using the MenuStrip component.
سؤال
Of the following choices,which CANNOT be done with common dialog boxes?

A)Opening files
B)Selecting fonts
C)Selecting colors
D)Resizing windows
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/38
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 5: Menus, Common Dialog Boxes, Sub Procedures, and Function
1
Functions perform an action and return a value.
True
2
Sub procedures can return a value.
False
3
If you want the user to be able to use the dialog boxes from the Windows environment so he can save files and change colors,you will need to add two common dialog components to your form,the SaveFileDialog for saving files,and the ColorDialog for changing colors.
True
4
The default for passing arguments to function procedures and sub procedures is ByRef.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
5
A function procedure may perform an action,but it only returns a value if the program code requests a value to be returned.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
6
By default,all new menu items have their Enabled property set to True.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
7
You must declare the name of a function as a module-level variable if you want it to return values.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
8
If you click on an item in a menu that is grayed out,you will toggle it on,and it will appear in black text.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
9
After adding a common dialog component to a form,you can display a common dialog box at run time using the OpenDialog method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
10
It is possible to create procedures that are not associated with click events.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
11
When creating menus with the MenuStrip component,the Name property is used to hold the words that will appear on the screen in the menu bar.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
12
If you use the ShowDialog method to display a common dialog box,the window that is displayed is modal.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
13
When you call a sub procedure or a function procedure,you can send values,called arguments.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
14
When an argument is sent ByVal,a copy of the argument's value is sent to the procedure so that the procedure cannot alter the original value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
15
Right-clicking on an object will usually pop up a context menu.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
16
An enabled menu item appears in black text and is available for selection.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
17
A function cannot have multiple arguments.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
18
When creating a menu,if an item named "Help" is listed,it should be at the far right and the H should have keyboard access.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
19
The return value from a function procedure is contained in a variable with the same name as the function.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
20
You can pass arguments to sub procedures and function procedures.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
21
Which of the following statements about menus is NOT true?

A)Menu items are displayed in buttons at the top of the window.
B)Create a menu by adding a MenuStrip component to the form.
C)In a menu,submenus will be indicated by a filled triangle to the right of the command.
D)Each item in a menu can have keyboard access.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
22
Which of the following is not a type of common dialog box?

A)Color
B)Save
C)Edit
D)Open
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
23
Which property in a menu item's property window is used to change the words that will display in the menu?

A)Name
B)Text
C)Visible
D)Index
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
24
Which property of a menu must be set to True if you want an item to have a check mark next to it when the project runs?

A)Selected
B)Enabled
C)Visible
D)Checked
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
25
Common Dialog Boxes _______.

A)allow Visual Basic programs to translate the text on the screen into another language
B)display the predefined Windows dialog boxes for open,save,fonts,and colors
C)can only be used on forms with menus
D)allow you to create message boxes that will pop up and prompt the user for text input
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
26
Which of the following is NOT true about a menu item that has a check mark?

A)It is currently selected.
B)It can be deselected by changing its Checked property to False.
C)It can be toggled on and off.
D)It is shown in gray.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
27
Which of the following is the method for showing common dialog boxes?

A)ShowDialog
B)ShowOpen
C)ShowPrint
D)ShowColor
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
28
Which of the following statements is NOT true?

A)A sub procedure is a procedure that performs actions.
B)A function procedure is a procedure that performs actions.
C)A sub procedure returns a value to the point from which it was called.
D)A function procedure returns a value to the point from which it was called.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
29
Which of the following is the correct way to assign a font to a label using common dialog boxes after the statement FontDialog1.ShowDialog()has been executed?

A)EmployeeLabel.Font = FontDialog1.Font
B)FontDialog1.Font = EmployeeLabel.Font
C)EmployeeLabel.Font FontDialog1.Font
D)FontDialog1.FontName = EmployeeLabel.FontName
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
30
If you right-click an object,what type of menu pops up?

A)Menu
B)Control menu
C)Context menu
D)Submenu
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
31
Which of the following statements is NOT true?

A)Functions perform an action and then return a value to the point from which they were called.
B)Function procedures and sub procedures can be supplied with arguments.
C)Arguments sent to sub procedures and functions procedures can be sent ByVal or ByRef.
D)Sub procedures and function procedures can return values to the point from which they were called.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
32
Assume that you are working on a VB project where you need to change the color of the text in a text box named InformationTextBox.The color is to be selected by the user of the project.Explain which CommonDialog component you need to add to your form,indicate where it appears,and write the code needed to change the color of the text box.
A.Add a ColorDialog component,ColorDialog1.
B.It will appear in the component tray.
C.This is the code to show the dialog box: ColorDialog1.ShowDialog()
This is the code to change the textbox font color -
InformationTextBox.ForeColor = ColorDialog1.Color
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
33
Which of the following is NOT true about passing arguments to procedures or functions?

A)Arguments may be passed ByVal or ByRef.
B)An argument that is passed ByRef cannot alter the original value.
C)Specifying ByVal or ByRef is not required when passing arguments.
D)If ByVal or ByRef is not specified,the argument will be sent by value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
34
Explain the differences between ByVal and ByRef when passing arguments.B.ByRef sends a reference indicating where the value is stored in memory,allowing the called procedure to actually change the argument's original value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
35
Which of the following statements about context menus is NOT true?

A)A program can have more than one context menu.
B)You can assign the same context menu to more than one control on the form.
C)A context menu can be assigned to a control by setting the control's ContextMenuStrip property.
D)The user can access a context menu on a button by right-clicking on the form.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
36
Which of the following is NOT true about using keyboard access with a menu item?

A)The first menu's Text property should be &File.
B)Do not use the same access key on a main menu name as you use on a form control.
C)When the program is running,use the Alt key with the letter in the menu that is underlined,in order to access that procedure.
D)Menu items will not function correctly if keyboard access is not assigned.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
37
Which of the following is NOT true about menu items in Visual Basic?

A)Menus appear at the top of a window.
B)Menus can contain keyboard access keys.
C)You can add a separator between menu items by using the Line control from the toolbox.
D)Create a menu using the MenuStrip component.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
38
Of the following choices,which CANNOT be done with common dialog boxes?

A)Opening files
B)Selecting fonts
C)Selecting colors
D)Resizing windows
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 38 في هذه المجموعة.