Chapter 1: An Introduction to Visual Basic 2012

TRUE/FALSE

	1.	Every object used in an object-oriented program is created from an instance.

ANS:	F	PTS:	1	REF:	8

	2.	Windows applications created in Visual Studio 2012 are composed of solutions, projects, instructions, and files.

ANS:	F	PTS:	1	REF:	9

	3.	An index is a word that has a special meaning in a programming language.

ANS:	F	PTS:	1	REF:	24

	4.	A method is a predefined Visual Basic procedure that you can call (or invoke) when needed.

ANS:	T	PTS:	1	REF:	24

	5.	A set of parentheses are required when calling some Visual Basic methods.

ANS:	T	PTS:	1	REF:	25

MULTIPLE CHOICE

	1.	Visual Basic 2012 is a(n) ____ programming language, which is a language that allows the programmer to use objects to accomplish a program’s goal.
a.	goal-based	c.	object-based	
b.	object-oriented	d.	goal-oriented	

ANS:	B	PTS:	1	REF:	8

	2.	A(n) ____ is anything that can be seen, touched, or used.
a.	method	c.	program	
b.	class	d.	object	

ANS:	D	PTS:	1	REF:	8

	3.	Every object used in an object-oriented program is created from a ____, which is a pattern or blueprint that the computer uses to create the object.
a.	method	c.	class	
b.	token	d.	program	

ANS:	C	PTS:	1	REF:	8

	4.	A(n) ____ is an environment that contains all of the tools and features you need to create, run, and test your programs.
a.	OOP	c.	IDE	
b.	OOD	d.	CLR	

ANS:	C	PTS:	1	REF:	8

	5.	A(n) ____ is what the user sees and interacts with while an application is running.
a.	user interface	c.	translator	
b.	application class	d.	interpreter	

ANS:	A	PTS:	1	REF:	8

	6.	A(n) ____ is a container that stores the projects and files for an entire application.
a.	class	c.	solution	
b.	object	d.	library	

ANS:	C	PTS:	1	REF:	9

	7.	A ____ is the foundation for the user interface in a Windows-based application.
a.	table	c.	form	
b.	layer	d.	file	

ANS:	C	PTS:	1	REF:	14

	8.	A(n) ____ file is a file that contains program instructions, called code.
a.	properties	c.	interface	
b.	key	d.	source	

ANS:	D	PTS:	1	REF:	15

	9.	The extension ____ on a filename indicates that the file is a Visual Basic source file.
a.	.vs	c.	.vb	
b.	.vc	d.	.vbproj	

ANS:	C	PTS:	1	REF:	15

	10.	A(n) ____ file refers to a file that contains the code associated with a Windows form.
a.	form	c.	properties	
b.	interface	d.	source	

ANS:	A	PTS:	1	REF:	15

	11.	Each object has a set of ____ that determine its appearance and behavior.
a.	properties	c.	classes	
b.	instances	d.	tools	

ANS:	A	PTS:	1	REF:	15

	12.	Each namespace in Visual Studio 2012 contains the code that defines a group of related ____.
a.	classes	c.	projects	
b.	objects	d.	solutions	

ANS:	A	PTS:	1	REF:	17

	13.	The ____ list box lists the events to which the selected object is capable of responding.
a.	Method Name	c.	Event Name	
b.	Class Name	d.	Event Procedure	

ANS:	A	PTS:	1	REF:	24

	14.	____ controls are used in an interface to identify the contents of other controls, such as the contents of text boxes and list boxes.
a.	List box	c.	Button	
b.	Text box	d.	Label	

ANS:	D	PTS:	1	REF:	20-21

	15.	In Windows applications, a ____ control is commonly used to perform an immediate action when clicked.
a.	list box	c.	label	
b.	text box	d.	button	

ANS:	D	PTS:	1	REF:	21

	16.	The ____ list box of the Code Editor window lists the names of the objects included in the user interface.
a.	Method Name	c.	Event Name	
b.	Class Name	d.	Event Procedure	

ANS:	B	PTS:	1	REF:	24

	17.	A procedure footer contains the keywords ____.
a.	Exit	c.	Stop	
b.	Close Sub	d.	End Sub	

ANS:	D	PTS:	1	REF:	24

	18.	The ____ instruction tells the computer to close the current form.
a.	Me.Close()	c.	This.Close()	
b.	Me.Exit()	d.	This.Exit()	

ANS:	A	PTS:	1	REF:	24

	19.	The ____ form is the form that the computer automatically displays each time the application is started.
a.	log-in	c.	basic	
b.	interface	d.	startup	

ANS:	D	PTS:	1	REF:	25

	20.	When you start a Visual Basic application, the computer automatically creates a file, called a(n) ____ file, that can be run outside of the IDE.
a.	source	c.	sequential	
b.	executable	d.	Web	

ANS:	B	PTS:	1	REF:	27

	21.	The assignment operator is ____.
a.	*	c.	&	
b.	>>	d.	=	

ANS:	D	PTS:	1	REF:	28

COMPLETION

	1.	Visual Basic 2012 is an object-oriented programming language, which is a language that allows the programmer to use ____________________ to accomplish a program’s goal.

ANS:	objects

PTS:	1	REF:	8

	2.	An application that has a Web user interface and runs on a server is called a(n) ____________________ application.

ANS:	
Web
Web-based
Web based

PTS:	1	REF:	8

	3.	The ____________________ window displays a list of the projects contained in the current solution and the items contained in each project.

ANS:	Solution Explorer

PTS:	1	REF:	15

	4.	The ____________________ contains the tools you use when creating your application’s user interface.

ANS:	
Toolbox window
toolbox

PTS:	1	REF:	19

	5.	The first line in the code template is called the ____________________.

ANS:	procedure header

PTS:	1	REF:	24

MATCHING

Match each item with a statement below.
a.	event	f.	dot member access operator	
b.	class	g.	sequential processing	
c.	control	h.	sub procedure	
d.	Windows Form Designer window	i.	object	
e.	event procedure	

	1.	An object, such as a label or button, that is added to a form.

	2.	Indicates a hierarchy of namespaces.

	3.	The set of Visual Basic instructions that are processed only when the event occurs.

	4.	A pattern used to create an object

	5.	An action of the user, such as clicking, double-clicking, and scrolling.

	6.	A block of code that performs a specific task.

	7.	Anything that can be seen, touched, or used

	8.	Used to create a graphical user interface

	9.	When the computer processes the instructions shown in a  procedure one after another in the order in which they appear in the procedure.

	1.	ANS:	C	PTS:	1	REF:	19

	2.	ANS:	F	PTS:	1	REF:	17

	3.	ANS:	E	PTS:	1	REF:	23

	4.	ANS:	B	PTS:	1	REF:	8

	5.	ANS:	A	PTS:	1	REF:	23

	6.	ANS:	H	PTS:	1	REF:	24

	7.	ANS:	I	PTS:	1	REF:	8

	8.	ANS:	D	PTS:	1	REF:	14

	9.	ANS:	G	PTS:	1	REF:	25

SHORT ANSWER

	1.	In what formats is Visual Basic 2012 available?

ANS:	
Visual Basic 2012 is one of the languages included in Visual Studio 2012, which is available in many different editions, such as Ultimate, Premium, Professional, and Express. Each product includes an integrated development environment (IDE), which is an environment that contains all of the tools and features you need to create, run, and test your programs.

PTS:	1	REF:	8

	2.	What is the difference between a solution and a project?

ANS:	
A solution is a container that stores the projects and files for an entire application. A project also is a container, but it stores files associated with that particular project.

PTS:	1	REF:	9

	3.	With respect to opening and closing a window in the IDE, describe the use of the auto-hide feature.

ANS:	
The auto-hide feature offers an alternative to closing the window. You auto-hide a window using the Auto Hide button (vertical pushpin) on the window’s Title bar. The Auto Hide button is a toggle button: clicking it once activates it, and clicking it again deactivates it.

PTS:	1	REF:	13-14

	4.	How do you prevent controls on a form from being moved inadvertently?

ANS:	
You can prevent controls on a form from being selected, sized, moved, and deleted by locking them. When a control is locked, a small lock appears in the upper-left corner of the control. To lock and unlock the controls, right-click the form (or any control on the form), then click Lock Controls on the Context menu. The Lock Controls option is a toggle option: clicking it once activates it, and clicking it again deactivates it. You can also click FORMAT on the menu bar and then click Lock Controls.

PTS:	1	REF:	19-20

	5.	What is a sequence structure?

ANS:	
In a sequence structure, the computer processes the instructions in the procedure one after another in the order in which they appear in the procedure.

PTS:	1	REF:	25

	6.	What are two ways of saving a solution?

ANS:	
The two ways to save a solution are:
1) Click FILE on the menu bar, and then click Save All.
2) Click the Save All button on the Standard toolbar.

PTS:	1	REF:	25

	7.	What are the ways to start an application?

ANS:	
The ways to start an application are:
1) Save the solution. Click DEBUG on the menu bar, then click Start Debugging.
2) Save the solution and then press the F5 key on your keyboard.
3) Save the solution and then click the Start button on the Standard toolbar.

PTS:	1	REF:	26

	8.	What are the ways to end (or close) a running application?

ANS:	
1) Click an Exit button in the interface.
2) Click FILE on the application’s Menu bar and then Click Exit.
3) Click the Close button on the application’s title bar.
4) Click the designer window to make it the active window. Click DEBUG on the menu bar, and then click Stop Debugging.
5) Click the Stop Debugging button on the Standard toolbar.

PTS:	1	REF:	28

	9.	Why should you always print out a copy of your application’s code?

ANS:	
You should always print out a copy of your application’s code because the printout will help you understand and maintain your code in the future. You should also print out a copy of the user interface.

PTS:	1	REF:	29

	10.	What are two ways you can find more information on syntax errors in a program?

ANS:	
The two ways to find more information on syntax errors are:
1. Position your mouse pointer on the mistyped instruction. The Code Editor displays a box that contains the appropriate error message.
2. If you start an application that contains a syntax error, select No in the dialog box that appears. The Error List window will display and provide both the description and location of the error in the code.

PTS:	1	REF:	31