Starting Out with Visual Basic 7th Edition Gaddis Test Bank
Starting Out with Visual Basic 7th Edition Gaddis Test Bank
Starting Out with Visual Basic 7th Edition Gaddis Test Bank
Starting Out with Visual Basic 7th Edition Gaddis Test Bank
1. Starting Out with Visual Basic 7th Edition
Gaddis Test Bank download
https://testbankfan.com/product/starting-out-with-visual-
basic-7th-edition-gaddis-test-bank/
Find test banks or solution manuals at testbankfan.com today!
2. We have selected some products that you may be interested in
Click the link to download now or visit testbankfan.com
for more options!.
Starting Out With Visual Basic 7th Edition Gaddis
Solutions Manual
https://testbankfan.com/product/starting-out-with-visual-basic-7th-
edition-gaddis-solutions-manual/
Starting Out With Visual Basic 2012 6th Edition Gaddis
Solutions Manual
https://testbankfan.com/product/starting-out-with-visual-
basic-2012-6th-edition-gaddis-solutions-manual/
Starting out with Visual C 4th Edition Gaddis Test Bank
https://testbankfan.com/product/starting-out-with-visual-c-4th-
edition-gaddis-test-bank/
Personal Finance 13th Edition Garman Solutions Manual
https://testbankfan.com/product/personal-finance-13th-edition-garman-
solutions-manual/
3. Australasian Business Statistics 4th Edition black
Solutions Manual
https://testbankfan.com/product/australasian-business-statistics-4th-
edition-black-solutions-manual/
HR 4th Edition DeNisi Solutions Manual
https://testbankfan.com/product/hr-4th-edition-denisi-solutions-
manual/
Starting Out with C++ from Control Structures to Objects
8th Edition Gaddis Test Bank
https://testbankfan.com/product/starting-out-with-c-from-control-
structures-to-objects-8th-edition-gaddis-test-bank/
Peak Performance Success in College and Beyond 10th
Edition Ferrett Solutions Manual
https://testbankfan.com/product/peak-performance-success-in-college-
and-beyond-10th-edition-ferrett-solutions-manual/
New Products Management 11th Edition Crawford Solutions
Manual
https://testbankfan.com/product/new-products-management-11th-edition-
crawford-solutions-manual/
4. Operating Systems Design And Implementation 3rd Edition
Tanenbaum Solutions Manual
https://testbankfan.com/product/operating-systems-design-and-
implementation-3rd-edition-tanenbaum-solutions-manual/
5. Starting Out with Visual Basic, 7th Edition by Tony Gaddis/Kip Irvine
TEST BANK
Chapter 6 38
Chapter 6
Multiple Choice
Identify the letter of the choice that best completes the statement or answers the question.
____ 1. A procedure may not be accessed by procedures from another class or form if the __________ access specifier
is used.
a. Private
b. Public
c. Static
d. Scope
____ 2. By writing your own procedures, you can __________ an applications code, that is, break it into small,
manageable procedures.
a. streamline
b. duplicate
c. modularize
d. functionalize
____ 3. A is a special variable that receives a value being passed into a procedure or function.
a. temporary variable
b. pseudo-constant
c. class-level variable
d. parameter
____ 4. Which of the following calls to the GetNumber procedure is not valid?
Sub GetNumber(ByVal intNumber as Integer)
' (procedure body)
End Sub
a. GetNumber(intX)
b. GetNumber(3 + 5 * 8 + intX)
c. GetNumber(intX + 3, intY)
d. GetNumber(CInt(txtNumber.Text))
____ 5. When calling a procedure, passed arguments and declared parameters must agree in all of the following
ways except __________.
a. the order of arguments and parameters must correspond
b. the names of the arguments and parameters must correspond
c. the types of the arguments and parameters must correspond
d. the number of arguments and the number of parameters must be the same
____ 6. (True/False) When debugging a program in break mode, the Step Into command causes the currently
highlighted line of code to execute.
a. True
b. False
6. Starting Out with Visual Basic, 7th Edition by Tony Gaddis/Kip Irvine
TEST BANK
Chapter 6 39
____ 7. Which of the following code examples is a function that will accept three integer parameters, calculate their
average, and return the result?
a. Function Average(ByVal intX As Integer, ByVal intY As Integer, _
ByVal intZ As Integer) As Single
Average = (intX + intY + intZ) / 3
End Function
b. Function Average(ByVal intX As Integer, ByVal intY as Integer, _
ByVal intZ As Integer) As Single
Average = intX + intY + intZ / 3
Return Average
End Function
c. Function Average(ByRef intX As Integer, ByRef intY as Integer, _
ByRef intZ As Integer, ByRef Average As Double)
Average = (intX + intY + intZ) / 3
End Function
d. Function Average(ByVal intX As Integer, ByVal IntY as Integer, _
ByVal intZ As Integer) As Single
Return (intX + intY + intZ) / 3
End Function
____ 8. What is incorrect about the following function?
Function sum(ByVal intX As Integer, ByVal intY As Integer) As Integer
Dim intAns As Integer
intAns = intX + intY
End Function
a. intAns should not be declared inside the Function.
b. the as Integer at the end of the Function heading should be eliminated.
c. the function does not return a value
d. parameters intA and intB should be declared as ByRef
____ 9. All of the following are true about functions except __________.
a. you can use a function call in an expression
b. they can return one or more values
c. they must contain at least one Return statement
d. you can assign the return value from a function to a variable
7. Starting Out with Visual Basic, 7th Edition by Tony Gaddis/Kip Irvine
TEST BANK
Chapter 6 40
____ 10. What is assigned to lblDisplay.Text when the following code executes?
Dim intNumber As Integer = 4
AddOne(intNumber, 6)
lblDisplay.Text = intNumber
' Code for AddOne
Public Sub AddOne(ByVal intFirst As Integer, ByVal intSecond As Integer)
intFirst += 1
intSecond += 1
End Sub
a. 4
b. 5
c. 6
d. 7
____ 11. What is the value of intTotal after the following code executes?
Dim intNumber1 As Integer = 2
Dim intNumber2 As Integer = 3
Dim intTotal As Integer
intTotal = AddSquares(intNumber1, intNumber2)
Function AddSquares(ByVal intA As Integer, ByVal intB As Integer) As Integer
intA = intA * intA
intB = intB * intB
Return intA + intB
intA = 0
intB = 0
End Function
a. 0
b. 5
c. 10
d. 13
____ 12. Which of the following does not apply to procedures and functions?
a. they help to break up a large body of code into smaller chunks
b. they make it easier to maintain and modify code
c. the execution time is significantly reduced by calling procedures and functions
d. they permit the same sequence of code statements to be called from multiple places
____ 13. Which statement is true in regard to passing an argument by value to a procedure?
a. A copy of the argument is passed to the procedure.
b. A reference to the argument is passed to the procedure.
c. The procedure has access to the original argument and can make changes to it.
d. A procedure’s parameter list need not agree with the arguments provided to the procedure.
____ 14. If we were to call the MakeDouble and ChangeArg methods shown below, using the following statements,
what value would be assigned to lblResult.Text?
a. 0
8. Starting Out with Visual Basic, 7th Edition by Tony Gaddis/Kip Irvine
TEST BANK
Chapter 6 41
b. 20
c. 40
d. (cannot be determined)
Dim intValue As Integer = 20
ChangeArg(intValue)
lblResult.Text = MakeDouble(intValue).ToString()
Function MakeDouble (ByVal intArg As Integer) As Integer
Return intArg * 2
End Function
Sub ChangeArg2(ByRef intArg As Integer)
' Display the value of intArg.
lstOutput.Items.Add(" ")
lstOutput.Items.Add("Inside the ChangeArg procedure, " &
"intArg is " & intArg.ToString())
lstOutput.Items.Add("I will change the value of intArg.")
' Assign 0 to intArg.
intArg = 0
' Display the value of intArg.
lstOutput.Items.Add("intArg is now " & intArg.ToString())
lstOutput.Items.Add(" ")
End Sub
____ 15. Which of the following examples correctly uses an input box to assign a value to an integer, and returns the
integer to the calling program using a reference parameter?
a. Sub GetInput(ByVal intNumber As Integer)
intNumber = CInt(InputBox(“Enter an Integer”))
End Sub
b. Sub GetInput(ByRef intNumber As Integer)
intNumber = CInt(InputBox(“Enter an Integer”))
End Sub
c. Sub GetInput(ByRef intNumber As Integer)
intNumber = CInt(InputBox(“Enter an Integer”))
Return intNumber
End Sub
d. Sub GetInput()
Dim intNumber As Integer
intNumber = CInt(InputBox(“Enter an Integer”))
End Sub
9. Starting Out with Visual Basic, 7th Edition by Tony Gaddis/Kip Irvine
TEST BANK
Chapter 6 42
____ 16. Which of the following functions accepts a parameter named dblSales and returns the commission to the
calling statement? Assume that the commission should equal the sales multiplied by the commission rate.
Use the following table as a guide to the calculation of the commission rate.
Sales Commission Rate
less than 2,000 10%
2,000 or more 15%
a. Function Calc(ByVal dblSales As Double, ByRef dblComm As Double)
Dim dblRate As Double
Select Case dblSales
Case Is < 2000
dblRate = .1
Case Is >= 2000
dblRate = .15
End Select
DblComm = dblRate
End Function
b. Function Calc(ByVal dblSales As Double) As Double
Dim dblRate, dblComm as Double
Select Case dblSales
Case Is < 2000
dblRate = .1
Case Is >= 2000
dblRate = .15
End Select
dblCommission = dblRate * dblSales
End Function
c. Function Calc(ByVal dblSales As Double) As Double
Dim dblRate As Double
Select Case dblSales
Case Is < 2000
dblRate = .1
Case Is >= 2000
dblRate = .15
End Select
Return dblRate * dblSales
End Function
d. Function Calc(ByVal dblSales As Double, ByRef dblComm as Double)
Dim dblRate As Double
Select Case dblSales
Case Is < 2000
dblComm = .1 * dblRate
10. Starting Out with Visual Basic, 7th Edition by Tony Gaddis/Kip Irvine
TEST BANK
Chapter 6 43
Case Is >= 2000
dblComm = .15 * dblRate
End Select
End Function
____ 17. Which debugging command executes a function call without stepping through function’s statements?
a. Step Into
b. Step Over
c. Step Out
d. Step All
____ 18. When a procedure finishes execution, __________.
a. control returns to the point where the procedure was called and continues with the next statement
b. the application terminates unless the procedure contains a Return statement
c. control transfers to the next procedure found in the code
d. the application waits for the user to trigger the next event
____ 19. In the context of Visual Basic procedures and functions, what is an argument?
a. A value received by a procedure from the caller
b. A value passed to a procedure by the caller.
c. A local variable that retains its value between procedure calls.
d. A disagreement between the procedure and the statement that calls it.
____ 20. When a parameter is declared using the __________ qualifier, the procedure has access to the original
argument variable and may make changes to its value.
a. ByValue
b. ByAddress
c. ByRef
d. ByDefault
____ 21. If you do not provide an access specifier for a procedure, it will be designated __________ by default.
a. Private
b. Protected
c. Friend
d. Public
____ 22. Choose a new, more descriptive name for the WhatIsIt function based on the result of the code below.
Function WhatIsIt(ByVal intRepeat as Integer) as Integer
Dim intResult as Integer = 1
Dim intCount as Integer
For intCount = 1 to intRepeat
intResult = intResult * 2
Next intCount
Return intResult
End Function
a. PowersOfTwo
b. SquareRootsOfTwo
11. Starting Out with Visual Basic, 7th Edition by Tony Gaddis/Kip Irvine
TEST BANK
Chapter 6 44
c. MultiplyByTwo
d. TwoPlusTwo
____ 23. Which of the following can be returned by a function?
a. String values
b. Integer values
c. Boolean values
d. All of the above
____ 24. What is the syntax error in the following procedure?
Sub DisplayValue(Dim intNumber As Integer)
MessageBox.Show(intNumber.ToString())
End Sub
a. intNumber cannot be converted to a string
b. the procedure’s does not have a return value
c. Dim is not valid when declaring parameters
d. all of the above are true
____ 25. Which one of the following declarations uses Pascal casing for the procedure name?
a. Sub MyProcedure()
End Sub
b. Sub myprocedure()
End Sub
c. Sub my_procedure()
End Sub
d. Sub myProcedure()
End Sub
____ 26. What is wrong with the following GetName procedure?
Sub GetName(ByVal strName As String)
strName = InputBox(“Enter your Name:”)
End Sub
a. The procedure is missing a Return statement.
b. GetName is a reserved word and cannot be used as a name of a procedure.
c. strName will be modified, but all changes will be lost when the procedure ends.
d. The syntax for the call to InputBox is incorrect.
____ 27. Which statement is not true regarding functions?
12. Starting Out with Visual Basic, 7th Edition by Tony Gaddis/Kip Irvine
TEST BANK
Chapter 6 45
a. A function is a self-contained set of statements that can receive input values.
b. Visual Basic has many built-in functions such as CSng(txtInput.Text)
c. A function can only return a single value.
d. The same function can return several data types including integer, string, or double
____ 28. Which of the following procedure declarations matches the call to the IsLetter procedure below?
Dim strText as String = txtInput.Text
Dim blnLetter as Boolean = IsLetter(strText)
a. Sub IsLetter(ByVal strInput as String) as Boolean
b. Sub IsLetter(ByVal blnResult as Boolean) as String
c. Function IsLetter(ByVal strInput as String) as Boolean
d. Function IsLetter(ByVal blnResult as Boolean) as String
____ 29. What will be the value of dblSum after the button btnAdd is clicked, assuming that 25 is entered by the
user into txtNum1, and 35 is entered into txtNum2?
Private Sub btnAdd_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnAdd.Click
Dim dblNum1, dblNum2, dblSum As Double
dblNum1 = CDbl(txtNum1.Text)
dblNum2 = CDbl(txtNum2.Text)
dblSum = Sum(dblNum1, dblNum2)
lblSum.Text = dblSum.ToString()
End Sub
Function Sum(ByVal dblNum1 As Double, ByVal dblNum2 As Double) as Double
Return dblNum1 + dblNum2
End Function
a. 60
b. 50
c. 0
d. 70
____ 30. Which is the correct way to define a function named Square that receives an integer and returns an integer
representing the square of the input value?
a. Function Square(ByVal intNum as Integer) As Integer
Return intNum * intNum
End Function
b. Function Square(ByVal intNum as Integer)
Return intNum * intNum
End Function
c. Function Square(ByVal intNum as Integer) As Double
Return intNum * intNum
End Function
13. Starting Out with Visual Basic, 7th Edition by Tony Gaddis/Kip Irvine
TEST BANK
Chapter 6 46
d. Function Square(ByVal intNum as Integer) As Double
Dim dblAns as Double
dblAns = intNum * intNum
Return dblAns
End Function
____ 31. (True/False) Although you can omit the ByVal keyword in a parameter variable declaration, it is still a good
idea to use it.
a. True
b. False
14. Starting Out with Visual Basic, 7th Edition by Tony Gaddis/Kip Irvine
TEST BANK
Chapter 6 47
Chapter 6
Answer Section
Answer Page Reference
1. a 383
2. c 380
3. d 383
4. c 388
5. b 390
6. a 403
7. d 395
8. c 396
9. b 395
10. a 391
11. d 391
12. c 380
13. a 387
14. a 393
15. b 391
16. c 391
17. b 403
18. a 382
19. b 387
20. c 391
21. d 395
22. a 390
23. d 396
24. c 388
25. a 383
26. c 391
27. d 388
28. c 388
29. a 388
30. a 387
31. a 387
16. remain freely available for generations to come. In 2001, the Project
Gutenberg Literary Archive Foundation was created to provide a
secure and permanent future for Project Gutenberg™ and future
generations. To learn more about the Project Gutenberg Literary
Archive Foundation and how your efforts and donations can help,
see Sections 3 and 4 and the Foundation information page at
www.gutenberg.org.
Section 3. Information about the Project
Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-profit
501(c)(3) educational corporation organized under the laws of the
state of Mississippi and granted tax exempt status by the Internal
Revenue Service. The Foundation’s EIN or federal tax identification
number is 64-6221541. Contributions to the Project Gutenberg
Literary Archive Foundation are tax deductible to the full extent
permitted by U.S. federal laws and your state’s laws.
The Foundation’s business office is located at 809 North 1500 West,
Salt Lake City, UT 84116, (801) 596-1887. Email contact links and up
to date contact information can be found at the Foundation’s website
and official page at www.gutenberg.org/contact
Section 4. Information about Donations to
the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission of
increasing the number of public domain and licensed works that can
be freely distributed in machine-readable form accessible by the
widest array of equipment including outdated equipment. Many
17. small donations ($1 to $5,000) are particularly important to
maintaining tax exempt status with the IRS.
The Foundation is committed to complying with the laws regulating
charities and charitable donations in all 50 states of the United
States. Compliance requirements are not uniform and it takes a
considerable effort, much paperwork and many fees to meet and
keep up with these requirements. We do not solicit donations in
locations where we have not received written confirmation of
compliance. To SEND DONATIONS or determine the status of
compliance for any particular state visit www.gutenberg.org/donate.
While we cannot and do not solicit contributions from states where
we have not met the solicitation requirements, we know of no
prohibition against accepting unsolicited donations from donors in
such states who approach us with offers to donate.
International donations are gratefully accepted, but we cannot make
any statements concerning tax treatment of donations received from
outside the United States. U.S. laws alone swamp our small staff.
Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.
Section 5. General Information About
Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could be
freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose network of
volunteer support.
18. Project Gutenberg™ eBooks are often created from several printed
editions, all of which are confirmed as not protected by copyright in
the U.S. unless a copyright notice is included. Thus, we do not
necessarily keep eBooks in compliance with any particular paper
edition.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.
This website includes information about Project Gutenberg™,
including how to make donations to the Project Gutenberg Literary
Archive Foundation, how to help produce our new eBooks, and how
to subscribe to our email newsletter to hear about new eBooks.
41. Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.
More than just a book-buying platform, we strive to be a bridge
connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.
Join us on a journey of knowledge exploration, passion nurturing, and
personal growth every day!
testbankfan.com