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 computer’s hardware devices and controls their processes. Solve specific problems of perform operations that satisfy the user’s needs. Manages the computer’s 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
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Chapter 1Chapter 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 computer’s hardware devices and controls their processes.
Solve specific problems of perform operations that satisfy the user’s needs.
Manages the computer’s 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?
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 project’s 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.
Which statements are true? 1. A syntax error is a grammatical error in coding
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 user’s 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 3Chapter 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 form’s controls always has the focus.
iv. myButton.Focus() will enable the user to press the enter key to engage the button named myButton’s 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.
Which statement(s) are true? i. A variable can not be used before it is declared.
ii. Implicit type conversion is when Visual Basic attempts to convert 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 Box’s 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 4Chapter 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 If…Then 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 If…Then 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
Which of the following statements are true about If…Then…ElseIf statements:
i. If…Then…ElseIf statements evaluate the conditions until one is found to be true, executes the statements under the true condition, and then leaves the structure.
ii. If…Then…ElseIf statements are like a chain of If statements.
iii. If…Then 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 If…Then…ElseIf statement ensures that a default action is always executed if none of the proceeding statement conditions in the If…Then…ElseIf 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 If…Then…Else 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?
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.
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 user’s 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 7Chapter 7 Quiz: Multiple Forms, Standard Modules, and Menus
This activity contains 10 questions.
A Windows application’s 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 form’s 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 form’s Name property.
iv. If you change a form’s file name, the Name property changes automatically to match the file’s name .
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 8Chapter 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.
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 Do…Until loop
a Do…Each loop
a Do…While loop
a For…Next loop
a For…Each 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 IntegerFor i = 0 to (intValue.Length - 2)
For j = (i + 1) to (intValue.Length - 1) If intValue(i) < intValue(j) Then
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 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 about the random class are true?
i. The random seed value is based on the time of day down to the nano-second.
ii. The random seed value provides the initial input that generates 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 12Chapter 12 Quiz: Classes, Collections, and Scrollable Controls
__________________ 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.
Which statements are correct for declaring and writing to a file:
Dim myFile as System.StreamwritermyFile = File.Createtext(“myData.txt”)
Dim myFile as System.StreamwritermyFile = WriteLine.File.Createtext(myData.txt)
Dim myFile as StreamwritermyFile = .File.CreateText(“myData.txt”)
Dim myFile as System.IO.StreamwritermyFile = 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.