*
Previous C# Question Answers-81 - 90 C# Question Answers-101 - 110 Next

C# (C-Sharp) Question Answers - 91-100

91. What is output for the following code snippet?

public class Exercise
{
    public static int Main()
    {
        for (int Stories = 1; Stories <= 6; Stories++)
        {
            if (Stories == 3)
                continue;
            Console.WriteLine("Story {0}", Stories);
        }

        Console.WriteLine();
        return 0;
    }
}

Output:

Story 1
Story 2
Story 4
Story 5
Story 6

92. What is Parallel LINQ (PLINQ)?

PLINQ is a parallel implementation of LINQ. It partitions a data source and executes queries on multiple threads for improved performance, with deferred execution.

The primary difference is that PLINQ attempts to make full use of all the processors on the system. It does this by partitioning the data source into segments, and then executing the query on each segment on separate worker threads in parallel on multiple processors. In many cases, parallel execution means that the query runs significantly faster.

93. What is PDB in VS?

PDB (Program Database) stores debugging symbols and metadata, usually found in the bin/debug folder.

94. What is Polymorphism?

Poly means many, Polymorphism is the ability to create a variable, a function, or an object that has more than one form. Polymorphism means that the same thing can exist in two forms. This is an important characteristic of true object oriented design – which means that one could develop good OO design with data abstraction and inheritance, but the real power of object oriented design seems to surface when polymorphism is used.

95. What is reflection and when would one use it?

Reflection allows inspecting types (classes, interfaces, enums, delegates) at runtime, obtaining information about assemblies, types, and members, and dynamically creating/invoking objects.

96. What is Reflection?

Reflection allows dynamic loading of assemblies and accessing metadata like namespaces, classes, properties, methods, and events.

97. What is remoting in .NET?

.NET Remoting is a Microsoft application programming interface (API) for interprocess communication released in 2002 with the 1.0 version of .NET Framework. It is one in a series of Microsoft technologies that began in 1990 with the first version of Object Linking and Embedding (OLE) for 16-bit Windows.

.NET remoting enables you to build widely distributed applications easily, whether the application components are all on one computer or spread out across the entire world.

NET remoting provides an abstract approach to interprocess communication that separates the remotable object from a specific client or server application domain and from a specific mechanism of communication. As a result, it is flexible and easily customizable. You can replace one communication protocol with another, or one serialization format with another without recompiling the client or the server. In addition, the remoting system assumes no particular application model. You can communicate from a Web application, a console application, a Windows Service – from almost anything you want to use. Remoting servers can also be any type of application domain. Any application can host remoting objects and provide its services to any client on its computer or network.

98. What is shadowing?

Shadowing occurs when a derived class member hides a base class member without using override. The new keyword can explicitly hide the base member.

99. What is sn.exe?

sn.exe is the Strong Name tool for creating public/private key pairs, usually with .snk extension.

100. What is Static constructor in C#?

A static constructor is used to initialize any static data, or to perform a particular action that needs to be performed once only. It is called automatically before the first instance is created or any static members are referenced.

Static constructors have the following properties:

  • A static constructor does not take access modifiers or have parameters.
  • A static constructor is called automatically to initialize the class before the first instance is created or any static members are referenced.
  • A static constructor cannot be called directly.
  • The user has no control on when the static constructor is executed in the program.
  • A typical use of static constructors is when the class is using a log file and the constructor is used to write entries to this file.
  • Static constructors are also useful when creating wrapper classes for unmanaged code, when the constructor can call the LoadLibrary method.
  • If a static constructor throws an exception, the runtime will not invoke it a second time, and the type will remain uninitialized for the lifetime of the application domain in which your program is running.

Back to Index
Previous C# Question Answers-81 - 90 C# Question Answers-101 - 110 Next
*
*