Visual Basic Event Coding Practice Quiz (11 questions)

All questions and answers

1. A button has a blue background and black lettering. Which property controls the blue area behind the lettering?

BorderColor
ForeColor
Image
BackColor

BackColor

Explanation

BackColor controls the color displayed in an object's background. ForeColor applies to text, while BorderColor and Image refer to different visual elements.

2. A developer wants a Windows Form's background to be white. Which sequence uses the form's color picker as described?

Select the form, open BackColor, choose the Web tab, and select White
Select the form, type White into the property field, and confirm
Select the form, open ForeColor, choose the Web tab, and select White
Select the form, open BackColor, choose the System tab, and select White

Select the form, open BackColor, choose the Web tab, and select White

Explanation

To set the form background to white, select the form, open its BackColor color list, choose the Web tab, and select White. The System tab uses the wrong tab, ForeColor changes text color, and typing a name bypasses the described color-list steps.

3. A program needs a control whose purpose is to show a graphic image. Which object is designed for that purpose?

PictureBox
BackColor
Windows Form
Label

PictureBox

Explanation

A PictureBox object is used to display a graphic image. A Label displays text, a Windows Form is the program's interface window, and BackColor sets a background color.

4. A developer finds an image online and wants it displayed in a PictureBox. What sequence makes that image available and assigns it for display?

Save the image locally, specify it for the PictureBox, and then import it into Resources
Import the web address into Resources and specify it for the PictureBox
Save the image locally, import it into Resources, and leave the PictureBox image unspecified
Save the image locally, import it into Resources, and specify it for the PictureBox

Save the image locally, import it into Resources, and specify it for the PictureBox

Explanation

A web image must be saved to the computer, imported into the program's Resources folder, and then specified for the PictureBox. Importing a web address skips obtaining the image file, specifying it before import reverses the necessary sequence, and leaving it unspecified does not display it.

5. What does setting an object's Enabled property to False do?

It hides the object from view.
It stretches the object's image to fit.
It disables the object.
It changes the object's background color.

It disables the object.

Explanation

The Enabled property determines whether an object is enabled, so setting it to False disables the object. Setting Visible to False hides an object, but does not describe disabling it.

6. In Visual Studio 2017, which toolbar control starts a Visual Basic program running?

The Design View button on the Standard toolbar
The Properties button on the Standard toolbar
The Build Solution button on the Standard toolbar
The Start Debugging button on the Standard toolbar

The Start Debugging button on the Standard toolbar

Explanation

Selecting Start Debugging runs the program, compiling its Visual Basic instructions into instructions the computer can execute. Build Solution is related to compiling, but the specified control for starting the program is Start Debugging.

7. What is the purpose of a Visual Basic event handler?

To translate Visual Basic instructions into executable computer instructions
To specify the user actions and tasks planned for each interface object
To execute processing code in response to a user-triggered event
To display allowable entries while a statement is being written

To execute processing code in response to a user-triggered event

Explanation

An event handler responds to an event caused by a user action by running code that performs the required processing. Translating Visual Basic instructions is the role of running or compiling a program, not an event handler.

8. When does IntelliSense display allowable entries while a Visual Basic statement is being written?

When the program is compiled and its statements are translated
When a period, equal sign, or another special character is required
When a button is clicked and its event handler begins processing
When a comment is entered after an event procedure

When a period, equal sign, or another special character is required

Explanation

IntelliSense offers allowable entries as the statement requires a period, equal sign, or another special character. Compilation translates Visual Basic instructions, rather than providing this in-editor list of entries.

9. How does a Visual Basic comment differ from code that the compiler processes as an executable statement?

A comment begins with a quotation mark and is treated as a string value.
A comment begins with a period and is treated as a procedure call.
A comment begins with a parenthesis and is treated as an event handler.
A comment begins with an apostrophe and is not treated as executable code.

A comment begins with an apostrophe and is not treated as executable code.

Explanation

The apostrophe marks the start of a Visual Basic comment, distinguishing it from executable statements. A missing apostrophe can cause the compiler to interpret intended comment text as code and report a build error.

10. What happens when a Visual Basic statement calls the Close procedure?

The current form resets while the program remains open.
The current window closes and the program terminates.
The current procedure pauses until another event occurs.
The current window hides while the program continues running.

The current window closes and the program terminates.

Explanation

The Close procedure closes a window and terminates the program. Hiding a window would not, by itself, produce the stated termination effect.

11. After identifying the user actions that trigger events and the tasks each event must perform, what should a developer do during Phase 4?

Choose the form controls and set their visual properties in the designer
Run the program to discover which user actions require event handlers
Enter Visual Basic statements that carry out the planned tasks and implement the program logic
Create the event-planning table by listing interface objects and possible user actions

Enter Visual Basic statements that carry out the planned tasks and implement the program logic

Explanation

Phase 4 begins once events and their tasks have been identified, and it involves coding the statements that accomplish those tasks. Creating the event-planning table is an earlier planning activity, not the work of Phase 4.

Study with flashcards

Lock in the answers with 10 flashcards on Visual Basic Event Coding.

What color does an object's BackColor display?

Its background color.

What color does an object's ForeColor display?

Its text color.

What is a PictureBox object used to display?

A graphic image.

See the flashcards →

Read the study guide

Go over the full study guide for Visual Basic Event Coding.

Read the study guide →

Related classes

Make your own practice quizzes

Upload your class notes and Revizly writes a practice quiz with explained answers in about a minute.

Quiz maker