Visual Basic Questions

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadlines.


Order a Similar Paper Order a Different Paper

puja

 

12.Which format statement should be used when you want to output your results in tabular format with the first column 10 characters wide, the second 5, and the third 10?

 

a.Dim fmtStr as String = “{10}{5}{10}”

b.Dim fmtStr as String = “{0}{1}{2}”

c.Dim fmtStr as String = “{0, 10}{1, 5}{2, 10}”

d.Dim fmtStr as String = “{0, 10; 1, 5; 2, 10}”

 

37.What is wrong with the following program segment?

Dim name, number As String

Dim sr As IO.StreamReader = IO.File.OpenText(“PHONEDIR.TXT”)

name = sr.ReadLine

number = sr.ReadLine

Do While sr.Peek <> -1

  If name = “Jim” Then

    txtBox.Text = “Jim’s number is ” & number

  End If

name = sr.ReadLine

number = sr.ReadLine

Loop

sr.Close()

 

a.number should be a numeric variable

b.If Jim’s name and number are the last two entries in the file, they will not be processed by the If statement

c.The Do While loop should have been replaced by a Do…Until loop

d.There is nothing wrong with the program segment

 

 

38.Assume FILE1.TXT and FILE2.TXT are sequential files containing numeric data.  Based on what you think the following segment does, what would be a good use for it?

Dim sr1 As IO.StreamReader = IO.File.OpenText(“FILE1.TXT”)

Dim sr2 As IO.StreamReader = IO.File.OpenText(“FILE2.TXT”)

Dim ans1, ans2 As String

Dim c As Integer = 0

Do While (sr1.Peek <> -1) And (sr2.Peek <> -1)

  ans1 = sr1.ReadLine

  ans2 = sr2.ReadLine

  If ans1 <> ans2 Then

    c += 1

  End If

Loop

sr1.Close()

sr2.Close()

txtBox.Text = CStr(c)

 

a.Compare an answer key file to a student answer file to count the questions that the student answered CORRECTLY.

b.Compare an answer key file to a student answer file to count the questions that the student answered INCORRECTLY.

c.Count the total number of lines in the two files.

d.Count the total number of items in the two files.

 

"Is this question part of your assignment? We can help"

ORDER NOW
Writerbay.net

Do you need help with this or a different assignment? We offer CONFIDENTIAL, ORIGINAL (Turnitin/LopesWrite/SafeAssign checks), and PRIVATE services using latest (within 5 years) peer-reviewed articles. Kindly click on ORDER NOW to receive an A++ paper from our masters- and PhD writers.

Get a 15% discount on your order using the following coupon code SAVE15


Order a Similar Paper Order a Different Paper