InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Which of the following is used to perform all input & output operations in C#?(a) streams(b) Variables(c) classes(d) MethodsI had been asked this question in my homework.Query is from Character Stream topic in division Console I/O Operations and Stream Classes of C# |
|
Answer» CORRECT option is (a) streams The best explanation: Streams are used for INPUT and output operations in any PROGRAMMING language. |
|
| 2. |
Which method among the following returns the integer if no character is available?(a) int peek()(b) int read()(c) string ReadLine()(d) none of the mentionedI have been asked this question in an internship interview.My question is from Character Stream in division Console I/O Operations and Stream Classes of C# |
|
Answer» The correct CHOICE is (a) int peek() |
|
| 3. |
Which method of character stream class returns the numbers of characters successfully read starting at count?(a) int Read()(b) int Read(char[] buffer, int index, int count)(c) int ReadBlock(char[ ] buffer, int index, int count)(d) none of the mentionedThis question was addressed to me in my homework.My question comes from Character Stream topic in portion Console I/O Operations and Stream Classes of C# |
|
Answer» The CORRECT answer is (B) int Read(char[] BUFFER, int index, int count) |
|
| 4. |
Which method of the character stream class returns the numbers of characters successfully read starting at index?(a) int Read()(b) int Read(char[] buffer, int index, int count)(c) int ReadBlock(char[ ] buffer, int index, int count)(d) none of the mentionedThis question was posed to me in semester exam.This is a very interesting question from Character Stream topic in chapter Console I/O Operations and Stream Classes of C# |
|
Answer» The CORRECT ANSWER is (C) int ReadBlock(char[ ] buffer, int INDEX, int count) |
|
| 5. |
Which of these is a method used to clear all the data present in output buffers?(a) clear()(b) flush()(c) fflush()(d) close()I had been asked this question in homework.My question comes from Character Stream in chapter Console I/O Operations and Stream Classes of C# |
|
Answer» CORRECT ANSWER is (b) flush() The EXPLANATION is: None. |
|
| 6. |
Which among the following classes are used to perform the character based file operations?(a) StreamReader(b) InputReaderWriter(c) OutputStream(d) All of the mentionedThis question was posed to me in unit test.This intriguing question comes from Character Stream in chapter Console I/O Operations and Stream Classes of C# |
|
Answer» The CORRECT option is (a) StreamReader |
|
| 7. |
The advantages of using character stream based file handling are?(a) they operate directly on unicode characters(b) they operate directly on bits(c) they store unicode text(d) all of the mentionedI got this question in an online quiz.Origin of the question is Character Stream topic in section Console I/O Operations and Stream Classes of C# |
|
Answer» Right answer is (a) they OPERATE directly on unicode characters |
|
| 8. |
From which of these classes, the character based output stream class Stream Writer is derived?(a) TextWriter(b) TextReader(c) Character Stream(d) All of the mentionedThe question was asked in exam.This key question is from Character Stream in division Console I/O Operations and Stream Classes of C# |
|
Answer» The correct CHOICE is (a) TEXTWRITER |
|
| 9. |
Which of these is a method used to clear all the data present in output buffers?(a) clear()(b) flush()(c) fflush()(d) close()I have been asked this question during an interview.The doubt is from Byte Stream in portion Console I/O Operations and Stream Classes of C# |
|
Answer» The correct ANSWER is (b) FLUSH() |
|
| 10. |
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:(a) FileMode.CreateNew(b) FileMode.Create(c) FileMode.OpenOrCreate(d) FileMode.TruncateThis question was addressed to me at a job interview.This is a very interesting question from Byte Stream topic in division Console I/O Operations and Stream Classes of C# |
|
Answer» The CORRECT CHOICE is (b) FileMode.Create |
|
| 11. |
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.(a) FileMode.CreateNew(b) FileMode.Create(c) FileMode.OpenOrCreate(d) FileMode.TruncateThis question was addressed to me in final exam.Query is from Byte Stream in portion Console I/O Operations and Stream Classes of C# |
|
Answer» Correct option is (a) FileMode.CreateNew |
|
| 12. |
Which property among the following represents the current position of the stream?(a) long Length(b) long Position(c) int Length(d) all of the mentionedThe question was asked in my homework.Question is taken from Byte Stream in section Console I/O Operations and Stream Classes of C# |
|
Answer» The correct ANSWER is (a) long LENGTH |
|
| 13. |
Which among the following is used for storage of unmanaged memory aspects?(a) BufferedStream(b) FileStream(c) MemoryStream(d) UnmanagedMemoryStreamThe question was posed to me in an interview.Asked question is from Byte Stream in division Console I/O Operations and Stream Classes of C# |
|
Answer» Correct option is (d) UnmanagedMemoryStream |
|
| 14. |
Which among the following is used for storage of memory aspects?(a) BufferedStream(b) FileStream(c) MemoryStream(d) None of the mentionedThe question was posed to me by my college director while I was bunking the class.My enquiry is from Byte Stream in chapter Console I/O Operations and Stream Classes of C# |
|
Answer» Right CHOICE is (C) MemoryStream |
|
| 15. |
Which of these classes is used for input and output operation when working with bytes?(a) InputStream(b) Reader(c) Writer(d) All of the mentionedI have been asked this question during an interview.The query is from Byte Stream topic in chapter Console I/O Operations and Stream Classes of C# |
|
Answer» Correct CHOICE is (a) INPUTSTREAM |
|
| 16. |
Which of these data types is returned by every method of OutputStream?(a) int(b) float(c) byte(d) none of the mentionedI have been asked this question by my college director while I was bunking the class.The origin of the question is Byte Stream in portion Console I/O Operations and Stream Classes of C# |
|
Answer» Correct OPTION is (d) NONE of the mentioned |
|
| 17. |
Which of these classes is used to read and write bytes in a file?(a) FileReader(b) FileWriter(c) FileInputStream(d) InputStreamReaderI had been asked this question during an interview for a job.This question is from Byte Stream topic in division Console I/O Operations and Stream Classes of C# |
|
Answer» CORRECT CHOICE is (C) FileInputStream Explanation: NONE. |
|
| 18. |
Select the action of the method long seek()?(a) Attempts to readup to count bytes into buffer starting at buffer[offset](b) Writes a single byte to an output stream(c) Sets the current position in the stream to the specified offset from specified origin and hence returns the new position(d) None of the mentionedI have been asked this question in final exam.I want to ask this question from Introduction of Stream Classes in portion Console I/O Operations and Stream Classes of C# |
|
Answer» The CORRECT ANSWER is (c) Sets the current position in the stream to the SPECIFIED offset from specified origin and HENCE returns the new position |
|
| 19. |
Select the statements which define the stream.(a) A stream is an abstraction that produces or consumes information(b) A stream is linked to a physical device by the I/0 system(c) C# programs perform I/O through streams(d) All of the mentionedThe question was asked in a national level competition.This is a very interesting question from Introduction of Stream Classes in chapter Console I/O Operations and Stream Classes of C# |
|
Answer» CORRECT ANSWER is (d) All of the mentioned The EXPLANATION is: NONE. |
|
| 20. |
Name the method which returns integer as -1 when the end of file is encountered.(a) int read()(b) int ReadByte()(c) void readbyte()(d) none of the mentionedThe question was asked during an interview.The origin of the question is Introduction of Stream Classes topic in section Console I/O Operations and Stream Classes of C# |
|
Answer» The correct option is (b) int ReadByte() |
|
| 21. |
Select the method which returns the number of bytes from the array buffer:(a) void WriteByte(byte value)(b) int Write(byte[] buffer, int offset, int count)(c) write()(d) none of the mentionedI had been asked this question in class test.The origin of the question is Introduction of Stream Classes topic in division Console I/O Operations and Stream Classes of C# |
|
Answer» CORRECT option is (b) int Write(byte[] buffer, int offset, int count) Best explanation: Writes a subrange of count bytes from the ARRAY buffer, beginning at buffer[offset], RETURNING the NUMBER of bytes written. |
|
| 22. |
Select the method which returns the number of bytes from the array buffer:(a) void WriteByte(byte value)(b) int Write(byte[] buffer, int offset, int count)(c) write()(d) none of the mentionedI got this question in semester exam.Query is from Introduction of Stream Classes topic in division Console I/O Operations and Stream Classes of C# |
| Answer» | |
| 23. |
Select the method which writes the contents of the stream to the physical device.(a) fflush()(b) void fflush()(c) void Flush()(d) flush()This question was posed to me during an interview for a job.I would like to ask this question from Introduction of Stream Classes topic in portion Console I/O Operations and Stream Classes of C# |
|
Answer» Correct ANSWER is (c) void FLUSH() |
|
| 24. |
The method used to write a single byte to an output stream?(a) void WriteByte(byte value)(b) int Write(byte[] buffer ,int offset ,int count)(c) write()(d) none of the mentionedThis question was posed to me in an online quiz.My question comes from Introduction of Stream Classes in section Console I/O Operations and Stream Classes of C# |
|
Answer» RIGHT CHOICE is (a) void WriteByte(byte value) The EXPLANATION is: Writes a SINGLE byte to an OUTPUT stream. |
|
| 25. |
Choose the stream class method which is used to close the connection?(a) close()(b) static close()(c) void close()(d) none of the mentionedI got this question during an interview.The doubt is from Introduction of Stream Classes topic in portion Console I/O Operations and Stream Classes of C# |
|
Answer» Correct option is (C) void close() |
|
| 26. |
Choose the class on which all stream classes are defined?(a) System.IO.stream(b) Sytem.Input.stream(c) System.Output.stream(d) All of the mentionedThe question was posed to me in homework.This key question is from Introduction of Stream Classes in portion Console I/O Operations and Stream Classes of C# |
|
Answer» Correct answer is (a) System.IO.stream |
|
| 27. |
Select the namespace on which the stream classes are defined?(a) System.IO(b) System.Input(c) System.Output(d) All of the mentionedThe question was asked by my college professor while I was bunking the class.The question is from Introduction of Stream Classes in section Console I/O Operations and Stream Classes of C# |
|
Answer» The correct ANSWER is (a) System.IO |
|
| 28. |
Select the namespace/namespaces which consists of methods like Length(), Indexer(), Append() for manipulating the strings.(a) System.Class(b) System.Array(c) System.Text(d) None of the mentionedI got this question during an interview for a job.The question is from Writing Console Output Operations topic in section Console I/O Operations and Stream Classes of C# |
|
Answer» The correct OPTION is (c) System.Text |
|
| 29. |
Which of these classes is used to create an object whose character sequence is mutable?(a) String()(b) StringBuilder()(c) String() & StringBuilder()(d) None of the mentionedThe question was posed to me during an interview.My question is from Writing Console Output Operations in section Console I/O Operations and Stream Classes of C# |
|
Answer» Right answer is (b) StringBuilder() |
|
| 30. |
Which of the following statement is correct?(a) reverse() method reverses some characters(b) reverseall() method reverses all characters(c) replace() method replaces all instances ofa character with new character(d) replace() method replaces first occurrence of a character in invoking string with another characterThis question was posed to me in examination.The doubt is from Writing Console Output Operations in chapter Console I/O Operations and Stream Classes of C# |
|
Answer» The CORRECT OPTION is (c) replace() method replaces all instances ofa character with NEW character |
|
| 31. |
Choose the correct statement about the WriteLine()?(a) Can display one or more value to the screen(b) Adds a newline character at the end of the each new output(c) Allows to output data in as many different formats(d) All of the mentionedThis question was addressed to me by my college director while I was bunking the class.This key question is from Writing Console Output Operations in division Console I/O Operations and Stream Classes of C# |
|
Answer» CORRECT CHOICE is (d) All of the mentioned Easiest EXPLANATION - By the DEFINITION of WRITELINE(). |
|
| 32. |
Which of these classes are used by Byte streams for input and output operation?(a) InputStream(b) InputOutputStream(c) Reader(d) All of the mentionedThe question was asked in an interview for internship.My question is taken from Reading Console Input Operations in division Console I/O Operations and Stream Classes of C# |
|
Answer» Right answer is (b) InputOutputStream |
|
| 33. |
Name the method/methods used to read byte streams from the file?(a) ReadByte()(b) Read(c) Readkey()(d) None of the mentionedThe question was asked by my college professor while I was bunking the class.Question is from Reading Console Input Operations in section Console I/O Operations and Stream Classes of C# |
|
Answer» The CORRECT ANSWER is (a) ReadByte() |
|
| 34. |
What is the output returned by Console if ReadLine() stores I/O error?(a) 1(b) 0(c) False(d) I/O EXCEPTION ERRORI have been asked this question in homework.My question is from Reading Console Input Operations topic in section Console I/O Operations and Stream Classes of C# |
|
Answer» The CORRECT ANSWER is (d) I/O EXCEPTION ERROR |
|
| 35. |
Which method in Console enables to read individual inputs directly from the keyboard in a non line buffered manner?(a) Read()(b) ReadKey()(c) ReadLine()(d) All of the mentionedThis question was posed to me in a national level competition.This intriguing question originated from Reading Console Input Operations in division Console I/O Operations and Stream Classes of C# |
|
Answer» The correct option is (b) ReadKey() |
|
| 36. |
Which among the following methods are used to write characters to a string?(a) StreamWriter(b) StreamReader(c) StringWriter(d) None of the mentionedThe question was asked in unit test.This interesting question is from Reading Console Input Operations topic in section Console I/O Operations and Stream Classes of C# |
|
Answer» The CORRECT CHOICE is (C) StringWriter |
|
| 37. |
Which of these method used to read strings from the console?(a) get()(b) getline()(c) read()(d) readLine()This question was addressed to me in unit test.I'd like to ask this question from Reading Console Input Operations topic in section Console I/O Operations and Stream Classes of C# |
|
Answer» CORRECT ANSWER is (d) READLINE() Best EXPLANATION: None. |
|
| 38. |
Which of these methods are used to read single character from the console?(a) get()(b) getline()(c) read()(d) readLine()The question was posed to me by my school teacher while I was bunking the class.My question comes from Reading Console Input Operations topic in section Console I/O Operations and Stream Classes of C# |
|
Answer» RIGHT answer is (C) READ() EASY explanation - NONE. |
|
| 39. |
Name the exception thrown by read() on failure.(a) InterruptedException(b) SystemException(c) SystemInputException(d) I/O ExceptionThis question was addressed to me in quiz.Question is from Reading Console Input Operations in division Console I/O Operations and Stream Classes of C# |
|
Answer» CORRECT ANSWER is (d) I/O EXCEPTION Explanation: READ() THROWS I/O exception on failure. |
|
| 40. |
Choose the object of TextReader class.(a) Console.In(b) Console.Out(c) Console.Error(d) None of the mentionedThe question was asked in class test.I need to ask this question from Introduction of Console I/O Operations in portion Console I/O Operations and Stream Classes of C# |
|
Answer» Correct CHOICE is (a) Console.In |
|
| 41. |
Choose the output returned when an error condition is generated while read() reads from the console.(a) False(b) 0(c) -1(d) All of the mentionedThe question was asked in my homework.Question is from Introduction of Console I/O Operations topic in section Console I/O Operations and Stream Classes of C# |
|
Answer» Right OPTION is (c) -1 |
|
| 42. |
Choose the output returned when read() reads the character from the console?(a) String(b) Char(c) Integer(d) BooleanThis question was posed to me in a job interview.This intriguing question originated from Introduction of Console I/O Operations in division Console I/O Operations and Stream Classes of C# |
|
Answer» The CORRECT option is (c) Integer |
|
| 43. |
Select the correct methodS provided by Console.In?(a) Read(), ReadLine()(b) ReadKey(), ReadLine()(c) Read(), ReadLine(), ReadKey()(d) ReadKey(), ReadLine()The question was asked in a job interview.This question is from Introduction of Console I/O Operations in section Console I/O Operations and Stream Classes of C# |
|
Answer» Right option is (C) Read(), READLINE(), ReadKey() |
|
| 44. |
The number of input methods defined by the stream method Console.In in C#.NET is?(a) 4(b) 3(c) 2(d) 1This question was posed to me in an online quiz.Enquiry is from Introduction of Console I/O Operations in section Console I/O Operations and Stream Classes of C# |
|
Answer» Right ANSWER is (B) 3 |
|
| 45. |
Which of the given stream methods provide access to the input console in C#.NET?(a) Console.Out(b) Console.Error(c) Console.In(d) All of the mentionedI got this question in a national level competition.My question comes from Introduction of Console I/O Operations topic in portion Console I/O Operations and Stream Classes of C# |
|
Answer» Correct option is (c) Console.In |
|
| 46. |
Which of the given stream methods provide access to the output console by default in C#.NET?(a) Console.In(b) Console.Out(c) Console.Error(d) All of the mentionedThis question was posed to me in unit test.My question is taken from Introduction of Console I/O Operations in division Console I/O Operations and Stream Classes of C# |
|
Answer» CORRECT answer is (B) Console.Out The BEST I can explain: The standard output STREAM Console.Out SENDS output to the screen by default. |
|
| 47. |
Which of the classes provide the operation of reading from and writing to the console in C#.NET?(a) System.Array(b) System.Output(c) System.ReadLine(d) System.ConsoleThis question was addressed to me by my school teacher while I was bunking the class.The doubt is from Introduction of Console I/O Operations topic in portion Console I/O Operations and Stream Classes of C# |
|
Answer» The correct option is (d) System.Console |
|
| 48. |
Attributes could be applied to ___________(a) Method(b) Class(c) Assembly(d) All of the mentionedI had been asked this question in an online interview.The query is from Attributes in portion Console I/O Operations and Stream Classes of C# |
|
Answer» RIGHT CHOICE is (d) All of the mentioned The BEST EXPLANATION: NONE. |
|
| 49. |
Which of the following is the correct statement about inspecting an attribute in C#.NET?(a) An attribute can be inspected at link time(b) An attribute can be inspected at design time(c) An attribute can be inspected at run time(d) None of the mentionedI have been asked this question in semester exam.This intriguing question comes from Attributes topic in chapter Console I/O Operations and Stream Classes of C# |
|
Answer» Right choice is (a) An ATTRIBUTE can be inspected at LINK time |
|
| 50. |
Select the correct statement about Attributes used in C#.NET?(a) The CLR can change the behaviour of the code depending on attributes applied to it(b) If a bugFixAttribute is to receive three parameters, then the BugFixAttribute class should implement a zero argument constructor(c) To create a custom attribute we need to create a custom attribute structure and derive it from System.Attribute(d) None of the mentionedThe question was posed to me in an internship interview.I would like to ask this question from Attributes in chapter Console I/O Operations and Stream Classes of C# |
|
Answer» CORRECT answer is (a) The CLR can change the BEHAVIOUR of the CODE depending on attributes applied to it Easy explanation - NONE. |
|