Visual Basic Questions
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.
Our guarantees
Study Acers provides students with tutoring and help them save time, and excel in their courses. Students LOVE us!No matter what kind of essay paper you need, it is simple and secure to hire an essay writer for a price you can afford at StudyAcers. Save more time for yourself. Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
Money-back guarantee
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreZero-plagiarism guarantee
Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreFree-revision policy
Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read morePrivacy policy
Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreFair-cooperation guarantee
By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more