41.
What is meant by preprocessor directive #define?

42.
Choose the correct statements for the following C# code?
public System.Collections.IEnumerator GetEnumerator()
{
    foreach (char ch in chrs)
    yield return ch;
}

43.
Which among the given is not a correct way to call the method Issue() defined in the following C# code snippet?
class Book
{
    public void issue()
    {
      /* code */
    }
}
class Journel
{
     public void issue()
     {
         /* code */
     }
}

44.
What will be the output of the following C# code snippet?
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();
    }
}

45.
What is Semaphore?

46.
What will be the output of the following C# code snippet?
#define DEBUG 
#undef DEBUG
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace ConsoleApplication13
{
    class Program
    {   
        static void Main(string[] args)
        {
            #if (DEBUG)
            Console.WriteLine("DEBUG is defined");
            #elif (!DEBUG && MYTEST)
            Console.WriteLine("MYTEST is defined");
            #elif (DEBUG && MYTEST)
            Console.WriteLine("DEBUG and MYTEST are defined");
            #else
            Console.WriteLine("DEBUG and MYTEST are not defined");
            #endif
            Console.ReadLine();
       }
   }
}

47.
What will be the output of the following C# code snippet?
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();
   }

48.
What will be the output of the following C# code snippet?
class UnsafeCode
{
    unsafe static void Main()
    {
        int* a;
        int a1 = 10;
        int b1;
        b1 = *&a1;
        a = &b1;
        {
            Console.WriteLine(*a);
            Console.ReadLine();
        }
    }
}

Read More Section(Miscellaneous in C Sharp)

Each Section contains maximum 100 MCQs question on Miscellaneous in C Sharp. To get more questions visit other sections.