My Report

C# I/O Operation Test – 1


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement

1. Choose the object of TextReader class.

2. Choose the object/objects defined by the Textwriter class.

3. Select the correct methodS provided by Console.In?

4. Choose the output returned when an error condition is generated while read() reads from the console.

5. Which of the given stream methods provide access to the input console in C#.NET?

6. Which of the classes provide the operation of reading from and writing to the console in C#.NET?

7. Choose the output returned when read() reads the character from the console?

8. What will be the output of the following C# code?

 static void Main(string[] args)
 {
     int a = 10, b = 0;
     int result;
     Console.Out.WriteLine("This will generate an exception.");
     try
     {
         result = a / b; // generate an exception
     }
     catch (DivideByZeroException exc)
     {
         Console.Error.WriteLine(exc.Message);
     }
     Console.ReadLine();
 }

9. Which of the given stream methods provide access to the output console by default in C#.NET?

10. Choose the methods provided by Console.Out and Console.Error?

11. What will be the output of the following C# 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();
 }

12. The number of input methods defined by the stream method Console.In in C#.NET is?


 

Start practicing “1000 MCQs on C#”, and once you are ready, you can take tests on all topics by attempting our “C# Test Series”.

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.