Q101
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
6/9
Page
Pick an option on a question to see the right answer and solution.
Q101
Open questionSelect an option to see the answer and solution.
Q102
Open questionSelect an option to see the answer and solution.
Q103
Open questionSelect an option to see the answer and solution.
Q104
Open questionSelect an option to see the answer and solution.
Q105
Open questionSelect an option to see the answer and solution.
Q106
Open questionType[] GetGenericArguments()Select an option to see the answer and solution.
Q107
Open questionclass UnsafeCode
{
unsafe static void Main()
{
int n = 10;
void* p = &n;
Console.WriteLine(*p);
Console.ReadLine();
}
}Select an option to see the answer and solution.
Q108
Open questionclass UnsafeCode
{
unsafe static void Main()
{
int* p;
p = (int*)(65535);
Console.WriteLine((uint)p);
Console.ReadLine();
}
}Select an option to see the answer and solution.
Q109
Open questionclass Program
{
static void Main(string[] args)
{
double x = 3.14;
int y = (int) Math.Floor(x);
Console.WriteLine(y);
}
}Select an option to see the answer and solution.
Q110
Open questionclass UnsafeCode
{
unsafe static void Main()
{
int[] nums = new int[10];
Console.WriteLine("Index pointer like array.");
fixed (int* p = nums)
{
for (int i = 0 ;i <10 ;i++)
p[i] = i;
for (int i = 10 ;i >0 ;i--)
Console.WriteLine("p[{0}]: {1} ", i, p[i]);
Console.ReadLine();
}
}
}Select an option to see the answer and solution.
Q111
Open questionSelect an option to see the answer and solution.
Q112
Open questionclass UnsafeCode
{
unsafe static void Main()
{
int[] nums = new int[10];
fixed (int* p = &nums[0], p2 = nums)
{
if (p == p2)
Console.WriteLine("p and p2 point to same address.");
Console.ReadLine();
}
}
}Select an option to see the answer and solution.
Q113
Open questionStack st = new Stack();
st.Push(10);
st.Push(20);
st.Push(-5);
st.Push(30);
st.Push(6);Select an option to see the answer and solution.
Q114
Open questionclass UnsafeCode
{
static void Main()
{
int count = 100;
int? result = null;
int incr = 10;
result = count + incr;
if (result.HasValue)
Console.WriteLine("result has this value: " + result.Value);
else
Console.WriteLine("result has no value");
Console.ReadLine();
}
}Select an option to see the answer and solution.
Q115
Open questionclass Program
{
static void Main(string[] args)
{
int[] nums = { 1 };
var posNums = from n in nums
select Math.Pow(4 ,3);
Console.Write("The values in nums: ");
foreach (int i in posNums)
Console.Write(i + " ");
Console.WriteLine();
Console.ReadLine();
}
}Select an option to see the answer and solution.
Q116
Open questionclass access
{
public int x;
private int y;
public void cal(int a, int b)
{
x = a + 1;
y = b;
}
}
class Program
{
static void Main(string[] args)
{
access obj = new access();
obj.cal(2, 3);
Console.WriteLine(obj.x + " " + obj.y);
}
}Select an option to see the answer and solution.
Q117
Open questionclass UnsafeCode
{
unsafe static void Main()
{
char[] arr = { 'A', 'B', 'C', 'D', 'E' };
fixed (char* P = arr)
{
int i;
for (i = 0 ;i < 5 ;i++)
if (*P % 2 == 0)
++*P;
else
(*P)++;
Console.WriteLine(arr);
}
Console.ReadLine();
}
}Select an option to see the answer and solution.
Q118
Open questionSelect an option to see the answer and solution.
Q119
Open questionclass Program
{
static void Main(string[] args)
{
String s1 = "Hello i love Csharp";
StringBuilder s2 = new StringBuilder(s1);
Console.WriteLine(s1.Equals(s2));
Console.ReadLine();
}
}Select an option to see the answer and solution.
Q120
Open questionSelect an option to see the answer and solution.