1. Keyword used to define call by reference parameter in C# .NET?
2. How is a string typically processed?
3. What will be the output of the following C# code?
class Program
{
static void Main(string[] args)
{
String c = "i love Csharp";
bool a;
a = c.StartsWith("I");
Console.WriteLine(a);
Console.ReadLine();
}
}
class Program
{
static void Main(string[] args)
{
String c = "i love Csharp";
bool a;
a = c.StartsWith("I");
Console.WriteLine(a);
Console.ReadLine();
}
}
4. What will be the output of the following C# code?
class Program
{
static void Main(string[] args)
{
int i = 5;
int j;
method1(ref i);
method2(out j);
Console.writeline(i + " " + j);
}
static void method1(ref int x)
{
x = x + x;
}
static void method2(out int x)
{
x = 6;
x = x * x;
}
}
class Program
{
static void Main(string[] args)
{
int i = 5;
int j;
method1(ref i);
method2(out j);
Console.writeline(i + " " + j);
}
static void method1(ref int x)
{
x = x + x;
}
static void method2(out int x)
{
x = 6;
x = x * x;
}
}
5. Which is the correct way of defining and initializing an array of 3 integers?
6. What is the advantage of using 2D jagged array over 2D rectangular array?
7. Which of the following statements are correct?
8. What will be the output of the following C# code?
static void main(string[] args)
{
int n = 1;
method(n);
console.Writeline(n);
method1(ref n);
console.Writeline(n);
}
static void method(int num)
{
num += 20;
console.writeline(num);
}
static void method1(ref int num)
{
num += 20;
console.writeline(num);
}
static void main(string[] args)
{
int n = 1;
method(n);
console.Writeline(n);
method1(ref n);
console.Writeline(n);
}
static void method(int num)
{
num += 20;
console.writeline(num);
}
static void method1(ref int num)
{
num += 20;
console.writeline(num);
}
9. What will be the output of the following C# code?
static void Main(string[] args)
{
String c = "Hello";
String a = c + "Bye";
Console.WriteLine(a);
Console.ReadLine();
}
static void Main(string[] args)
{
String c = "Hello";
String a = c + "Bye";
Console.WriteLine(a);
Console.ReadLine();
}
10. What will be the output of the following C# code?
static void Main(string[] args)
{
char A = 'K';
char B = Convert.ToChar(76);
A++;
B++;
Console.WriteLine(A+ " " +B);
Console.ReadLine();
}
static void Main(string[] args)
{
char A = 'K';
char B = Convert.ToChar(76);
A++;
B++;
Console.WriteLine(A+ " " +B);
Console.ReadLine();
}
Read More Section(Arrays and Strings in C Sharp)
Each Section contains maximum 100 MCQs question on Arrays and Strings in C Sharp. To get more questions visit other sections.