C# .NET interview questions

C# .NET quiz questions

  • 1.

    Explain the features of C#?

    Answer:

    Below are some of the features supported in C# -

    • Constructors and Destructors
    • Properties
    • Passing Parameters
    • Arrays
    • Main
    • XML Documentation and
    • Indexers

     

    View
  • 2.

    What is C-Sharp (C#)?

    Answer:

    C# is a type-safe, managed and object oriented language, which is compiled by .Net framework for generating intermediate language (IL).

    View
  • 3.

    What is Code Document Object Model (CodeDom) ?

    Answer:

    Code Document Object Model are code generators which are used  to minimize repetitive coding tasks, and to minimize the number of human-generated source code lines.

    View
  • 4.

    What is Native Image Generator (Ngen.exe) ?

    Answer:

    Ngen.exe creates compiled processor-specific machine code called native images which are files and installs them into the native image cache on the local computer. The runtime will use native images from the cache rather than using the JIT compiler to compile the original assembly.

    View
  • 5.

    How to prevent my .NET DLL to be decompiled ?

    Answer:

    We can prevent .NET DLL to be decompiled upto an extent by Obfuscate Source code, asymmetric encryption and encrypted w32 wrapper application.

    View
  • 6.

    What is a satellite assembly?

    Answer:

    A satellite assembly are used when multilingual (UI) application are created. Satellite assembly is a compiled library that contains localized resources  which provides us with the capability of designing and deploying solutions to multiple cultures, rather than hard coding texts, bitmaps etc

    View
  • 7.

    What is CODE Access security?

    Answer:

    CODE Access security is a security model that let us grant or deny execution permissions to an assembly according to its "properties," called evidence, such as its strong name or publisher

    View
  • 8.

    What’s the difference between System exceptions and Application exceptions?

    Answer:

    System exceptions are common exceptions thrown by the CLR of .Net Framework. Application exceptions can be user defined exceptions thrown by the application.

    View
  • 9.

    Explain the concept of Boxing and Unboxing ?

    Answer:

    Converting a value type to reference type is called Boxing. Converting a reference type to value type is called Unboxing.

    View
  • 10.

    What are Value types and Reference types ?

    Answer:

    There are two types of data types in .Net, Value types and Reference types. Value types are stored in stack part of the memory. Reference type are stored in managed heap. Let have a look at the example for better understanding.

    Int iCount = 0; \\ Value Type
    int NewiCount =  iCount; \\  Reference Type
    View
  • 11.

    What are the different type of JIT's ?

    Answer:

    Different Types of JIT are

    1) Pre-JIT -  Complies complete source code into native code at the time of deployment.

    2) Econo-JIT  - Complies methods that are called at runtime.

    3) Normal-JIT - Complies methods that are called at runtime and get stored in cache. Next time when the same method is called, it will be taken from cache.

    View
  • 12.

    What is Delay signing ?

    Answer:

    To create a strong named assembly and to make sure that this assembly can used by someone else, we partially build this assembly by providing a Public Key. We write this Public Key in the AssemblyInfo.vb OR .cs file. We also add an attribute by the name <Assembly:AssemblyDelaySignAttribute(true)> to the assembly info file. This makes it sure that when we build the assembly, it would be containing the information only about the public key before we deliver it to our clients. This is a partial strong named assembly that we have created, and hence it is called Delayed Assembly.

    View
  • 13.

    What is Reflection?

    Answer:

    Reflection is used to dynamically load a class, create object and invoke methods at runtime. It can also be used to read its own meta data to find assemblies, modules and type information at runtime.

    View
  • 14.

    How to add and remove a assembly from GAC?

    Answer:

    To install assembly in Cache, use  Gacutil. To run Gacutil, goto "Visual Studio Command Prompt" and type "gacutil -i <assembly_name>", where (assembly_name) is the DLL name of the project. To uninstall assembly, type gacutil –u <assembly name> in  Visual Studio Command Prompt.

    View
  • 15.

    Explain the concept of strong names (strong types) ?

    Answer:

    While using shared assemblies, in order to avoid name collisions strong names are used. Strong Names are based on private key cryptography, ie. private assemblies are simply given the same name as their main file name.

    View
  • 16.

    What is Global Assembly Cache (GAC) ?

    Answer:

    While using shared assemblies, to avoid Assembly being overwritten by a different version of the same assembly, shared assemblies are placed in a special directory subtree of the file system known as the global assembly cache (GAC). Placing shared assemblies can only be done by a special .Net Utilities.

    View
  • 17.

    What is the Difference between NameSpace and Assembly ?

    Answer:

    Namespace:

    • Forms the logical boundary for a Group of classes.
    • It is a Collection of names where each name is Unique.
    • The namespace must be specified in Project Properties.

    Assembly:

    • Assemblies are Self-Describing
    • It is an Output Unit. It is a unit of deployment and is used for versioning. Assemblies contain MSIL code.
    View
  • 18.

    What is NameSpace ?

    Answer:

    A namespace is a logical grouping of related classes and types. Every class should have a NameSpace. 

    View
  • 19.

    Where is the assembly version information stored ?

    Answer:

    In the Manifest.

    View
  • 20.

    How  to view Assembly information ?

    Answer:

    By using Ildasm.exe, which is an MSIL Disassembler one can view attributes, references to other modules and assemblies.

    View

© 2017 QuizBucket.org