Explore these 30 engaging MCQs to test your knowledge of Basic Input/Output in VB.NET. Covering Console usage, file handling, and output formatting, this quiz helps strengthen your programming basics!
Console.WriteLine do in VB.NET?
Console.ReadLine but no input is provided?
nullConsole.WriteLine statement?
{}$File.Create method do?
StreamReader class?StreamWriter after use?StreamWriter.CloseStreamWriter.DisposeStreamWriter.FlushStreamWriter?F2.ToString("F2")Format(2)Round(2)String.Format method?.ToString("%").ToString("P").Format("%").ToString("F%")\n\r\t\l.ToString("C").Format("Currency")"$" + Value.ToCurrency()Console.WriteLine uses {0} as a placeholder?"\t""Tab""\b""Space(4)".ToString("D4") for the value 5?00050055.000D0005$#*&"E" format specifier represent?.Trim().Cut().Remove().Clean()("C").ToString("(#)").ToString("N0").ToString("#,##0.00;(#,##0.00)").Round().ToInteger().ToString("F0").RoundInt()| Qno | Answer (Option with the text) |
|---|---|
| 1 | B. Console.ReadLine |
| 2 | B. Writes output with a newline |
| 3 | C. Console.Clear |
| 4 | C. Returns an empty string |
| 5 | D. Both B and C |
| 6 | B. StreamWriter |
| 7 | A. Creates and opens a file |
| 8 | D. File.ReadAllLines |
| 9 | B. File.AppendText |
| 10 | B. Creates a new file |
| 11 | A. System.IO |
| 12 | B. Reading text from a stream |
| 13 | D. Both A and B |
| 14 | C. Throws an exception |
| 15 | B. File.Delete |
| 16 | B. .ToString(“F2”) |
| 17 | C. PadLeft/PadRight |
| 18 | B. Formats strings |
| 19 | B. .ToString(“P”) |
| 20 | A. \n |
| 21 | A. .ToString(“C”) |
| 22 | D. Inserts the first argument |
| 23 | A. \t |
| 24 | A. 0005 |
| 25 | A. String.PadLeft/String.PadRight |
| 26 | B. # |
| 27 | A. Exponential notation |
| 28 | A. .Trim() |
| 29 | D. .ToString(“#,##0.00;(#,##0.00)”) |
| 30 | A. .Round() |