adplus-dvertising

Welcome to the Console IO and Stream Classes MCQs Page

Dive deep into the fascinating world of Console IO and Stream Classes with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Console IO and Stream Classes, a crucial aspect of C# programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Console IO and Stream Classes, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within C# programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Console IO and Stream Classes. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of C# programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Console IO and Stream Classes. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Console IO and Stream Classes MCQs | Page 3 of 8

Explore more Topics under C# programming

Q21.
Choose the methods provided by Console.Out and Console.Error?
Discuss
Answer: (d).Write & WriteLine
Q22.
Choose the output for the following set of code?
static void Main(string[] args)
 {
     Console.WriteLine("This is a Console Application:");
     Console.Write("Please enter your lucky number:");
     string val1 = Console.ReadLine();
     int val2 = System.Convert.ToInt32(val1, 10);
     val2 = val2 * val2;
     Console.WriteLine("square of number is:" +val2);
     Console.Read();
 }
Discuss
Answer: (c).Runs successfully, ask for input and hence displays the result
Q23.
Name the exception thrown by read() on failure.
Discuss
Answer: (d).I/O Exception
Q24.
Which of these methods are used to read single character from the console?
Discuss
Answer: (c).read()
Q25.
Which of these method used to read strings from the console?
Discuss
Answer: (d).readLine()
Q26.
Which among the following methods are used to write characters to a string?
Discuss
Answer: (c).StringWriter
Q27.
Which method in Console enables to read individual inputs directly from the keyboard in a non line buffered manner?
Discuss
Answer: (b).ReadKey()
Q28.
What is the output returned by Console if ReadLine() stores I/O error?
Discuss
Answer: (d).I/O EXCEPTION ERROR
Q29.
What would be the output for following input from the console as a character?
static void Main(string[] args)
 {
     Console.WriteLine("what is your name?");
     char s;
     s = Convert.ToChar(Console.ReadLine());
     Console.WriteLine("how are you: "+s);
     Console.Read();
 }
Discuss
Answer: (d).Run time error
Q30.
Name the method/methods used to read byte streams from the file?
Discuss
Answer: (a).ReadByte()
Page 3 of 8

Suggested Topics

Are you eager to expand your knowledge beyond C# programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!