Q121
Open questionSelect an option to see the answer and solution.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
170
Questions
7/9
Page
Pick an option on a question to see the right answer and solution.
Q121
Open questionSelect an option to see the answer and solution.
Q122
Open questionclass Program
{
static void Main(string[] args)
{
char []chars = {'a', 'b', 'c'};
String s = new String(chars);
String s1 = "abcd";
int len1 = s1.Length;
int len2 = s.Length;
Console.WriteLine(len1 + " " + len2);
Console.ReadLine();
}
}Select an option to see the answer and solution.
Q123
Open questionSelect an option to see the answer and solution.
Q124
Open questionclass UnsafeCode
{
unsafe static void Main()
{
int* ptrs = stackalloc int[3];
ptrs[0] = 1;
ptrs[1] = 2;
ptrs[2] = 3;
for (int i = 2; i >=0; i--)
Console.WriteLine(ptrs[i]);
Console.ReadLine();
}
}Select an option to see the answer and solution.
Q125
Open questionSelect an option to see the answer and solution.
Q126
Open questionSelect an option to see the answer and solution.
Q127
Open questionstatic void Main(string[] args)
{
string s1 = " Ixg";
string s2 = s1.Insert(3,"i");
string s3 = s2.Insert(5, "o");
for (int i = 0; i < s3.Length; i++)
Console.WriteLine(s3[i]);
Console.ReadLine();
}Select an option to see the answer and solution.
Q128
Open questionSelect an option to see the answer and solution.
Q129
Open questionSelect an option to see the answer and solution.
Q130
Open questionclass UnsafeCode
{
unsafe static void Main()
{
string str = "this is a test";
fixed (char* p = str)
{
for (int i = str.Length-1 ;p[i] != 0 ;i--)
Console.Write(p[i]);
}
Console.ReadLine();
}
}Select an option to see the answer and solution.
Q131
Open questionSelect an option to see the answer and solution.
Q132
Open questionSelect an option to see the answer and solution.
Q133
Open questionSelect an option to see the answer and solution.
Q134
Open questionclass Program
{
static void Main(string[] args)
{
char []chars = {'a', 'b', 'c'};
String s = new String(chars);
Console.WriteLine(s);
Console.ReadLine();
}
}Select an option to see the answer and solution.
Q135
Open questionSelect an option to see the answer and solution.
Q136
Open questionunsafe static void Main()
{
int a = 5;
int b = 5;
int c = 5;
int*[] ptr = new int* [3];
ptr[0] = &a;
ptr[1] = &b;
ptr[2] = &c;
for (a = 0; a < 3; a++)
{
c += *ptr[a];
Console.WriteLine(c);
}
Console.ReadLine();
}Select an option to see the answer and solution.
Q137
Open questionstatic void Main(string[] args)
{
string s1 = "Hello" + "c" + "Sharp";
Console.WriteLine(s1);
Console.ReadLine();
}Select an option to see the answer and solution.
Q138
Open questionSelect an option to see the answer and solution.
Q139
Open questionclass static_out
{
public static int x;
public static int y;
public int add(int a, int b)
{
x = a + b;
y = x + b;
return 0;
}
}
class Program
{
static void Main(string[] args)
{
static_out obj1 = new static_out();
static_out obj2 = new static_out();
int a = 2;
obj1.add(a, a + 1);
obj2.add(5, a);
Console.WriteLine(static_out.x + " " + static_out.y );
Console.ReadLine();
}
}Select an option to see the answer and solution.
Q140
Open questionclass MyClass
{
char ch = 'A';
int e = 4;
int k = 9;
int z = 6;
public IEnumerator GetEnumerator()
{
for (int i = 0; i < 26; i++)
{
if (i == e*k /z) yield break;
yield return (int)(ch + i);
}
}
}
class Program
{
static void Main(string[] args)
{
MyClass mc = new MyClass();
foreach(int ch in mc)
Console.Write(ch + " ");
Console.WriteLine();
Console.ReadLine();
}
}Select an option to see the answer and solution.