Computer Science Department/JUST

CS 215

Dr. Monther Aldwairi

Quize 7(7/20/2008)

 

Name:__________________________________________

 

What is the output of the following code?

    Sub Main()

        Dim i As Integer

        Dim array1 As Integer() = New Integer() {1, 2, 3, 4, 5}

        Dim array2 As Integer() = New Integer() {1}

        Console.WriteLine(array1.GetUpperBound(0))

        Console.WriteLine(array1.GetUpperBound(0))

        Console.WriteLine(array2.GetUpperBound(0))

        Console.WriteLine(array2.GetUpperBound(0))

        For i = 1 To array1.GetUpperBound(0)

            array1(i) = array1(i - 1)

        Next

 

        For i = 0 To array1.GetUpperBound(0)

            Console.Write(array1(i) & vbTab)

        Next

        Console.WriteLine()

        array2 = array1

        For i = 0 To array2.GetUpperBound(0)

            Console.Write(array2(i) & vbTab)

        Next

    End Sub

 

 

Answers:

 

4

4

0

0

1       1       1       1       1

1       1       1       1       1