Question
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();
}
a.
Compile time error
b.
Runs successfully does not print anything
c.
Runs successfully, ask for input and hence displays the result
d.
Syntax Error
Posted under C# programming
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. Choose the output for the following set of code?
Similar Questions
Discover Related MCQs
Q. Name the exception thrown by read() on failure.
View solution
Q. Which of these methods are used to read single character from the console?
View solution
Q. Which of these method used to read strings from the console?
View solution
Q. Which among the following methods are used to write characters to a string?
View solution
Q. Which method in Console enables to read individual inputs directly from the keyboard in a non line buffered manner?
View solution
Q. What is the output returned by Console if ReadLine() stores I/O error?
View solution
Q. Name the method/methods used to read byte streams from the file?
View solution
Q. Which of these classes are used by Byte streams for input and output operation?
View solution
Q. Which of these method/methods are used to read block or array of bytes from the file?
View solution
Q. Select the objects of the class TextWriter which is/are not used to perform the write operations to the console?
View solution
Q. Choose the correct statement about the WriteLine()?
View solution
Q. Which of the following statement is correct?
View solution
Q. Which of these classes is used to create an object whose character sequence is mutable?
View solution
Q. Select the namespace/namespaces which consists of methods like Length(), Indexer(), Append() for manipulating the strings.
View solution
Q. Select the method used to write single byte to a file?
View solution
Q. Select the namespace on which the stream classes are defined?
View solution
Q. Choose the class on which all stream classes are defined?
View solution
Q. Choose the stream class method which is used to close the connection:
View solution
Q. The method used to write a single byte to an output stream?
View solution
Q. Select the method which writes the contents of the stream to the physical device.
View solution
Suggested Topics
Are you eager to expand your knowledge beyond C# programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!