Introduction to Programming Using Visual Basic 10th Edition Schneider Test Bank pdf download
Introduction to Programming Using Visual Basic 10th Edition Schneider Test Bank pdf download
https://testbankdeal.com/product/introduction-to-programming-
using-visual-basic-10th-edition-schneider-test-bank/
https://testbankdeal.com/product/introduction-to-programming-using-
visual-basic-10th-edition-schneider-solutions-manual/
testbankdeal.com
https://testbankdeal.com/product/introduction-to-programming-using-
visual-basic-2012-9th-edition-schneider-test-bank/
testbankdeal.com
https://testbankdeal.com/product/introduction-to-programming-using-
visual-basic-2012-9th-edition-schneider-solutions-manual/
testbankdeal.com
https://testbankdeal.com/product/essentials-of-psychology-6th-edition-
bernstein-test-bank/
testbankdeal.com
Families and their Social Worlds 2nd Edition Seccombe Test
Bank
https://testbankdeal.com/product/families-and-their-social-worlds-2nd-
edition-seccombe-test-bank/
testbankdeal.com
https://testbankdeal.com/product/history-of-the-united-
states-v-1-0-volume-ii-1st-edition-trowbridge-test-bank/
testbankdeal.com
https://testbankdeal.com/product/taxation-of-individuals-and-business-
entities-2016-edition-7th-edition-spilker-solutions-manual/
testbankdeal.com
https://testbankdeal.com/product/exploring-research-8th-edition-
salkind-test-bank/
testbankdeal.com
https://testbankdeal.com/product/clinical-psychology-science-practice-
and-culture-3rd-edition-pomerantz-test-bank/
testbankdeal.com
Intermediate Algebra with Applications and Visualization
3rd Edition Rockswold Test Bank
https://testbankdeal.com/product/intermediate-algebra-with-
applications-and-visualization-3rd-edition-rockswold-test-bank/
testbankdeal.com
Chapter 7 Arrays
1. After the following Dim statement is executed, how many elements will the array myVar
have?
Dim myVar(7) As Double
(A) 0
(B) 1
(C) 8
(D) 9
C
4. In the statement
Dim scores(30) As Double
the Count method is used to carry out which of the following tasks?
(A) determine the largest value for each of the elements
(B) determine the largest subscript in the array
(C) determine the smallest value for each of the elements
(D) declare a new array with the name Count
B
8. The ReDim statement causes an array to lose its current contents unless the word ReDim is
followed by the keyword
(A) CInt
(B) MyBase
(C) Preserve
(D) Add
C
9. Like other variables, array variables can be declared and assigned initial values at the same
time. (T/F)
T
10. After an array has been declared, its type (but not its size) can be changed with a ReDim
statement. (T/F)
F
11. If you use the ReDim statement to make an array smaller than it was, data in the eliminated
elements can be retrieved by using the Preserve keyword. (T/F)
F
13. What will be the size of the array stones after the following two lines of code are executed?
Dim stones() As String = {"Watts", "Jagger", "Wood", "Richards"}
ReDim Preserve stones(10)
11
is used to declare an array where each element has the value 10. (T/F)
F
17. What two names are displayed in the list box when the button is clicked on?
Dim krispies(2) as String
19. Either a For...Next loop or a For Each loop can be used to display every other value from an
array in a list box. (T/F)
F
20. An array can contain both numeric and string values. (T/F)
F
21. A Function procedure can return a number, but cannot return an array of numbers. (T/F)
F
22. What names are displayed in the list box when the button is clicked on?
Private Sub btnDisplay_Click(...) Handles btnDisplay.Click
Dim names() As String = IO.File.ReadAllLines("Data.txt")
lstBox.Items.Clear()
For i As Integer = (names.Count - 1) To 0 Step -2
lstBox.Items.Add(names(i))
Next
End Sub
Assume the five lines of the file Data.txt contain the following entries: Bach, Borodin,
Brahms, Beethoven, Britain.
(A) Bach, Brahms, and Britain
(B) Britain, Beethoven, Brahms, Borodin, and Bach
(C) Bach, Borodin, Brahms, Beethoven, and Britain
(D) Britain, Brahms, and Bach
D
24. What numbers are displayed in the list box when the button is clicked on?
Private Sub btnDisplay_Click(...) Handles btnDisplay.Click
Dim file As String = "Beatles.txt"
Dim fabFour() As String = FillArray(file)
lstBox.Items.Add(Array.IndexOf(fabFour, "Ringo")
lstBox.Items.Add(fabFour.Count - 1)
End Sub
Assume the four lines of the file Beatles.txt contain the following entries: John, Paul, Ringo,
George.
(A) 3 and 3
(B) 3 and 4
(C) 2 and 3
(D) 2 and 4
C
26. What numbers are displayed in the list box by the following program segment?
Dim numbers As String = "1492,1776,1945"
Dim temp() As String = numbers.Split(","c)
Dim nums(2) As Integer
For i As Integer = 0 to 2
nums(i) = CInt(temp(i))
Next
lstBox.Items.Add(nums(1))
lstBox.Items.Add(nums.First)
(A) 10000
(B) 11110
(C) 1110
(D) 0
B
30. Given the Dim statement below, which set of statements will initialize all elements of
myArray to 100?
Dim myArray(100) As Double
34. Consider the following Dim and assignment statements for myArray(). The assignment
statement will cause a "Subscript out of range" error. (T/F)
Dim myArray(50) As Double
myArray(34) = 51
F
35. Unless otherwise specified, Visual Basic assigns the value 0 to each element of a numeric
array when it is declared with a Dim statement. (T/F)
T
39. Which of the tasks is the Join function used to carry out in the following statement?
Dim line As String
line = Join(strArrData, ",")
(A) Join concatenates the values of all elements of the array strArrData, and adds a comma
delimiter between successive values.
(B) Join concatenates the values of all elements of line, and adds a comma to the end of the
line.
(C) Join parses or separates out all items of text that are delimited by a comma in
strArrData.
(D) Join parses or separates out all items of text that are delimited by a comma in line.
A
2. What numbers are displayed in the list box by the following program segment?
Dim numbers() As Integer = {4, 7, 9, 3, 1}
Dim query = From number in numbers
Where number > 6
Select number
lstBox.Items.Add(query.Count)
lstBox.Items.Add(query.Average)
(A) 5 and 12
(B) 2 and 12
(C) 2 and 8
(D) 5 and 8
C
3. What numbers are displayed in the list box by the following program segment?
Dim numbers() As Integer = {4, 7, 9, 3, 1, 9, 7}
Dim query = From number in numbers
Where number > 6
Select number
lstBox.Items.Add(query.Count)
lstBox.Items.Add(query.Average)
(A) 7 and 12
(B) 4 and 8
(C) 2 and 12
(D) 7 and 8
B
5. What states are displayed in the list box by the following program segment?
Dim states() As String = {"Colorado", "New Mexico", "Arizona", "Utah"}
Dim query = From state in states
Where ContainsE(state)
Select state
For Each state in query
lstBox.Items.Add(state)
Next
(A) Utah
(B) COLORADO, NEW MEXICO, ARIZONA, UTAH
(C) UTAH
(D) No states
C
7. What numbers are displayed in the list box by the following program segment?
Dim states() As String = {"Colorado", "New Mexico", "Arizona", "Utah"}
Dim query = From state in states
Where state.EndsWith("o")
Select state.Length
For Each number in query
lstBox.Items.Add(number)
Next
(A) 8 and 10
(B) 8, 10, 7, 4
(C) 8
(D) 29
A
8. What names are displayed in the list box by the following program segment?
Dim tonightShow() As String = {"Allen", "Parr", "Carson", "Leno",
"O'Brien", "Leno"}
Dim query = From host in tonightShow
Where host.Length = 4
Select host
Distinct
For Each host in query
lstBox.Items.Add(host)
Next
10. What years are displayed in the list box by the following program segment?
Dim years() As Integer = {1492, 1776, 1840, 1929, 1945, 2005}
Dim query = From year in years
Where Is20thCentury(year)
Select year
For Each yr in query
lstBox.Items.Add(yr)
Next
12. What words are displayed in the list box by the following program segment?
Dim deadlySins() As String = {"pride", "greed", "anger", "envy",
"lust", "gluttony", "sloth"}
Dim query = From sin in deadlySins
Order By sin Ascending
Where sin.StartsWith("g")
Select sin
lstBox.Items.Add(query.First)
lstBox.Items.Add(query.Max)
13. What words are displayed in the list box by the following program segment?
Dim deadlySins() As String = {"pride", "greed", "anger", "envy",
"lust", "gluttony", "sloth"}
Dim query = From sin in deadlySins
Order By sin.Length Descending
Select sin.ToUpper
lstBox.Items.Add(query.First)
lstBox.Items.Add(query.Min)
15. What colleges are displayed in the list box by the following program segment?
Dim ivies() As String = {"Harvard", "Princeton", "Yale", "Dartmouth",
"Brown", "Columbia", "Univ. of PA", "Cornell"}
Dim query = From college in ivies
Where college.Length <= 9
Order By college.Length Descending, college Descending
Select college
lstBox.Items.Add(query.Last)
lstBox.Items.Add(query.Min)
16. What colleges are displayed in the list box by the following program segment?
Dim ivies() As String = {"Harvard", "Princeton", "Yale", "Dartmouth",
"Brown", "Columbia", "Univ. of PA", "Cornell"}
Dim query = From college in ivies
Where college.Length <= 9
Order By college.Length Descending, college Ascending
Select college
lstBox.Items.Add(query.First)
lstBox.Items.Add(query.Max)
18. What numbers are displayed in the list box by the following program segment?
Dim numbers() As Integer = {5, 79, 8, 33, 27}
Dim query = From number in numbers
Let formattedNum = number.ToString("N0")
Order By formattedNum Ascending
Select formattedNum
lstBox.DataSource = query.ToList
lstBox.SelectedIndex = Nothing
22. Arrays are said to be ordered only if the values are in ascending order. (T/F)
F
24. Searching successive elements of an ordered list beginning with the first element is known
as a binary search. (T/F)
F
1. Consider the following structure definition. Which Dim statement would correctly declare
an array of this structure for elements having subscripts from 0 through 30?
Structure carType
Dim yr As Integer
Dim make As String
Dim model As String
End Structure
(A) You cannot have an array of structures.
(B) Dim carType(30)
(C) Dim car(30) As carType
(D) Dim carType(30) As car
C
2. Consider the following Structure definition and declaration. Which assignment statement
would correctly record that player number 13 had three home runs so far this season?
Structure playerType
Dim fullname As String
Dim team As String
Dim position As String
Dim homerun As Double
Dim average As Double
Dim rbi As Double
End Structure
(A) player(13) = 3
(B) player(13).homerun(3)
(C) playerType(13).homerun = 3
(D) player(13).homerun = 3
(E) None of the above
D
5. The members of a structure must all be of the same data type. (T/F)
F
8. A structure can contain members that are simple variables only; members cannot be arrays.
(T/F)
F
10. Suppose a structure and an array are created with the code
Structure Nation
Dim name As String
Dim continent As String
Dim population As Double 'in millions
Dim area As Double 'in square miles
End Structure
Structure Nation
Dim name As String
Dim continent As String
Dim population As Double 'in millions
Dim area As Double 'in square miles
End Structure
Structure Nation
Dim name As String
Dim continent As String
Dim population As Double 'in millions
Dim area As Double 'in square miles
End Structure
Structure Nation
Dim name As String
Dim continent As String
Dim population As Double 'in millions
Dim area As Double 'in square miles
End Structure
(A) Three columns, with headers country, population, and area. The grid will display the
countries in Europe (along with their populations and areas) whose names begin with
the letter S. The countries will be displayed capitalized in alphabetical order and their
populations and areas will be formatted with commas as thousands separators.
(B) Four columns, with headers countryUC, continent, pop, and area. The grid will display
the countries in Europe (along with their continents, populations and areas) whose
names begin with the letter S. The countries will be displayed capitalized in alphabetical
order and their populations and areas will be formatted with commas as thousands
separators.
(C) Three columns, with headers countryUC, pop, and area. The grid will display the
countries in Europe (along with their populations and areas) whose names begin with
the letter S. The countries will be displayed capitalized in alphabetical order and their
populations and areas will be formatted with commas as thousands separators.
(D) Three columns, with headers countryUC, pop, and area. The grid will display the
countries in Europe (along with their populations and areas) whose names begin with
the letter S. The countries will be displayed capitalized in reverse alphabetical order and
their populations and areas will be formatted with commas as thousands separators.
C
myArray
num = myArray(3,4) 0 1 2 3 4
0 0 1 2 3 4
1 5 6 7 8 9
2 10 11 12 13 14
3 15 16 17 18 19
4 20 21 22 23 24
(A) 19
(B) 4
(C) 24
(D) 0
(E) None of the above
A
2. Assume the array nums has been filled as shown. What is the output of the following
program segment?
nums
0 1 2 3
s = 0 |------------------------
For k As Integer = 0 To 2 0 | 2 3 4 5
s += nums(k, k + 1) |
Next 1 | 6 5 4 3
lstBox.Items.Add(s) |
2 | 2 3 4 5
|
3 | 6 5 4 3
(A) 64
(B) 12
(C) 13
(D) 25
(E) None of the above
B
4. Which of the following types of variables is capable of holding the information contained in
a table that has four rows and four columns?
(A) one-dimensional arrays
(B) simple variables
(C) single-subscripted variables
(D) double-subscripted variables
D
5. Which of the following types of variables can only hold a single item of data?
(A) two-dimensional arrays
(B) simple variables
(C) single-subscripted variables
(D) double-subscripted variables
B
8. Arrays that are capable of holding the contents of a table with several rows and columns, are
known as two-dimensional arrays or double subscripted variables. (T/F)
T
declares a two-dimensional array that can store a table containing 7 rows and 8 columns of
numeric data. (T/F)
F
11. A two-dimensional array can be declared and initialized at the same time. (T/F)
T
12. If the two-dimensional array nums has three rows and six columns, then the value of
nums.GetUpperBound(0) is 3 and the value of nums.GetUpperBound(1) is 6. (T/F)
F
14. The ReDim and Preserve keywords can be used with two-dimensional arrays. (T/F)
T
16. ReDim statements cannot be used to change a one-dimensional array into a two-dimensional
array. (T/F)
T
17. ReDim statements can be used to change a one-dimensional array into a three-dimensional
array. (T/F)
F
18. Given the following statements, the first subscript in the second statement references a
column. (T/F)
Dim myArray(15, 20) As Double
myArray(5, 10) = 0
F
21. Write code using a For...Next loop to fill a 5-by-5 matrix so that the two diagonals have
asterisks (*) in them as shown.
0 1 2 3 4
0 * *
1 * *
2 *
3 * *
4 * *
Ans: For i As Integer = 0 to 4
matrix(i, i) = "*"
matrix(i, 4 - i) = "*"
Next
Anna hade nyss fyllt sexton år, när hon en dag erhöll tillstånd af sin
mor att, i sällskap med deras värdinna och ett par af hennes
bekanta, göra en liten lustfärd på Newa. Dagen var utmärkt vacker
och sällskapet trefligt; de voro inalles fem damer samt en äldre man
med sin unga son.
De landade vid ett af de vackra lustställen, som ligga vid stranden,
intogo några förfriskningar hos Sweitzaren, och promenerade sedan
omkring till dess solen, som sänkte sig bakom de lummiga träden,
manade till hemresan. Slupen, som på bestämda timmar gjorde sina
turer, gaf sitt tecken, och våra lustfarare måste skynda sig, för att
komma i lagom tid till bryggan. Lika ifriga som de, voro några unga
herrar insvepte i slängkappor, dem man flera gånger mött under
promenaden.
Anna var händelsevis den sista som skulle stiga i slupen. I samma
ögonblick sköt en af roddarene oförsigtigtvis båten från land, och
Anna föll i vattnet.
Som blixten störtade en af de omnämnda unga herrarna fram,
kastade af sig hatt och kappa, lutade sig långt öfver relingen och
fattade tag i Annas kläder, innan hon ännu hann försvinna i det här
temmeligen djupa vattnet, som af slupens hastiga vändning kommit i
svallning. Ett utrop af förskräckelse hördes af hennes lilla sällskap;
fruntimren vredo sina händer, och deras enda manliga följeslagare
hindrades af trängseln att komma fram, ty alla de andra unga
männerna — af förenämnda sällskap — rusade till, för att
tillbakahålla den som sökte rädda flickan.
I sin ifver om honom, syntes de föga bekymra sig om henne. Deras
sakta men häftigt uttalade: «För Guds skull ers Höghet!» besvarades
af denna med ett befallande och ogillande «tyst!» De drogo sig
tillbaka, i synnerhet som ett par af båtkarlarna i detsamma upplyfte
den af en stöt mot slupen och af förskräckelse sanslösa flickan.
Inom ett ögonblick hade den unga mannen svept omkring henne
den varma duk, som han nästan ryckte från en af fruntimren, och
der ofvanpå sin egen kappa. Glömsk af sig sjelf satt han nu
fördjupad i hennes åskådande, och stödde den ännu vanmäktiga,
under det att den goda frun, under hvilkens vård Constance
anförtrott sin unga dotter, försökte alla medel att återkalla hennes
lifsandar; hvilket omsider lyckades.
Undertiden trängde sig en af hans följeslagare åter fram;
vördnadsfullt hviskade denne några ord i hans öra; dessa återförde
honom till besinning. «Du har rätt» svarade han, och svepte
skyndsamt in sig i den slängkappa denne bjöd honom, samt tryckte
hatten djupt ned öfver den höga pannan. «Likväl kan ingen här
känna igen mig, så framt ej er obetänksamhet förråder mig.»
När Anna första gången uppslog ögonen, var h a n s blick det första
hon såg; djupt rodnande sänkte hon dem åter och lutade sig mot sin
qvinliga grannes bröst. «O Gud hvad skall mamma säga, när jag
kommer hem!» hviskade hon.
«Frukta icke dyra flicka! Jag skall sjelf föra dig hem, och förbereda
din mor,» svarade han, och tillade sedan sakta, men med en röst
som trängde ända in i hennes hjerta: «Haf blott förtroende till mig,
och vänd icke bort dina milda ögon. Denna stund skall alltid vara mig
en ljuspunkt i minnets skattkammare! Säg mig hvad du heter?»
«Anna,» hviskade hon blygt.
«Tack du hulda! Det namnet var mig kärt förut; nu är det mig
dyrbart!»
Anlända till stranden, befallte han fram en hyrkusk med sin
droschka. Sedan han sjelf burit flickan ur slupen, bjöd han frun sätta
sig upp och understöda den darrande Anna. Sjelf intog han kuskens
plats, sedan han tillsagt denne och sitt följe att der afvakta hans
återkomst. Derpå frågade han efter deras boning.
Enligt sitt löfte gick han in förut, och beredde på varsamt sätt
Constance på hvad som händt, lade sedan dottern i modrens armar,
och med några knappt hörbara ord bjöd han dem farväl. De
återsågo honom aldrig.
Leonna var ock den som förstod att värdera vänskapens förtroende
och att besvara detsamma. Härtills hade Ottilia endast anat hennes
böjelse för Feodor, nu fick hon erfara allt, äfven hans uppförande
nemligen så, som det uppfattades af den älskande flickan, jemte
hennes oro öfver hans tystnad, den hon likväl tillskref
omständigheterna, ej någon glömska.
Onkel Ludvig hade rest bort. Fru Palman var installerad i sin
befattning. Leonna upphörde ej derföre med all verksamhet i
hushållet, men hon ägde mera ledighet och lugn. Modrens lynne var
sig likt, men hon blygdes att låta en fremmande höra detta jemna
gnatande, och Leonna kunde nu undvika att träffa henne allena.
Vintern var förbi; vårsolen smälte drifvan; jorden grönskade, allt
knoppades för att fira uppståndelsens högtid, och Leonnas hjerta
började äfven njuta af förnyad lefnadslust.
Man räknade de sista dagarna af Maj, när Petter Nordenskans en
dag kom till Grönskog för att be sin syster tillbringa någon tid hos
Maria, som hvarje dag väntade sin nedkomst. Sjelf måste han göra
en resa, såväl i tjenståliggande som andra affärer «på obestämd
tid,» sade han; en annan skulle under tiden sköta sysslan.
Hans far var icke af det sentimentala folket, likväl förtröt honom den
likgiltighet, sonen visade att fara bort hemifrån sin hustru vid ett
sådant tillfälle.
Leonna följde honom, men undrade inom sig, hvarföre ej Hedda
kunde vara hos sin syster. Hon erfor sedan af sin svägerska, att
Hedda hade rest hemifrån utan att någon kände hvar hon nu
vistades.
Ett besynnerligt öde syntes sväfva öfver alla Leonnas utflygter
hemifrån, ty knappt hade hon varit en vecka der, förrän hon åter
efterskickades. Den biljet, budet medförde, upplyste henne hvarföre
det skedde. Fadrens ord lydde så:
«Blif icke ängslig barn, men skynda dig hem. Mamma fick slag i natt
och har ej, efter som vi tro, många timmar qvar. Hon kan ej mera
tala, men hennes ögon irra omkring efter dig. Gumman Palman
bevisar genom hundrade exempel, att hon ej har ro förr än du
kommer! Din hulda far
Ad. Fred. v. Nordenskans.»