Skip to main content

File Handling And Input Output In C Sharp — Part 2 MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on File Handling And Input Output In C Sharp — Part 2 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.

Questions
40
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
48 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
40

Verified Practice Questions

Interactive test mode with detailed academic worked solutions

Live Progress | 0/40 answered
✓ 0 correct ✗ 0 wrong 0% score
Question 1 of 40
★ FPSC ★ PPSC

What will be the output of the following C# code snippet? static void Main(string[] args) { StringBuilder sb = new StringBuilder("hello world"); sb.Insert(6, "good"); Console.WriteLine(sb); Console.ReadLine(); }

Question 2 of 40
★ FPSC ★ PPSC

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

Question 3 of 40
★ FPSC ★ PPSC

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

Question 4 of 40
★ FPSC ★ PPSC

What will 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(); }

Question 5 of 40
★ FPSC ★ PPSC

Choose the object of TextReader class.

Question 6 of 40
★ FPSC ★ PPSC

Which of the following is the correct statement about inspecting an attribute in C#.NET?

Question 7 of 40
★ FPSC ★ PPSC

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

Question 8 of 40
★ FPSC ★ PPSC

Which among the following methods are used to write characters to a string?

Question 9 of 40
★ FPSC ★ PPSC

The correct method to pass a parameter to an attribute is?

Question 10 of 40
★ FPSC ★ PPSC

Which among the following attempts to read up to count bytes into buffer starting at buffer[offset], returning the number of bytes successfully read?

Question 11 of 40
★ FPSC ★ PPSC

Which method of the character stream class returns the numbers of characters successfully read starting at index?

Question 12 of 40
★ FPSC ★ PPSC

Which method among the following returns the integer if no character is available?

Question 13 of 40
★ FPSC ★ PPSC

Choose the correct statement about the WriteLine()?

Question 14 of 40
★ FPSC ★ PPSC

Select the method which returns the number of bytes from the array buffer:

Question 15 of 40
★ FPSC ★ PPSC

Which of these classes is used to create an object whose character sequence is mutable?

Question 16 of 40
★ FPSC ★ PPSC

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(); }

Question 17 of 40
★ FPSC ★ PPSC

Which of these classes are used by Byte streams for input and output operation?

Question 18 of 40
★ FPSC ★ PPSC

Which among the following is used for storage of unmanaged memory aspects?

Question 19 of 40
★ FPSC ★ PPSC

Select the namespace on which the stream classes are defined?

Question 20 of 40
★ FPSC ★ PPSC

Select the method used to write single byte to a file?

Question 21 of 40
★ FPSC ★ PPSC

Choose the filemode method which is used to create a new output file with the condition that the file with same name if exists will destroy the old file:

Question 22 of 40
★ FPSC ★ PPSC

Which method of character stream class returns the numbers of characters successfully read starting at count?

Question 23 of 40
★ FPSC ★ PPSC

To apply an attribute to an Assembly, the correct way of implementation is?

Question 24 of 40
★ FPSC ★ PPSC

Choose the filemode method which is used to create a new output file with the condition that the file with same name must not exist.

Question 25 of 40
★ FPSC ★ PPSC

Which among the following classes are used to perform the character based file operations?

Question 26 of 40
★ FPSC ★ PPSC

Name the method which returns integer as -1 when the end of file is encountered.

Question 27 of 40
★ FPSC ★ PPSC

Which of these is a method used to clear all the data present in output buffers?

Question 28 of 40
★ FPSC ★ PPSC

Attributes could be applied to . . . . . . . .

Question 29 of 40
★ FPSC ★ PPSC

Which of these method/methods are used to read block or array of bytes from the file?

Question 30 of 40
★ FPSC ★ PPSC

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

Question 31 of 40
★ FPSC ★ PPSC

Name the exception thrown by read() on failure.

Question 32 of 40
★ FPSC ★ PPSC

Name the method/methods used to read byte streams from the file?

Question 33 of 40
★ FPSC ★ PPSC

The [Serializable()] attributes gets inspected at . . . . . . . .

Question 34 of 40
★ FPSC ★ PPSC

Select the method which writes the contents of the stream to the physical device.

Question 35 of 40
★ FPSC ★ PPSC

What is the output returned by Console if ReadLine() stores I/O error?

Question 36 of 40
★ FPSC ★ PPSC

Which among the following cannot be a target for a custom attribute?

Question 37 of 40
★ FPSC ★ PPSC

Choose the class on which all stream classes are defined?

Question 38 of 40
★ FPSC ★ PPSC

Which of these classes is used for input and output operation when working with bytes?

Question 39 of 40
★ FPSC ★ PPSC

Which method in Console enables to read individual inputs directly from the keyboard in a non line buffered manner?

Question 40 of 40
★ FPSC ★ PPSC

Select the objects of the class TextWriter which is/are not used to perform the write operations to the console?

✓ Link copied to clipboard
Continue Your Practice

Advance Html — Part 1

Master the next curriculum module with 40 exam-standard MCQs.

Next Practice Set →

💡 Examiner's Advisory for Programming & Software Development

In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.

More Modules in Programming & Software Development

View All →
📚

Study Guides

Topic summaries and syllabus breakdown

Explore Guides →
🎯

Complete Library

Search through 78,000+ verified MCQs

Browse Library →
📱

Mobile App

Offline mock tests and instant bookmarks

Get Mobile App →