Chapter 2 Introduction To Visual C# Exam Questions - Test Bank | Visual C# 5e by Tony Gaddis. DOCX document preview.
Starting Out with Visual C#, 5e (Tony Gaddis)
Chapter 2 Introduction to Visual C#
TRUE/FALSE
1. A control's Visible property cannot be modified in code.
2. When you use the Properties window to change a control's Visible property at design time, the control will become invisible in the Designer.
3. When a method executes, the statements in the method always execute in the order that they appear, from the beginning of the method to the end.
4. Comments are short notes intended for the compiler to read and interpret.
5. If you double-click an error message in the Error List window, the code editor will highlight and display the line of code that caused the error.
6. The appearance and other characteristics of a GUI object are determined by the object's properties.
7. Changing a form's Text property will change the form's name.
8. When you create Button controls, they are automatically given default names such as button1, button2, and so forth.
9. A control's name should reflect the purpose of the control.
10. C# identifiers can contain spaces after the first character.
11. The only way to run a program in Visual Studio is to click the Start Debugging button on the toolbar.
12. C# source code files always end with the .cs extension.
13. It is important that you do not modify the contents of the Form1.cs file because doing so will prevent the application from executing.
14. Each opening brace ( { )of a code container must have a matching closing brace ( } ) later in the program.
15. When an event handler is generated for a control by Visual Studio, it doesn't do anything until you add your own code.
16. Ending a programming statement with a semicolon is not required in C#.
17. In C# string literals can be enclosed in double quotes, single quotes, or a combination.
18. In a C# application, all buttons on a form must share the same Click event handler in the form's source code file.
19. A Label control's Text property is initially set to the same value as the Label control's name.
20. The assignment operator assigns the value that appears on its left side to the item that appears on its right side.
MULTIPLE CHOICE
1. Which of the following is not a legal C# identifier?
a. | _calculateTotalButton |
b. | printSalesReportButton |
c. | clear_all_the_customer_names_button |
d. | 1stPlayerStartButton |
2. Which of the following Button control names is a legal C# identifier?
a. | _DisplayOption5Button |
b. | Exit!Button |
c. | *Clear*Button* |
d. | delete Record Button |
3. The __________ shows a description of an error, the name of the source code file containing the error, the error's line number and column number, and the name of the project.
a. | Debug dialog box | c. | Error List window |
b. | Crash pop-up | d. | Just In Time debugger |
4. To close an application's form in code, use the __________ statement.
a. | me.Quit(); | c. | form.Exit(); |
b. | this.Close(); | d. | app.Stop(); |
5. When you enter a statement into the code editor, Visual Studio analyzes it and, if a syntax error is found, it is __________.
a. | automatically corrected | c. | crossed out |
b. | underlined with a jagged line | d. | highlighted |
6. The __________ file contains an application's start-up code which executes when the application runs.
a. | Main.cs | c. | Program.cs |
b. | Code.cs | d. | Source.cs |
7. A __________ is a declared block in a program between braces ( {...} ) that holds classes.
a. | method | b. | program | c. | namespace | d. | list |
8. A(n) __________ is a logical container in a program that holds methods and other program elements.
a. | event | b. | program | c. | queue | d. | class |
9. The __________ directives that appear at the top of a C# source code file indicate which namespaces the program will use.
a. | include | b. | namespace | c. | public | d. | using |
10. If you want your code to execute a method, write a statement known as a(n) __________.
a. | event handler | c. | initialization routine |
b. | executor statement | d. | method call |
11. Which of the following statements correctly displays the text Hello in a message box?
a. | Messagebox("Hello") |
b. | MessageBox.Show("Hello"); |
c. | msgBox(Hello); |
d. | msgBox.show(Hello) |
12. The file named __________ contains code associated with a form named Form1.
a. | Form1.cs | c. | Control.cs |
b. | MainForm.cs | d. | Window.cs |
13. When you select an object in the Visual Studio Designer, the object's size, color, text, and other characteristics are displayed in the __________ window.
a. | Designer | b. | Editing | c. | Object | d. | Properties |
14. The Visual Studio __________ window shows a scrollable list of controls that you can add to a form.
a. | Collection | b. | Bank | c. | Toolbox | d. | Shelf |
15. When a piece of data such as 23 or Hello is written into a program's code, it is called a __________.
a. | constant | b. | sentinel | c. | value | d. | literal |
16. A(n) __________ is a sequence of one or more programming statements that perform some operation.
a. | algorithm | b. | method | c. | class | d. | namespace |
17. A(n) __________ is a method that executes when a specific event such as clicking the mouse takes place while an application is running.
a. | action sequencer | c. | event handler |
b. | feature coordinator | d. | incident manager |
18. A(n) __________ event occurs on a control when the user clicks the mouse while an application is running.
a. | Action | b. | Click | c. | Live | d. | Mouse |
19. When you want to display text on a form but not allow the user to change the text, you use a ___________control.
a. | String | b. | Label | c. | Text | d. | Font |
20. A __________ property can be set to one of two possible values: true or false.
a. | Boolean | b. | Binary | c. | Singular | d. | Toggle |
21. In code you use a(n) __________ to store a value in a control's property.
a. | string literal | c. | dialog box |
b. | assignment statement | d. | constant |
22. When a(n) __________ appears around an object in the Visual Studio Designer, it indicates that the object is selected and ready for editing.
a. | sizing handle | c. | bounding box |
b. | editing icon | d. | frame |
23. __________ allow you to resize a selected object in the Visual Studio Designer by clicking and dragging the mouse when the mouse cursor becomes a two-headed arrow.
a. | Bounding boxes | c. | ToolTips |
b. | Sizing handles | d. | Properties |
24. Which of the following statements would display the number 25 in a Label control named outputLabel?
a. | outputLabel.Text = 25; |
b. | outputLabel.Text = "25"; |
c. | outputLabel(25); |
d. | outputLabel = "25"; |
25. Which of the following statements would clear the text displayed in a Label control named cityLabel?
a. | cityLabel.Text = "empty"; |
b. | cityLabel.Text = "none"; |
c. | cityLabel.Text = "clear"; |
d. | cityLabel = ""; |
26. Assuming an application has a PictureBox control named profilePictureBox, which of the following assignment statements will hide the PictureBox from the user at runtime?
a. | profilePictureBox.Visible = False; |
b. | profilePictureBox.Visible = false; |
c. | profilePictureBox.Visible = True; |
d. | profilePictureBox.Visible = true; |
27. Once you have created a PictureBox control, you use its __________ property to specify the image it will display.
a. | Picture | b. | Image | c. | Source | d. | Display |
28. __________ is a term that refers to an image's width to height ratio.
a. | Area | c. | Aspect ratio |
b. | Bounding box | d. | UV map |
29. __________ are short notes placed in a program's source code that explain how the program works.
a. | Sketches | c. | Comments |
b. | Tags | d. | Labels |
30. A(n) __________ appears on one line in a program and begins with two forward slashes ( // ).
a. | line comment | c. | block comment |
b. | short comment | d. | documentation comment |
31. Which of the following are used by professional programmers to embed extensive documentation in a program's source code?
a. | line comments | c. | documentation comments |
b. | block comments | d. | embedded comments |
32. The __________ property can be used to change a form's width and height.
a. | Area | c. | Size |
b. | Resolution | d. | Rectangle |
33. Selecting the __________ button in the Properties window causes the items in the window to be displayed in logical groups.
a. | Grouped | b. | Categorized | c. | Ordered | d. | Type |
34. In the design window, you can click and drag a control to a new location when the mouse cursor is positioned inside the control and becomes a __________.
a. | two-headed arrow | c. | hand icon |
b. | four-headed arrow | d. | scissor icon |
35. To delete a control you can select it on a form and press the __________ key.
a. | Delete | b. | Z | c. | Tab | d. | X |
36. A control's __________ property identifies the control in the application's code and in the Visual Studio environment.
a. | Text | b. | Source | c. | Tag | d. | Name |
37. Control names are also known as __________, the same term used for variables in programs.
a. | tags | c. | values |
b. | identifiers | d. | labels |
38. A file that contains program code is called a __________.
a. | source code file | c. | C# file |
b. | program file | d. | cs file |
39. Just as a period marks the end of a statement, a(n) __________ marks the end of a programming statement in C#.
a. | space | b. | underscore | c. | semicolon | d. | dot |
40. When you have a project open in Visual Studio, the time during which you build the GUI and write the application's code is referred to as __________.
a. | prototyping | c. | visual planning |
b. | design time | d. | application progression |