1.

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

To EXPLAIN I would say: The .NET FRAMEWORK includes a method in Console that enables you to read individual keystrokes directly from the KEYBOARD, in a non-line-buffered manner. This method is called ReadKey(). When it is called, it WAITS until a key is pressed. When the key is pressed, ReadKey( ) returns the keystroke immediately.



Discussion

No Comment Found

Related InterviewSolutions