Exam 2 Review
Write one statement that declares a boolean variable named isCorrect and defaults it to True.
Dim isCorrect as Boolean = True
Write the header declaration (first line) of a procedure named print header. The procedure will need a boolean parameter named show discount. The parameter passing mechanism should be explicitly set to the default option.
Private sub printHeader(ByVal showDiscount as Boolean) handles ...
Which property is used to place a textbox in a read-only state to prevent users from modifying its contents?
ReadOnly
The recommended prefix for the name of a button control is
btn
The person who actually runs (uses or executes) a computer program is called a
user
Visual Basic access keys are created by using which symbol?
&
Which of the following operators has the highest level of precedence (i.e. order of operations)?
()
What is returned from the function call below? Chr( 65 )
A
Create a constant named One Small Step to represent the exact date and time that Neil Armstrong stepped onto the surface of the moon: July 21, 1969, at 02:56 UTC.
Const ONE_SMALL_STEP as String = "July 21st, 1969, at 02:56 UTC"
True or False A variable that is used as an argument in a call to a function or sub procedure must have the exact same name as the parameter to which it is assigned.
False
True or False Due to the specific type of division operator used below, the result of the operation will include the remainder value. 7 \ 2
False
GUI stands for
Graphical User Interface
The process of finding and correcting errors in a program is called
debugging
In Visual Studio, press the F4 key to
display the Properties window
The statement btnButton.Focus()
moves the focus to the button btnButton.
Assume that variables x, y, and temp all have an Integer data type. Their initial values are 3, 10 and 0, respectively. Which of the following groups of statements labeled A-D will swap the values of x and y so that x will equal 10 and y will equal 3?
(C) temp = x x = y y = temp
When will the event procedure below be executed? Private Sub txtBox_TextChanged(...) Handles txtBox.TextChanged
All three answers are correct
Create a constant to represent the legal voting age, which is 18.
Const LEGAL_VOTING_AGE as Integer = 18
True or False The function indexOf will return the number 0 if it cannot find the search value within the source string.
False
True or False When starting a new program, it is best to first write the source code and then, after it is fully functional, create the design documentation.
False
True or False A Do Loop requires a counter variable.
False. A For Next loop requires a counter variable
What is the keyword used to create a function?
Function
What effect will the following statement have? lblOne.Visible = False
Make lblOne invisible
What is the name of the operator that divides two numbers and returns only the remainder.
Mod
Programming in VB.NET is different from text-based programming environments because first, you should
design ("draw") the user interface.
True or False The event procedure header definition below is invalid because it is assigned to different types of controls. Private Sub ShowHelp(sender As Object, e As EventArgs) Handles Button1.Click, Label1.Click
False
Which of the following answers lists the steps of the problem-solving process in proper order?
analysis, design, coding, testing
What is the default tab index value of the first control placed on to a form?
0
How many values can a function return?
1
What value will be assigned to the numeric variable x after the following statement is executed? x = 2 + 3 * 4
14
Given x = 3 and y = 1, what value will be assigned to the Decimal variable w when the following statement is executed? w = (x + y) / (x - y)
2
What is returned from the function call below? ASC( "B" )
66
True or False A flowchart is primarily intended to be used for testing a program after the source code has been written.
False
True or False The Visual Studio integrated development environment (IDE) is the only program that can be used to write the Visual Basic source code.
False
True or False The event procedure definition shown below is not valid because the sub procedure name must exactly match the name of the event to which it is associated. Private Sub CalcTotalCost(sender As Object, e As EventArgs) Handles btnCalc.Click
False
What is the keyword that associates a control event to a sub procedure?
Handles
The Font dialog box allows you to select different Fonts, their style, size, and some other special effects. How do you access the Font dialog box?
In the Properties window, click the ellipsis (...) on the right side of the settings box for the Font property.
Which method is most commonly used to alert a user that data entry is missing or invalid?
MessageBox.Show
Which property of a control holds the identifier that is used to reference the control in code. For example, if your form will require two textbox controls, what property will be used to make them unique.
Name
What is the keyword used to send a value back from a function?
Return
In Visual Studio, press the F5 key to
Run the program in debug mode
Which of the following steps specifies P as the access key for a button?
Set the Text property to Com&pute.
What is the data type of the value returned by the function InputBox?
String
When a Visual Basic program is running, the user can move from one control to another using the keyboard's
Tab key
Which property is used to specify the order in which controls receive focus when the tab key is pressed?
TabIndex
Users often press the tab key to move focus to a specific input control. Which property of an input control can be set to False to prevent the user from tabbing into it?
TabStop
The below code needs to update the value displayed in the textbox. What is the name of the missing property? txtAnswer._______ = "I Love Programming!"
Text
True or False A mouse click is an example of an event.
True
True or False As you write code, the Visual Basic Code Editor automatically checks for and reports on certain types of errors that prevent your program from running.
True
True or False Due to the specific type of division operator used below, the result of the operation will include the remainder value. 7 / 2
True
True or False Pseudocode and flowcharts are two different tools for creating design documentation.
True
True or False The term computer originally referred to people who performed mathematical computations.
True
Write two statements. The first declares an integer variable named number of people. The second assigns the variable the value 100.
Your Answer: Dim numOfPeople as Integer numOfPeople = 100
Pseudocode is
a description of an algorithm written in common language meant for a human to read.
In the context of computer programming, which of the options below is the best definition of an algorithm?
a logical sequence of steps that solve a problem.
Write a single statement that sets btnRun's text to Push Me.
btnRun.click = MessageBox.show("Push Me")
In a flowchart that depicts a conditional loop, which symbol is used to indicate the condition is being evaluated?
decision
A procedure can be associated with a button click so that when a user clicks a button, the code will be executed. The signal raised by clicking the button is referred to as an _____?
event
Programming languages are generally grouped into one of two levels: low and high. To which level does Visual Basic belong?
high level
Which one of the following is NOT one of the three basic types of statement structures?
input/output
Which of the following statements removes all text from lstBox?
lstBox.Items.Clear()
Write one statement that inserts the numeric literal value 22 into a Listbox control named lstMidTerm.
lstMidTerm.Items.Add("22")
Which of the following is NOT considered to be one of the three basic components of a software program?
store
Create a sub procedure named update numbers. It will need to receive two parameters, both of type integer: num one and num two. The parameters will need to be passed by reference. Within the sub procedure, raise the num one parameter to the power of 3 and divide the num 2 parameter by 10, using the long division operator. Your Answer:
sub updateNumbers(ByRef numOne As integer, ByRef numTwo As Integer) numOne^3 numTwo/10 end Sub
What is the type of error that is normally identified by the Code Editor using a red squiggly line?
syntax
The Properties window is primarily used
to change the appearance and behavior of controls.
Which of the following statements changes the text color of a textbox to red?
txtBox.ForeColor = Color.Red
Which of the options below is the best name for a text box that will contain a person's first name?
txtFirstName