Programming Quiz (6)

0 comments

1 .  In array items, which of the following expressions will retrieve the value at row 3 and column 5?

 

A.  items( 3 ).( 5 )

B.  items( 3( 5 ) )

C.  items( 3 )( 5 )

D.  items( 3, 5 )

2.  The number in parentheses after an array name is the __________ of the item in the array.

 

A.  value

B.  position

C.  size

D.  length

3.  What is the proper For Each…Next header format?

 

A.  For Each Type in arrayName

B.  For Each arrayName

C.  For Each type_identifer As Type In arrayName

D.  For Each Type

4.  Consider the code below:

 

Dim a(9) As Integer

For i As Integer = 0 To a.Length – 1

a(i) = i + 2

Next

Dim result As Integer = 0

For i As Integer = 0 To a.Length – 1

result += a(i)

Next

 

The value of variable result will be __________.

A.  62

B.  64

C.  65

D.  67

5.  Which of the following correctly accesses element 13 of array Book?

 

A.  Book(0) + 13

B.  Book(13)

C.  Book[13]

D.  (13)Book

6.  Consider the code below:

Dim a() As Integer = {99, 22, 11, 3, 11, 55, 44, 88, 2, -3}

Dim result As Integer = 0

For i As Integer = 0 To a.Length – 1

If a(i) > 30 Then

result += a(i)

End If

Next

 

The value of variable result will be __________.

A.  280

B.  154

C.  286

 

D.  332

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}