Welcome to the Miscellaneous Topics MCQs Page
Dive deep into the fascinating world of Miscellaneous Topics with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Miscellaneous Topics, a crucial aspect of C# programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Miscellaneous Topics, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within C# programming.
Check out the MCQs below to embark on an enriching journey through Miscellaneous Topics. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of C# programming.
Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Miscellaneous Topics. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!
Miscellaneous Topics MCQs | Page 16 of 17
Explore more Topics under C# programming
class 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();
}
}
class 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();
}
}
}
class 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();
}
}
class UnsafeCode
{
unsafe static void Main()
{
int* p ;
int ch = 13*5;
p = &(ch);
Console.WriteLine(Convert.ToChar(*p));
if (*p == 'A')
Console.WriteLine(Convert.ToBoolean(1));
else
Console.WriteLine(Convert.ToBoolean(0));
Console.ReadLine();
}
}
class UnsafeCode
{
struct MyStruct
{
public int a;
public int b;
public int Sum()
{
return a * b;
}
}
unsafe static void Main()
{
MyStruct o = new MyStruct();
MyStruct* p;
p = &o;
p->a = 10;
p->b = 20;
Console.WriteLine("Value is " + p->Sum());
Console.ReadLine();
}
}
class UnsafeCode
{
struct MyStruct
{
public int a;
public int b;
public int Sum()
{
return a / b;
}
}
unsafe static void Main()
{
MyStruct o = new MyStruct();
MyStruct* p;
p = &o;
p->a = 60;
p->b = 15;
int c = 30;
Console.WriteLine("Value is : " + p->Sum()*c);
Console.ReadLine();
}
}
class 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();
}
}
}
class UnsafeCode
{
static void Main()
{
int? count = null;
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();
}
}
class 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();
}
}
Suggested Topics
Are you eager to expand your knowledge beyond C# programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!