C# Basic Input/output Aptitude Questions and Answers

This section contains aptitude questions and answers on C# Basic Input/output Aptitude Questions and Answers.

1) What will be the output of following program?
static void Main(string[] args)
{
	int a = 10, b = 20;
	Console.WriteLine("{0},{0}", a, b);
}
  1. 10,10
  2. 10,20
  3. 20,20
  4. 20,10

2) What will be the output of following program?
static void Main(string[] args)
{
	int a = 10, b = 20;
	Console.WriteLine("{0}+{1}", a, b);
}
  1. 30
  2. 20+20
  3. 10+10
  4. 10+20

3) What will be the output of following program?
static void Main(string[] args)
{
	Console.WriteLine(Console.Write("Hello"));
}
  1. Error
  2. 6Hello
  3. Hello6
  4. Hello5

4) What will be the output of following program?
static void Main(string[] args)
{
	int a = 10, b = 10;
	Console.WriteLine(a == b);
}
  1. 1
  2. a==b
  3. True
  4. true

5) What will be the output of the following program, if the input is "Hello world!"?
static void Main(string[] args)
{
	string text = "";
	text = Console.ReadLine();
	Console.WriteLine(text);
}
  1. Hello
  2. Hello world!
  3. Helloworld!
  4. None





Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.