Home / CSE MCQs / C#.Net MCQs :: C# Namespaces, Preprocessors and Networking

CSE MCQs :: C#.Net MCQs

  1. How many ports of TCP/IP are reserved for specific protocols?
  2. A.
    10
    B.
    1024
    C.
    2048
    D.
    512

  3. Which among the following statements are not correct about a namespace used in C#.NET?
  4. A.
    Nested namespaces are allowed
    B.
    Importing outer namespaces imports inner namespace
    C.
    Nested namespaces are allowed
    D.
    Importing outer namespace does not import inner namespace

  5. What will be the output of following code snippet?

    #define pi 
     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 (!pi) 
                Console.WriteLine("i");
                #else 
                Console.WriteLine("pi not define");
                #endif
                Console.WriteLine("ok");
                Console.ReadLine();
           }
       }
    }
  6. A.

    i

    pi not define

    B.

    pi not define

    ok

    C.

    i

    ok

    D.

    ok


  7. Select the properties related to the network errors generated by WebException:
  8. A.
    Response
    B.
    get
    C.
    set
    D.
    None of the mentioned

  9. What does the following code block define?

     class Gen {  
                      T ob;    
                  }
  10. A.
    Generics class decleration
    B.
    Decleration of variable
    C.
    a simple class decleration
    D.
    Both a & b

  11. What does the following method specify?

    public static WebRequest Create(string requestUriString)
  12. A.
    Creates a WebRequest object for the URI specified by the string passed by requestUriString
    B.
    The object returned will implement the protocol specified by the prefix of the URI
    C.
    The object will be an instance of the class that inherits WebRequest
    D.
    All of the mentioned

  13. How many bits are present in a single IP address?
  14. A.
    8
    B.
    16
    C.
    32
    D.
    64

  15. Which among the following is a .NET namespace?
  16. A.
    System.Web
    B.
    System.Process
    C.
    System.Drawing2D
    D.
    System.Drawing3D

  17. What will be the output of following code snippet?

    #define DEBUG 
    #define MYTEST
    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 && !MYTEST)
                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();
            }
        }
    }
  18. A.

    DEBUG is defined

    MYTEST is defined

    B.

    MYTEST is defined

    DEBUG and MYTEST are defined

    C.

    DEBUG and MYTEST are not defined

    MYTEST is defined

    D.

    DEBUG and MYTEST are defined