Select an option to see the answer and solution.
Basic Syntax and Data Types in C Sharp
practice.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
115
Questions
4/6
Page
Pick an option on a question to see the right answer and solution.
static void Main(string[] args)
{
string s1 = "Delhi";
string s2;
s2 = s1.Insert (6, "Jaipur");
Console.WriteLine(s2);
}Select an option to see the answer and solution.
static void Main(string[] args)
{
{
var dayCode = "MTWFS";
var daysArray = new List<string>();
var list = new Dictionary<string, string>
{ {"M", "Monday"}, {"T", "Tuesday"}, {"W", "Wednesday"},
{"R", "Thursday"}, {"F", "Friday"}, {"S", "Saturday"},
{"U", "Sunday"}
};
for (int i = 0,max = dayCode.Length; i < max; i++)
{
var tmp = dayCode[i].ToString();
if (list.ContainsKey(tmp))
{
daysArray.Add(list[tmp]);
}
}
Console.WriteLine(string.Join("\n ", daysArray));
}Select an option to see the answer and solution.
class ABC
{
static int m;
int n;
void fun (int x , ref int y, out int z, int[] a)
{
int j = 10;
}
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
static void Main(string[] args)
{
int i ;
for (i = 0; i < 5; i++)
{
int j = 0;
j += i;
Console. WriteLine(j);
}
Console. WriteLine( i * j);
Console. ReadLine();
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
static void Main(string[] args)
{
int x = 1;
float y = 2. 4f;
short z = 1;
Console. WriteLine((float) x + y * z - (x + = (short) y) );
Console. ReadLine();
}Select an option to see the answer and solution.
float a = 0 ;
while (true)
{
a++;
if (a > 16777216)
break;
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
static void Main(string[] args)
{
float sum;
int i;
sum = 0.0F;
for (i = 1; i <= 10; i++)
{
sum = sum + 1 /(float)i;
}
Console.WriteLine("sum =" +sum);
Console.ReadLine();
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
static void Main(string[] args)
{
int a = 5;
int b = 10;
int c;
Console.WriteLine(c = a-- - ++b);
Console.WriteLine(b);
Console.ReadLine();
}Select an option to see the answer and solution.
static void Main(string[] args)
{
string Str, Revstr = " ";
int Length;
Console.Write("Enter A String : ");
Str = Console.ReadLine();
Length = Str.Length - 1;
while (Length >= 0)
{
Revstr = Revstr + Str[Length];
Length --;
}
Console.WriteLine("Reverse String Is {0}", Revstr);
Console.ReadLine();
}Select an option to see the answer and solution.
1. Myclass class;
Myclass class2 = null;2. int i;
int j = 0;Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.