0 ratings0% found this document useful (0 votes) 29 views16 pagesOne Dimensional Arrays
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
Question
Ansner saved
Fag question
Have a look at the following code:
Dim sales() As Integer = (10, 20, 30, 40, 50)
Select the statements to increase all elements in the array by 55
Select one!
@ a.
For cnt As Integer = 0 To sales.Length - 1
sales(cnt) = salesent) +55
Next ent
Ob.
None of the answers,
oO.
For ent As Integer = 0 To sales.Length-1awestion3
Answer snved
Marked outof
100
¥ lagquesion
Have a lok atthe following code:
Dim sales0 As integer = (1, 2,3, 4,5)
For cnt As Integer = 0 To sales.Length -1
sales(cnt) = salescent) + 109,
Next ent
What data will now be saved in the sales(5)?
Select one:
a: nothing. That subscipvindex does not exist
© b.100
.none ofthe answers
as
@ 2105
F106
«another number»
auestond
Aooner saved
Mase curt
100
F Feg question
25. Assume that the items array is declared using the statement:
Private Aritems{45) As String.
‘Which of the following statements will assing "Sue" to the LAST element of the array?
Select one:
O B."Sue"=Antemsi4a)
CC. Aritems(o) = "Sue"
© D.Arttemsias) = "sue"
© Enone ofthe answers
OF. "sue" = aritems(a5)
G.Arttems(45) = Sue
H. Arltems(43) = "Sue"
Sue" = Aritems(1)
J. "Sue" = Artterst)
K. Arltems(1) = "Sue"
ue" = Aritems(0)cuesionS
Anew eves
Maries oueat
100
YF Fag quescon
Have a look at the following code:
Dim sales() As Double = (100, 200, 300, 400, 500}
For ent As Integer = 0 To sales.Length -1
sales(ent) = sales(cnt) + sales(ent)* 0.10
Next ent
‘What will this code do?
Select one:
© a.increase all elements in the array by R10
. none of the answers
decrease all elements in the array by RO.10
© di decrease all elements in the array by R10
)e, decrease all elements in the array by 10%
@ _ f.increase all elements in the array by 10%
© g Increase all elements in the array by R010Question 6
osvier saved
Marked out of
100
¥ Reg question
Have a look at the following code:
Dim sales(@) As Integer
Select the statements (0 initalise the array with the values
sales(0)= 1
sales(i)=2
sales(2)=3
sales(3)=4
sales(d)=5
Select one:
For ent As integer = 0 To sales.Length -1
sales = ent
Next ent
@ »b
For ent As Integer =0 To sales.Length- 1
salesient) = (ent +1)ueton B 24, Declare + create an array with 500 elements
°
store integer data at class level
A. Private ArData(500)as Inceger
8. Private ArDeta(498) as Integer
Private ArDatat as integer = (500)
D. Private ArDatal499)as Integer
Priv
‘AcData(S0!) a5 In
ArData() as Integer
G. none of thEach element in an array of intagersie automatically int
Select one
are
® 20
oat
© D.NothingQuestion 10
Anevar eaves
Mares outet
4, Assume the following array declaration:
Dim sales() As Integer ~ (10000, 12000, 900, 500, 20000)
Select the If clause that can be used to verify that the array subscript, named counter, is valid for the
sales array?
Select one:
© Alfcounter>= 1 AndAlso caunter> saleslengtn 1 Then
© B.lfcounter=0 Ortise counter = 4Then
© Clfeounter>=0 Then
D. none of the answ
@ E:tfcounter>= 0 AndAlso counter igth- 1 Then
F. if counter < sales ength -1 Then
OG Ifeounter=0 Andalso
winter =4 Ther
CFAueston 11 Have a look at the folowing code:
Dim sales()As Double = (10, 20, 3, 40, SO}
Select the statements to increase all eleme:
s inthe array by 50%
Select ore:
For ent As integer = 0To sales.Length -1
ele 50%
Next ent
o.8
For ent As integer = To sales.Length
ales{cri)* 2.50
@«
Forent As integer =0 To sales Length -1
satesien alesient)* 2.50
Nextent
A adASDSVIAY ASBDYIC: Development Software 1.2 (VB Mod
) Clase Taste > Claze Test One Dimensional Arrays (10:00- 19:00
ution 12 Have alaok at the folloning cade:
Dim sales As integer = {1,2,3, 4,5)
For cnt As ineger = 0To sales.Length - 1
saleslent) = sales(ers)+ 100,
Nextent
be save in the Sales2) after the loop is execued?
1
Lavesien3 |. Wich of he following statements ceclares a one-dmensional array named values that contsine
nsveriaes || senelemencs
aciec oust
a0
PF Fagquesion
Select one:
© ADimvaiues(i0) As Decimal
8. Dim values(9) As Decimal
45780)
(2.990, 5890, 6780, 8
45.780,2.99D, 5.890, 6.780, 8450,
Dim values) As Decimal= {5 89D, 6.780, 8.450 45 780,2.900, 5 86D, §78D, 8.450, 45 780}
. None of the answ
E. Dim values) As Decimal = {100}
© Fbim
jer 1) As Dacia
@ —G Dimvaiues9) As Decimal
)-H Dimvaiues0) As Decimal
LTRSuestn 14
The first variable ina one-dimensional array is assigned a subscript
eof
Select one:
® Ao
P esau oO 84
oO C2
0.3oussion 15)
Markee outa
cy
Fig guest
9. Assume the fellewing declarations:
Dim numbers)
As integer
10.5
Dimsumas irs
Dim counter as Integer
Dimaverage es Double
For counter = 1 to numbers.length -1
‘sum = sum + numbers(counter)
Next counter
MessageBox Showisum)
LOOK CAREFULLY ATTHE CODE. What will be displayed by the ltt ine in the dialog box?
answer: [14
1 SS23. Assume that the Items array is declared using the statement:
Private Aritems(99) As String.
Select the best For clause to process the loop instructions for each element in the array.
select one:
© AFor counter as integer = 0 to 98
© _ B.Forcounter as integer = 0 to 100
© G.Forcounter as integer = 1 to 99
D. For counter as integer
to 101
E. For counter as integer = 0 to 99
F.none of the answersAxrempts allowed: 2
This quit opened at Tuesday, 1 December 2020, 10:00 AN
This quit will lose at Tuesday, / December 2020, 7:00 PM
Time lit 40 mins
Grading method: Last atzempt
Summary of your previous attempts
Attempt State Grade /15.00 Review
1
Finished 13.00
Submitted Tuesday, 1 December 2020, 3:30 PM
Last attempt: 13.00 / 15.00.