Вы находитесь на странице: 1из 40

Chapter 1

Chapter 1 Quiz: Introduction to Programming and Visual Basic


This activity contains 10 questions.

What are the two primary programming methods used today?


Basic and Procedural Procedural and Object Oriented Cobol and Pascal Object Oriented and Basic

What does application software do?


Manages the computers hardware devices and controls their processes. Solve specific problems of perform operations that satisfy the users needs. Manages the computers Input devices and controls their processes. Solve hardware problems and aid in hardware operation for the user.

What is an object in Visual Basic programming?


Any program written in Visual Basic. An element of programming that contains attributes and actions. An element of programming that gives the program structure. The hardware a user might use.

The CPU only processes instructions written in:


Microsoft Word Machine Language C++ Notepad

Psuedocode is:
A set of programming statements calculated by the computer. Machine language A cross between human language and programming language. A code written in a specific language.

What are some GUI elements?


Objects, actions, code, and performance Mice, cables, keyboards, and disks Windows, dialog boxes, buttons, and menus Windows, actions, menus, and hardware

Attributes in Visual Basic are referred to as:


Code Properties Events GUIs

What is the default name given to the first Label control created in an application?
Label0 myLabel Label1 newLabel

Control names can not contain:


Spaces Digits Letter characters Underscores

What is not a definition for a keyword?


A word that has special meaning in a coding language. A word that is reserved for a specific task or command in a coding language A word that is pre defined for a specific purpose A user defined word that identifies a variable

Chapter 2
Chapter 2 Quiz: Creating Applications with Visual Basic
This activity contains 9 questions.

How do you add a control onto a form?


Place your mouse in the form and type the control name Drag the control from the toolbox into the form window. Click the Common Controls tab in the toolbox window, then double click on the control icon Double click the text property in the Properties Window

Which statement about the Autosize property in a label is false?

It automatically adjusts the size of the control. It is set to false by default It sizes the control based on the contents of the text property It is set to true by default

Which is not a way to open an existing project?


Click file on the menu bar, then click Open Project in the file menu. This causes the open project dialog box to appear. Navigate to the file name, and then click the open button to open it. Click the Open Project button in the Open project Dialogue box. Navigate to the file name, and then click the open button to open it. Click on the projects name in the Recent Projects panel of the start page in Visual Studio. Click file on the menu bar, then click New Project in the Visual Studio Application. Type the name of the file into the dialog box.

A Boolean Property:
can only hold two values changes the font size is made of many other letters and number sets the variables for the application

Which of the following statements is false?


Event Procedures are a type of sub procedure. Event procedures are not the same as Event Handlers The first line of an Event Procedure identifies the control it belongs to and the event it responds to. Event Procedures are code that applications execute to respond to events such as

mouse clicks and keyboard input.

What object is used to identify the current form?


Me Sub Display Name

To change the text colors, what property is used?


Text Align Font ForeColor

Which is proper coding for a comment?


/This symbol begins a comment *This symbol begins a comment #This symbol begins a comment ?This symbol begins a comment

Which statements are 1. A syntax error is a grammatical error in coding true?

2. A runtime error is an attempt that the application makes while running to perform an operation that can not be executed in Visual Basic. 3. A logical error is an error in the users though process. The program will run, but does not perform the operation as anticipated and produces incorrect results. 4. The error list window shows error messages and the lines they occur.
All but 2 All the statements are true All but 4 1 and 2 only

Chapter 3
Chapter 3 Quiz: Input, Variables and Calculations
This activity contains 11 questions.

Which way does not clear a text box named txtInput for input? (hint page 99-100)
txtInput.Text.Clear() txtInput. Clear() txtInput.Text = String.Empty txtInput.Text =

To break up long lines of code, the line continuation character is:


+ ? / _

Which statement(s) are true?

i. txtBox.Focus() put the focus, and thus the cursor, into a control called txtBox. ii. Only controls capable of receiving some sort of input may have the focus. iii. When an application is running and a form is displayed, one of the forms controls always has the focus. iv. myButton.Focus() will enable the user to press the enter key to engage the button named myButtons commands.

all but iv i only all the statements are true. all but iii

Which statement(s) are true?

i. The order the controls are placed on the form determines the tab order. ii. The tab order is permanent and can not be changed. iii. The TabIndex property contains an integer which indicates the controls position in the tab order. iv. The first control placed on a form has a TabIndex of 1.

i and iii only i and ii only all but ii all the statements are true.

Which statement(s) are true?

i. More than one button can be assigned the same access key, but only the first button assigned the access key will be able to utilize it during a click event. ii. You assign an access key through the Text property. iii. An access key is defined by placing an ampersand (&) behind the first letter of the text the button is to contain. This will underline the first letter and make that letter an access key. iv. Access keys distinguish between uppercase and lowercase characters. Therefore, there is a difference between pressing the keys Alt and X together and Alt and x. They refer to different commands.

all but i all but iv ii only all the statements are true.

Which is not a correctly formatted assignment statement?


myGreeting = Hello & txtFirstName.Text myLength = 112

myVariable = txtName.Text 112 = myNumber

Which statement(s) are not the computers RAM. true?

i. A variable is a name that represents a storage location in

ii. To declare a variable you use a DIM statement. iii. Variable names have the same naming convention as control names. iv. A variables data type determines the amount of memory that variable uses.
all the statements are true i and ii all but ii all but iii

The difference between Decimal and Double data types is:


A Decimal value type is not suitable for very precise calculations. A Double value type may hold larger numbers than a Decimal value type, but with less precision. A Double value type has greater precision than a Decimal value. A Decimal value type holds a Real value, while a Double value type holds Integers

Which statement(s) are true? ii. Implicit type conversion is when Visual Basic attempts to convert

i. A variable can not be used before it is declared.

one value type to another value type through an assignment statement. iii. When Option Strict is set to On any conversion, other than a

widening conversion, will cause the code not to compile. iv. CStr(expr) converts a numerical, Boolean, Date or string expression to a String.
all but iii i only all the statements are true. all but iv

How many decimal places does the FormatNumber function format a number to by default?
1 2 4 3

Which statement(s) about Group Boxes are true?

i. The title for the Group Box is stored in the Group Boxs Text property. ii. To place a control inside a Group Box, select the existing Group Box control, and then double click the desired tool within the toolbox to place the control within the Group Box. iii. To place a control inside a Group Box, select the existing Group Box control, and then double click on the desired tool within the toolbox to place the control within the Group Box. iv. Group Box controls can receive the focus, and have an access key assigned to them.

i only

all but iii all the statements are true. all but iv

Chapter 4
Chapter 4 Quiz: Making Decisions And Working With Strings
This activity contains 10 questions.

Which relational operator means not equal to in Visual Basic?


<> > < !=

Which is not a syntax rule for IfThen statements?


Nothing other than a comment can appear after the Then keyword in an If Then statement. The words If and Then must appear on the same line. Semi - colons need to be used after every statement with in the IfThen structure The End If statement must be on a line by itself.

A Boolean variable that signals whether a condition exists n a program is

called a
relational operator flag constant value arithmetic operator

Which of the following until one is found to be true, executes the statements under statements are true about the true condition, and then leaves the structure. IfThenElseIf statements:

i. IfThenElseIf statements evaluate the conditions

ii. IfThenElseIf statements are like a chain of If statements. iii. IfThen ElseIf statements evaluate all statements in the structure once a true condition is found, and do not leave the structure until a break statement is encountered. iv. An Else statement placed at the end of an IfThenElseIf statement ensures that a default action is always executed if none of the proceeding statement conditions in the IfThenElseIf structure were met.
all but iii all but i only i and ii i only

The structure: If (condition I And condition II) Then is only true:


if either condition I or condition II is true is never true. if both condition I and condition II are true if neither condition I or condition II are true

An If statement placed within the condition of another If statement is known as:


a Nested If statement an Irrational If statement a composite If statement an IfThenElse statement

This operator reverses the truth value of an expression; making a true expression false and a false expression true.
Xor And Or Not

Which string property or function returns the length of a string variable stored in strVar?

i. strVar.Length ii. strVar.Len. iii. Length(strVar). iv. strVar.Trim

only i and ii all but iii i only all but i

9. Which is the conversion for the following If...Then...ElseIf statement to a Select...Case statement?

If intValue > 0 And intValue <= 9 Then discount = .10 Else If intValue >9 And intValue <=20 discount = .15 Else discount = .20
Select Case intValue Case Is 1 To 9 discount = .10 Case Is 10 To 19 discount = .15 Case Else discount = .20 End Select Select Case intValue Case 1 To 9 discount = .10 Case 10 To 19 discount = .15 Case Else discount = .20 End Select Select Case intValue Case 1 To 9 discount = .10 Case 10 To 20 discount = .15

Case Else discount = .20 End Select Select intValue Case intValue 1 To 9 discount = .10 Case intValue 10 To 20 discount = .15 Case Else discount = .20 End Select Select Case intValue Case intValue 1 To 9 discount = .10 Case intValue 10 To 19 discount = .15 Case Else discount = .20 End Select

Which are characteristics of a CheckBox control? ii. you can use code to select or deselect a check box by

i. only one check box can be selected at a time.

using an assignment statement and the Checked property. iii. a CheckChanged event is triggered whenever the user changes the state of a check box. iv. a check boxs Checked property can only be set with an assignment statement during run time.

only i and iv

ii and iii only all but i all but iv

Chapter 5
Chapter 5 Quiz: Lists, Loops, Validation, and More
This activity contains 13 questions.

A _________ control is used to gather input without placing a text box on a form.
Variable Input Box Check Box List Box Message Box

What buttons appear on an Input Box automatically?


OK and Abort OK and Cancel OK and Help OK , Help, and Cancel

A _________ control displays a list of items and allows the user to select one or more items from the list.
Input Box List Box Message Box Check Box

The ___________ property determines the number of items stored in a list box.
.Count.Items .Items.Count .Items.Index .Items.Number

To add values to a List Box during run time use the following method:
ListBox. Item.Add(Item) ListBox. Items.Add(Item) ListBox. Items.Add.Item ListBox.Items.Insert(Item) ListBox:Items.Add(Items)

What statement marks the end of a Do While loop?


End Loop End Do While Loop End

A loop that does not have a way of stopping is called a ______________.


Test loop Infinite loop Pre test loop Random loop Post test loop

The general form:


Do statement 1 statement 2 statement 3 Loop Until expression

is an example of a ____________ loop.


pretest conditional posttest incremental

A ____________ loop uses a counter variable to perform the loop a specific number of times.
For Next If Then Do While Do Until

A loop inside another loop is called a _________ loop.


conditional pretest nested posttest

Which are characteristics of both a List Box and a Combo Box?

i. Both display a list of items to the user. ii. Both have Items.Add, Items.Clear, Items.Remove and Items.RemoveAt methods. iii. Both have Items, Itmes.Count, Sorted, and SelectedItems properties

iv. Both have a rectangular area that functions like a text box.

only ii and iii all are true all but iv all but i

Which characteristics of ToolTips are true?

i. It is a small box that is displayed when the user holds the mouse cursor over a control. ii. The ToolTip control is invisible at runtime. iii. The ToolTip control appears in the component tray at run time. iv. The InitialDelay property measures the amount of time in milliseconds that a ToolTip remains on the screen once it is displayed by the user.

i, ii and iii only i and ii only i and iv only All are true i and iii only

______________ is the process of inspecting information given to the application by a user, and making sure that it is valid.
User Validation Input Validation Inspection Validation Syntax Validation

Chapter 6
Chapter 6 Quiz: Procedures and Functions
This activity contains 10 questions.

Which statement is not true about general purpose procedures?


A general purpose procedure is associated with a control. A procedures modularize an applications code. Procedures reduce redundancy in an applications code. An Event Handle or and Event Procedure is a type of procedure executed during runtime.

If you leave out the AccessSpecifier part of the Procedure declaration, it defaults to:
Public Protected Private Global

A special variable that receives a value being passed to a procedure is called a _____________.
Argument Procedure Variable Parameter Specifier

Which statement is not true about static variables?

A static variable retains its stored value for the lifetime of the application Only variables declared within procedures may be static. The static variable scope is only the procedure in which they were declared. In order to declare a static variable, replace Dim with Static Static variables are destroyed when the procedure terminates.

Values passed to procedures are called _______________.


Specifiers Sub Variables Parameters Arguments

What is the difference between passing an argument by value or by reference?


Passing by value creates a new memory location used in the procedure to hold the value passed so the value can not be altered by the procedure; while passing by reference accesses the same memory location as the passed value, thus having the ability to alter the original value. Passing by reference creates a new memory location used in the procedure to hold the value passed so the value can not be altered by the procedure; while passing by value accesses the same memory location as the passed value, thus having the ability to alter the original value. Passing by value is more stable than passing by reference. ByVal replaces Dim when declaring a parameter to passed by reference.

To pass a parameter by reference, use the _________ keyword to in the declaration of the parameters variables.
ByRef ReDim Dim

ByVal

A _____________ returns a value to the part of the program that called it.
Declaration Variable Function Call Procedure

In debugging a program you would use the ___________ command to go through a function or procedure one line at a time.
Step Out Step Over Step Into Debug

What happens after a function or a procedure is finished executing?


The application program returns back to the original place where the function or procedure was called, and then waits for the user to initiate the next event. The application program waits for a users to initiate the next event. The application program returns back to the original place where the function or procedure was called, and resumes executing the code at the next line. The application program terminates.

Chapter 7
Chapter 7 Quiz: Multiple Forms, Standard Modules, and Menus
This activity contains 10 questions.

A Windows applications default start up object is:


Any procedure. A procedure named Main. Any form created. The first form created.

Which statements about Form Name Properties and Form Files are true?

i. You assign a name to a form in its Name property, using the standard prefix of frm. ii. A form should be assigned a name that describes the forms purpose.. iii. The code associated with a form created in Visual Basic is stored in a Form File with a .vb extension added to the forms Name property. iv. If you change a forms file name, the Name property changes automatically to match the files name .

all but iii all but iv all are true ii and iii only

At design time you can switch between forms by double clicking the forms entry in the ________________ window.
Solution Explorer Project Design Code

A ______________ is a program structure that describes an objects

properties and methods.


Class Variable Stuct Code

Which statements about modal forms are true?

i. You show the form using either the ShowDialog method or the Show method. ii. When a modal form is displayed, no other form can be displayed until the form is closed or hidden. iii. When a modal form is displayed, no other statements in the procedure will execute until the form is closed or hidden. iv. The general format to close a modal form is me.close(). .

all but ii i and iii only all but i all are true

A procedure or variable declarations used in more than one file should be stored in a ___________ Module.
Standard Form Private Public

Which of these as an applications startup object. statements are false?

i. You can designate either a form or a public procedure called Main

ii. A procedure designated as a startup object will display the default

form automatically after all its statements are executed. iii. Main can be written as a function instead of a procedure returning an integer value to indicate the success or failure of the codes execution.. iv. You can designate either a form or a private procedure called Main as an applications startup object.

all but iv all but ii only i ii and iv only

Using the ___________ keyword makes a class level variable available to methods outside of the class.
Private Standard Public Dim

To disable a menu item you:


set the Show property to false. set the Enabled property to false. set the Visible property to false. set the Disabled property to true.

Which one of the following is not a standard menu item that should always be added to your menu systems?
File

Help An Exit command on the Help menu. An About command on the Help menu. An Exit command on the File menu

Chapter 8
Chapter 8 Quiz: Arrays, Timers, and More
This activity contains 13 questions.

Which are characteristics of an Array?

i. An array stores multiple values of the same type using one name. ii. Values stored within an array are called elements. iii. An index is a number used to identify a specific element within the array. iv. If n is the number of elements within an array, the index of the first element in the array would be 0 and the index of the last element in the array would be n-1.

all but iv are true only ii and iii are true all but ii are true all are true

In the declaration: Dim studentID(10) As Integer the number 10 refers to:


The index number for the last value in the array. The initial value of the first element in the array The maximum number of characters each element in the array can contain. None of the above. The number of elements in the array.

Assigning an integer to a variable, and then using that variable as a

subscript to an array, allows you to utilize a ____________ to access each element of the array.
loop command class sub procedure or function

A special loop designed specifically to read values from arrays, but not to modify the values, is called:
a DoUntil loop a DoEach loop a DoWhile loop a ForNext loop a ForEach loop

If an array is declared with the following syntax: Dim studentID(10) As Integer the number statement studentID.Length will return a value of:
11 10 0 The maximum number of characters each element in the array contains.

What would the following snippet of code using an array named intValue of 50 integer values accomplish? Dim temp As Integer Dim i As Integer Dim j As Integer
For i = 0 to (intValue.Length - 2) For j = (i + 1) to (intValue.Length - 1) If intValue(i) < intValue(j) Then temp = intValue(i) intValue(i) = intValue(j) intValue(j) = temp End If Next j

Next i

It would sort the array from lowest to highest, so that intValue(0) would contain the smallest value in the array, and intValue(49) would contain the largest value in the array. It would make all the array values in intValue alike. It would sort the array from highest to lowest, so that intValue(0) would contain the largest value in the array, and intValue(49) would contain the smallest value in the array. It would make IntValue(0) the smallest value in the array

Which statements about arrays are true?

i. The word Preserve is optional, and when used with a ReDim statement makes sure that any existing values within the array are not destroyed. ii. A ReDim statement redefines the dimension of an existing array iii. A ReDim statement is used when the number of elements an array will contain is known at design time. iv. The statement: Dim intValue() as Integer is incorrect syntax because the array size is missing.

only ii and iii are true all are true all but iii and iv are true only ii is true

To pass an array to a procedure or function, the parameter variable is declared as an array with
the upper subscript defined the upper subscript as a variable to be defined by the user within the sub procedure or function An array can not be passed to a procedure or a function.

the upper subscript left blank as open parenthesis

In the multidimensional array declaration: Dim intValues(4, 15) as Integer the number 15 stands for:
The last dimension, where the array intValue starts at subscript 4 and ends at subscript 15. The highest column subscript The highest row subscript The number of total values that can be stored in the array

In the multidimensional array declaration: Dim newValues(2, 5, 15) as Decimal the array dimension is:
15 5 3 2 Can not be determined

Which statements are true about Timer Controls?

i. A Timer Control is used to automatically execute code at regular intervals during the run of an application. ii. A Timer Control responds to a Tick Event. To generate a Tick Event procedure, double click a Timer Control that has been placed within a form. iii. A Timer Control has three important properties; Enable, Visible, and Interval. iv. The Interval property works in milliseconds; therefore if the property is set to 100, the interval will restart every second.

all but iii and iv are true only ii and iii are true all but iii all are true

When a control is ___________, it is positioned directly against one of the edges of a form.
created anchored docked sized

Which statements nano-second. about the random class are true? ii. The random seed value provides the initial input that generates

i. The random seed value is based on the time of day down to the

the next random number in the series. iii. The statement: Private rand As New Random(12) creates an instance of the Random class with a variable name rand, and with a seed of 12. iv. The statements: Private rand As New Random Dim intNum As Integer = rand,next(100) assigns to intNum a randomly generated integer value somewhere between 0 and 99.

all are true only ii and iii are true all but i is true only ii is true

Chapter 12

Chapter 12 Quiz: Classes, Collections, and Scrollable Controls


This activity contains 10 questions.

__________________ programming is a way of designing and coding applications such that interchangeable software components can be used to build larger programs.
COBOL Visual Basic C++ Object-oriented

The portion of the class that is visible to the application programmer is the :
class interface class implementation operations attributes

___________ describe the properties that all objects in the same class have in common.
operations class implementation attributes class interface

A variable declared inside a class declaration is called a ___________ variable.


property member static

method

A function that defines a class property is known as a ______________.


member variable get section set section property procedure

A procedure or a function that is member of a class is called a ___________.


operator constructor method finalizer

A _________ is a method named New that is automatically called each time an instance of a class is created.
finalizer function constructor operator

Which of the following statements are true?

i. A collection is similar to an array in that they are both single units that contain multiple items in which individual items are designated by an index. ii. The index subscript begins at 0 for both a collection and an array. iii. In a collection, the individual items do not have to be the same

datatype. iv. Collections automatically expand or contract as items are added or removed from the collection.

all but iii and iv are true all are true only ii and iv are true all but ii are true

The __________ property holds the number of items stored in a collection.


Number Count Add Item

_____________ allows you to create new classes that derive characteristics from existing classes.
Derivatives Constructors Members Inheritance

Chapter 11
Chapter 11 Quiz: Developing Web Applications
This activity contains 10 questions.

Which of these statements are true and pages on the internet. about URLs?

i. A URL is a uniform way of addressing objects

ii. A domain name is part of a URL. iii. A protocol is always at the end of a URL. iv. A URL can contain file and folder paths.

all are true only ii and iii are true all but iii are true all but iii and iv are true

Which of these statements are content, program logic, and configuration information. true about ASP.NET?

i. Web applications written in ASP.NET consist of

ii. ASP.NET is called a platform. iii. ASP.NET uses a compiler to check for programming errors. iv. A web application written in ASP.NET use special pages called web forms.
all but iii are true only ii and iii are true all are true all but iii and iv are true

____________controls are used to display database and XML data in grids and lists.
Navigation Data Validation HTML

Which types of web sites can be created with Visual Studio?

i. File System web site. ii. FTP web site. iii. HTTP web site. iv. Standard web site.

all are true all but iii are true only ii and iii are true all but iv are true

Which are differences between Web controls and Windows controls?

i. Web controls have a new property named AutoPostBack. ii. The Enable property is only used on Windows controls. iii. The ID property of the Web control is the counterpart of the Name property of the Window control. iv. Web controls lose their runtime properties when the user moves away from the current page.

all are true only ii and iii are true all but ii are true all but iii and iv are true

Which statements are true about control causes the form to be posted back to the the AutoPostBack property? server.

i. When the property is set to true, clicking on the

ii. The ImageButton control automatically posts the current page back to the server . iii. All controls have an AutoPostBack property. iv. AutoPostBack defaults to false for all controls.

all are true all but iii and iv are true all but iii are true only ii and iii are true

The property used to determine whether a user can select one or multiple items from a ListBox control is:
SelectedIndex SelectionMode SelectionValue SelectedItem

Which of the following statements are true about HTML Table controls?

i. To insert a table into a forms design select Insert Table from the Table menu. ii. The tables Border property set to 1 by default. iii. The row and column height adjustments are given in inches. iv. Static text typed into a tables cell is left justified by default.

all are true only ii and iii are true all but ii and iii are true

all but iii

Which are methods used to move from one web page (the source page) to another web page (the target page)?

i. Place the URL of the target page in the NavigationURL property of a Hyperlink control. ii. Write code in the click event handler of a Button, ImageButton, or LinkButton control. iii. Select a block of text with the mouse, click the Hyperlink button on the formatting toolbar, and enter the URL of the target web page. iv. Use a Response.Redirect statement in the click event handler of a Button, ImageButton, or LinkButton control.

only ii and iii are true all but iii all are true all but iii and iv are true

Web forms applications use a _________________ control to access databases from Windows Forms.
SQL Dataset Datasource Access

Chapter 9
Chapter 9 Quiz: Files, Printing, and Structures
This activity contains 10 questions.

In a ______________ file, the data in the file must read from its beginning until its end.

text

binary sequential access random access

Which statements are correct for declaring and writing to a file:


Dim myFile as System.Streamwriter myFile = File.Createtext(myData.txt) Dim myFile as System.Streamwriter myFile = WriteLine.File.Createtext(myData.txt) Dim myFile as Streamwriter myFile = .File.CreateText(myData.txt) Dim myFile as System.IO.Streamwriter myFile = System. CreateText(myData.txt)

What does the WriteLine method of the StreamWriter class do?

It writes a line of data to a file, then writes a space character immediately after the data. It writes a line of data to a file. It writes a line of data to a file, then writes a tab character immediately after the data. It writes a line of data to a file, then writes a newline character immediately after the data.

What is the difference between the WriteLine method and the Write method of the StreamWriter class?

The Write method writes a line of data to a file and writes a new line character at the end of the line; while the WriteLine method writes only the line of data,. There is no difference. The WriteLine method only writes text, while the Write method writes any data type. The WriteLine method writes a line of data to a file and writes a new line character at the end of the line; while the Write method writes only

the line of data,.

The ________ method writes any unsaved information remaining in the file buffer and releases memory allocated by the StreamWriter object.

Open Save Write WriteLine Close

To determine a file exists, you should use the following method syntax:

File.Close(filename) File.Exists(filename) File.Exist(filename) File.Open(filename)

To display a standard Windows.Save As dialog box, use the _________control.

OpenFileDialog FontDialog ColorDialog SaveFileDialog

To print output to the printer, you use the _________control.

PrintOutput PrintFile PrintPage

PrintDocument

To print a 3 column output of 10 spaces in each column, you would use the method:

Print.Output String.Format String.Output e.Graphics

A ______________ is a data type that is user created, containing one or more variables known as fields.

Structure Object Class Function File