61. 'Implicit Conversion' follows the order of conversion as per compatibility of data type as:
62. What will be the output of the following C# code?
static void Main(string[] args)
{
string s1 = "Delhi";
string s2;
s2 = s1.Insert (6, "Jaipur");
Console.WriteLine(s2);
}
static void Main(string[] args)
{
string s1 = "Delhi";
string s2;
s2 = s1.Insert (6, "Jaipur");
Console.WriteLine(s2);
}
63. What will be the output of the following C# code?
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));
}
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));
}
64. Choose the correct type of variable scope for the following C# defined variables.
class ABC
{
static int m;
int n;
void fun (int x , ref int y, out int z, int[] a)
{
int j = 10;
}
}
class ABC
{
static int m;
int n;
void fun (int x , ref int y, out int z, int[] a)
{
int j = 10;
}
}
65. Which is the String method used to compare two strings with each other?
66. What will be the output of the following C# code?
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();
}
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();
}
67. Correct Declaration of Values to variables 'a' and 'b'?
68. What is the Size of 'Char' datatype?
69. What will be the output of the following C# code?
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();
}
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();
}
70. Why does a float variable stop incrementing at number '16777216' in the following C# code?
float a = 0 ;
while (true)
{
a++;
if (a > 16777216)
break;
}
float a = 0 ;
while (true)
{
a++;
if (a > 16777216)
break;
}
Read More Section(Basic Syntax and Data Types in C Sharp)
Each Section contains maximum 100 MCQs question on Basic Syntax and Data Types in C Sharp. To get more questions visit other sections.