adplus-dvertising
frame-decoration

Question

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

a.

Compile time error

b.

Code run successfully prints nothing on console

c.

Code runs successfully prints input on console

d.

Run time error

Answer: (d).Run time error

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What would be the output for following input from the console as a character?

Similar Questions

Discover Related MCQs

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

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

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

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

Q. Choose the correct statement about the WriteLine()?

Q. Which of the following statement is correct?

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

Q. Select the namespace/namespaces which consists of methods like Length(), Indexer(), Append() for manipulating the strings.

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

Q. Select the namespace on which the stream classes are defined?

Q. Choose the class on which all stream classes are defined?

Q. Choose the stream class method which is used to close the connection:

Q. The method used to write a single byte to an output stream?

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

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

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

Q. Select the statements which define the stream.

Q. Select the action of the method long seek()?

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

Q. Which of these classes is used to read and write bytes in a file?