AmbitionBox
Discover Best Places to work in India
Discover best places to work
Compare & find best workplace
Bring your workplace to life
Highlight your company's perks
Read reviews for 6L+ companies
Rate your former or current company
Discover salaries for 8L+ companies
Calculate your take home salary
Check your market value
Help other jobseekers
Read interviews for 90K+ companies
Interviews questions for 1K+ colleges
Contribute your interview questions
C# Programming
Which of these methods are used to read single character from the console?
get()
getline()
read()
readLine()
Answer: Option (C)
Which method in Console enables to read individual inputs directly from the keyboard in a non line buffered manner?
Read()
ReadKey()
ReadLine()
All of the mentioned
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
Name the exception thrown by read() on failure.
InterruptedException
SystemException
SystemInputException
I/O Exception
read() throws I/O exception on failure.
Which among the following methods are used to write characters to a string?
StreamWriter
StreamReader
StringWriter
None of the mentioned
The stream class method writes characters to the string.
Which of these method used to read strings from the console?
Answer: Option (D)
Name the method/methods used to read byte streams from the file?
ReadByte()
Readkey()
Answer: Option (A) and (B)
Which of these method/methods are used to read block or array of bytes from the file?
To read a block of bytes, use Read( ), which has this general form: int Read(byte[ ] array, int offset, int count)
What would be the output for following input from the console as a character?
staticvoid Main(string[] args)
{
Console.WriteLine("what is your name?");
char s;
s = Convert.ToChar(Console.ReadLine());
Console.WriteLine("how are you: "+s);
Console.Read();
}
Compile time error
Code run successfully prints nothing on console
Code runs successfully prints input on console
Run time error
Since only a single character is required to be entered on console when a string is entered , a run time exception is being generated as we had not used Read() which reads single character but used readLine() which reads string and is converted into the char using convert.tochar().
Which of these classes are used by Byte streams for input and output operation?
InputStream
InputOutputStream
Reader
Byte stream uses InputStream and OutputStream classes for input and output operation.
What is the output returned by Console if ReadLine() stores I/O error?
1
0
False
I/O EXCEPTION ERROR
Join India’s largest community to research company culture
Are you a student or working professional?
Student/Never worked
I am a student/I have never worked
Working Professional
I am working/I have worked before
What are your preferred job locations?
Popular Cities
Other Cities
Follow your preferred designations/job profiles
Suggestions based on your job profile
vs
Similar Companies