Question:
VISUAL BASIC ASSIGNMENT - any help appreciated?
anonymous
2013-03-11 08:36:39 UTC
1. Which statement is true regarding the following Dim statement?
Dim state(49) As String, population(49) As Double
(A) It is invalid since more than one array is dimensioned by a single Dim statement.
(B) It is invalid since the two arrays must have the same data type.
(C) The subscripts of state() range from 1 to 49.
(D) The subscripts of population() range from 0 To 49.


2. What names are displayed in the list box when the button is clicked?
Private Sub btnDisplay_Click(...) Handles btnDisplay.Click
Dim name(4) As String
Dim sr As IO.StreamReader = IO.File.OpenText("DATA.TXT")
For i As Integer = 0 To 4
name(i) = sr.ReadLine
Next
sr.Close()
lstBox.Items.Clear()
For i As Integer = 4 To 0 Step -2
lstBox.Items.Add(name(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


3. What is the output of the following program segment?
Dim num(8) As Integer
Dim total As Double
For i As Integer = 0 To 8
num(i) = i
Next
total = 0
For k As Integer = 1 To 4
total += 10 ^ num(k)
Next
txtBox.Text = CStr(total)
(A) 10000
(B) 11110
(C) 1110
(D) 0

5. What is the output of the following program segment?
Dim numbers(5), x As Integer
Dim sr As IO.StreamReader = IO.File.OpenText("DATA.TXT")
Do While sr.Peek <> -1
x = CInt(sr.ReadLine)
numbers(x) += 2
Loop
sr.Close()
txtBox.Text = CStr(numbers(3))
Assume the six rows of the file DATA.TXT contain the following entries: 5, 3, 1, 3, 1, 3, 1
(A) 4
(B) 5
(C) 6
(D) 7





6. Given the Dim statement below, which set of statements will initialize all elements of myArray() to 100?
Dim myArray(100) As Double
(A) myArray = 100
(B) For i = 0 To 100
(i) = 100
Next
(C) For j = 0 to 100
myArray(j) = 100
Next
(D) myArray() is already initialized to 100 by the Dim statement.

7. Each individual variable in the list
student(0), student(1), student(2)
is known as a(n)
(A) subscript.
(B) dimension.
(C) element.
(D) type.


8. In the statement
Dim score(30) As Double
the number 30 designates which of the following?
(A) the highest value of the subscripts of the elements for the array score().
(B) the maximum value that can be assigned to any element in the array score().
(C) the data type for the array score().
(D) the value initially assigned to each element in the array score().



9. 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

10. The GetUpperBound(0) function returns what information about an array?
(A) The highest number that can be used as a subscript for the array.
(B) The largest value that can be assigned to an array element.
(C) The number of elements in the array.
(D) The highest dimension of the array.



11. In the ordered array declared with the statement below, the value of the element namfriend(0) is equal to that of which of the other following elements?
Dim namfriend() As String = {"Fred", "Fred", "fred", "fred"}
(A) namfriend(1)
(B) namfriend(2)
(C) namfriend(3)
(D) namfriend(4)

12. A program contains the lines
Select Case list1(m)
Case Is < list2(n)
newlist(r) = list1(m)
In this section of the program, the value of the mth element of the array list1() will be added into the array newlist() if which of the following is true?
(A) the nth element of list2() is less than the mth element of list1()
(B) the nth element of list2() is greater than the mth element of list1()
(C) the nth element of list2() is equal to the mth element of list1()
(D) the mth element of list1() is greater than the nth element of list2()




13. 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


14. Each of the following statements declares a control array except one. Which of the following statements does not create a control array?
(A) Dim lblTitle(10) As Label
(B) Dim btnAmount() As Button
(C) Dim txtNumber(8) As TextBox
(D) Dim score(5) As Integer
Four answers:
Saman
2013-03-11 08:40:56 UTC
Write answers to all of these questions!
anonymous
2016-10-03 03:43:26 UTC
A portray organization has desperate that for each one hundred fifteen sq. ft of wall area,one gallon of paint and eight hours of exertions are required. the organization rates $ 18.00 consistent with hour for exertions. Create an utility that helps the consumer to flow into the style of rooms to be painted and the cost of the paint consistent with gallon. the utility would desire to apply enter packing boxes to ask the consumer for the sq. ft of wall area in each and each room. it would then demonstrate here counsel: . The form of gallon of paint required . The hours of exertions required . the cost of paint . The exertions rates . the entire value of the paint activity Invalid enter: do not settle for a value under a million for the style of rooms. do not settle for a value under $ 10.00 for the cost of paint . do not settle for a damaging fee for sq. photos of wall area.
?
2013-03-11 08:41:22 UTC
At least try to answer and give some sort of rationale instead of blindly posting your homework.
Strider
2013-03-11 17:39:14 UTC
Try answering it...



Dont just sleep in class... ^_^


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...