C# (.NET Framework) interview question set 1/C# (.NET Framework) Interview Questions and Answers for Freshers & Experienced

Explain what is RIA?

RIA stands for rich internet applications, and they are web applications with rich features. Rich features include built in AJAX support, layouts, animations, audio, and video components. Silverlight is an example of RIA.

Posted Date:- 2021-08-24 07:46:49

What is the difference between “constant” and “readonly” variables in C#?

A Constant keyword is used for making variables constant. We can’t modify the value of the constant.

Constant variables are evaluated at compile-time. It supports value type variables.

The readonly keyword is used for making the variable read-only. Readonly variables are evaluated at runtime. It supports reference type variables.

Posted Date:- 2021-08-24 07:44:34

What is a struct?

The structure is a value type. It is used while developing mathematical or geometrical applications. It helps create new value-type objects similar to the built-in type (int, float, bool, and so on).

Posted Date:- 2021-08-24 07:43:48

Explain passport authentication.

During the passport authentication, it first checks the passport authentication cookie, if the cookie is not available the application redirects to the passport sign on page. Passport service then authenticates the details of the user on the sign on page and if they are valid, stores them on the client machine and then redirects the user to the requested page.

Posted Date:- 2021-08-24 07:41:54

What is lazy initialization?

Lazy initialization is a process by which an object is not initialized until it is first called in your code. The .NET 4.0 introduces a new wrapper class, System.Lazy<T>, for executing the lazy initialization in your application. Lazy initialization helps you to reduce the wastage of resources and memory requirements to improve performance. It also supports thread-safety.

Posted Date:- 2021-08-24 07:40:09

Is there a way to suppress the finalize process inside the garbage collector forcibly in .NET?

Use the GC.SuppressFinalize() method to suppress the finalize process inside the garbage collector forcibly in .NET.

Posted Date:- 2021-08-24 07:39:23

What are tuples?

Tuple is a fixed-size collection that can have elements of either same or different data types. Similar to arrays, a user must have to specify the size of a tuple at the time of declaration. Tuples are allowed to hold up from 1 to 8 elements and if there are more than 8 elements, then the 8th element can be defined as another tuple. Tuples can be specified as parameter or return type of a method.

Posted Date:- 2021-08-24 07:38:08

What is the Diamond of Death?

It is an ambiguity that arises due to multiple inheritances in C#. Two classes B and C inherit from A, and D inherits from both B and C but doesn’t override the method defined in A. The Diamond Problem arises when class B or C has overridden the method differently and D cannot decide to inherit from either B or C.

Posted Date:- 2021-08-24 07:36:23

Garbage collector cleans managed code; how do we clean unmanaged code?

The garbage collector performs the cleanup operation on managed code to reclaim memory. For unmanaged code, we can perform the cleanup using destructor / finalize.

Posted Date:- 2021-08-24 07:35:21

What is Unmanaged code?

Unmanaged code is a code that is not managed by CLR. To execute the unmanaged code .NET framework is not needed; it is independent of the .NET framework. For execution and compilation, unmanaged code has its own runtime environment.

Posted Date:- 2021-08-24 07:34:43

What is Shadowing?

Shadowing makes the method of the parent class available to the child class without using the override keyword. It is also known as Method Hiding.

Posted Date:- 2021-08-24 07:33:52

What is the inheritance hierarchy?

Inheritance hierarchy is a singly rooted tree structure for organizing classes.

Posted Date:- 2021-08-24 07:32:51

What is the extension method for a class?

The extension method is used to add new methods in the existing class or the structure without modifying the source code of the original type. Special permission from the original type or re-compiling it isn’t required.

Posted Date:- 2021-08-24 07:32:12

What is an application domain?

Application domain is the boundary within which an application runs. A process can contain multiple application domains. Application domains provide an isolated environment to applications that is similar to the isolation provided by processes. An application running inside one application domain cannot directly access the code running inside another application domain. To access the code running in another application domain, an application needs to use a proxy.

Posted Date:- 2021-08-24 07:31:17

What is the Constructor Chaining in C#?

Constructor chaining is a way to connect two or more classes in a relationship as Inheritance. In Constructor Chaining, every child class constructor is mapped to a parent class Constructor implicitly by base keyword, so when you create an instance of the child class, it will call the parent’s class Constructor. Without it, inheritance is not possible.

Posted Date:- 2021-08-24 07:29:15

Explain how the exception is handled in .NET?

In .Net, when there is an exception, the .NET framework creates an object of type ‘Exception’ and ‘throws’ it. This Exception object will have all the information about the ‘error’.

If you have enclosed your code within the try-catch block, you will receive the exception object in the ‘catch’ block when the exception occurs.

Posted Date:- 2021-08-24 07:28:16

Explain role-based security.

Role-based security is used to implement security measures based on the role assigned to the users in the organization. Then we can authorize users based on their roles in the organization. For example, windows have role-based access like user, administrators, and guests.

Posted Date:- 2021-08-24 07:27:03

What are the different validators in ASP.NET?

Client-side validation – When the validation takes place on the client-side browser, it is called client-side validation. Usually, JavaScript is used for client-side validation.

Server-side validation – When the validation takes place on the server then it is called server-side validation. Server-side validation is considered as a secure form of validation because even if the user bypasses the client-side validation we can still catch it in server-side validation.

Posted Date:- 2021-08-24 07:25:58

What are EXE and DLL?

EXE is an executable file that works as an application and it runs individually as it contains an entry point. DLL is a Dynamic Link Library which is a supportive file to other applications, and it cannot run individually.

Posted Date:- 2021-08-24 07:25:17

Explain the difference between value type and reference type.

Types in .NET Framework are either Value Type or Reference Type. A Value Type is stored in the stack and it holds the data within its own memory allocation. While a Reference Type is stored in the heap and it contains a pointer to another memory location that holds the real data.

Posted Date:- 2021-08-24 07:24:33

Discuss the difference between constants and read-only variables.

Constant fields are created using the const keyword and their value remains the same throughout the program. The Read-only fields are created using a read-only keyword and their value can be changed. Const is a compile-time constant while Read-only is a runtime constant.

Posted Date:- 2021-08-24 07:22:43

What is a cross-page posting?

Cross-page posting is used to submit a form to a different page while creating a multi-page form to collect information from the user. You can specify the page you want to post to using the PostBackURL attribute.

Posted Date:- 2021-08-24 07:22:01

Explain OOP and its relation to the .NET Framework?

OOP is the acronym for Object-Oriented Programming. It is a programming structure that uses self-contained entities called ‘objects’ instead of methods to achieve the desired functionality. OOP allows .NET developers to create modular programs and classes containing methods, properties, fields, events, and other logical modules.

Posted Date:- 2021-08-24 07:21:17

What is delegate in .NET?

A delegate in .NET is similar to a function pointer in other programming languages like C or C++. A delegate allows the user to encapsulate the reference of a method in a delegate object. A delegate object can then be passed in a program, which will call the referenced method. We can even use a delegate method to create a custom event in a class.

Posted Date:- 2021-08-24 07:20:21

What is the application domain?

ASP.NET introduces a concept of application domain or AppDomain which is like a lightweight process that acts like both container and boundary. The .NET run-time uses the AppDomain as a container for data and code. The CLR allows multiple .NET applications to run in a single AppDomain.

Posted Date:- 2021-08-24 07:19:50

What is caching?

Caching simply means storing the data temporarily in the memory so that the data can be accessed from the memory instead of searching for it in the original location. It increases the efficiency of the application and also increases its speed.

Following are the types of caching:

Page caching
Data caching
Fragment caching

Posted Date:- 2021-08-24 07:19:08

Explain the different parts of the assembly.

Following are the different parts of assembly:

1.Manifest: It has the information about the version of the assembly.
2.Type Metadata: Contains the binary information of the program
3.MSIL: Microsoft Intermediate Language Code
4.Resources: List of related files

Posted Date:- 2021-08-24 07:17:31

Mention what is data access modifier in .NET?

Data access modifier in .NET provide a class, a function or a variable with accessibility.

Posted Date:- 2021-08-24 07:15:51

Mention what is STA in .NET?

STA or single threaded apartment model offers a message-based paradigm for dealing with multiple objects running concurrently. Every thread lives within its own apartment.

Posted Date:- 2021-08-24 07:15:23

What is BCL?

1.BCL is a base class library of classes, interfaces and value types
2.It is the foundation of .NET framework applications, components, and controls
3.Encapsulates a huge number of common functions and make them easily available for the developers
4.It provides functionality like threading, input/output, security, diagnostics, resources, globalization, etc.
5.Also serves the purpose of interaction between user and runtime
6.It also provides namespaces that are used very frequently. for eg: system, system.Activities, etc.

Posted Date:- 2021-08-24 07:15:01

What is the difference between Response.Redirect and Server.Transfer?

Response.Redirect basically redirects the user’s browser to another page or site. The history of the user’s browser is updated to reflect the new address as well. It also performs a trip back to the client where the client’s browser is redirected to the new page.

Whereas, Server.Transfer transfers from one page to the other without making any round-trip back to the client’s browser. The history does not get updated in the case of Server.Transfer.

Posted Date:- 2021-08-24 07:11:51

Why do we use Response.Output.Write()?

Response.Output.Write() is used to get the formatted output.

Posted Date:- 2021-08-24 07:11:21

What do you know about CTS?

CTS stands for Common Type System. It follows certain rules according to which a data type should be declared and used in the program code. CTS also describes the data types that are going to be used in the application. We can even make our own classes and functions following the rules in the CTS, it helps in calling the data type declared in one program language by other programming languages.

Posted Date:- 2021-08-24 07:10:32

Explain memory-mapped files.

Memory-mapped files (MMFs) allow you map the content of a file to the logical address of an application. These files enable the multiple processes running on the same machine to share data with each Other. The MemoryMappedFile.CreateFromFile() method is used to obtain a MemoryMappedFile object that represents a persisted memory-mapped file from a file on disk.

These files are included in the System.IO.MemoryMappedFiles namespace. This namespace contains four classes and three enumerations to help you access and secure your file mappings.

Posted Date:- 2021-08-24 07:10:05

What is managed extensibility framework?

Managed extensibility framework (MEF) is a new library that is introduced as a part of .NET 4.0 and Silverlight 4. It helps in extending your application by providing greater reuse of applications and components. MEF provides a way for host application to consume external extensions without any configuration requirement.

Posted Date:- 2021-08-24 07:09:26

What is an IL?

Intermediate Language is also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .NET source code is compiled to IL. IL is then converted to machine code at the point where the software is installed, or at run-time by a Just-In-Time (JIT) compiler.

Posted Date:- 2021-08-24 07:07:40

What are code contracts?

Code contracts help you to express the code assumptions and statements stating the behavior of your code in a language-neutral way. The contracts are included in the form of pre-conditions, post-conditions and object-invariants. The contracts help you to improve-testing by enabling run-time checking, static contract verification, and documentation generation.

Posted Date:- 2021-08-24 07:07:19

What is MSIL?

When the code is compiled, the compiler translates your code into Microsoft intermediate language (MSIL). The common language runtime includes a JIT compiler for converting this MSIL then to native code.
MSIL contains metadata that is the key to cross language interoperability. Since this metadata is standardized across all .NET languages, a program written in one language can understand the metadata and execute code, written in a different language. MSIL includes instructions for loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations.

Posted Date:- 2021-08-24 07:06:07

What are sealed classes in C#?

Sealed classes are used to restrict the inheritance feature of object-oriented programming. Once a class is defined as a sealed class, the class cannot be inherited.

In C#, the sealed modifier is used to define a class as sealed. In Visual Basic .NET the Not Inheritable keyword serves the purpose of the sealed class. If a class is derived from a sealed class then the compiler throws an error.

If you have ever noticed, structs are sealed. You cannot derive a class from a struct.

The following class definition defines a sealed class in C#:

// Sealed class
sealed class SealedClass
{
}

Posted Date:- 2021-08-24 07:05:29

Mention what is .Net Namespaces?

Namespaces in .NET is nothing but a way to organize .NET Framework Class Library into a logical grouping according to their usability, functionality as well as category they belong to.

Posted Date:- 2021-08-24 07:02:41

What are extension methods in C#?

Extension methods enable you to add methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type.

An extension method is a special kind of static method, but they are called as if they were instance methods on the extended type.

Posted Date:- 2021-08-24 07:01:36

What is the difference between namespace and assembly?

An assembly is a physical grouping of logical units while namespace groups classes. A namespace can span multiple assemblies.

Posted Date:- 2021-08-24 07:01:03

What is the difference between int and int32?

There is no difference between int and int32. System. Int is an alias name for System.Int32 which is a .Net Class.

Posted Date:- 2021-08-24 07:00:44

What is CTS?

Common Type System (CTS) describes the datatypes that can be used by managed code. CTS defines how these types are declared, used and managed in the runtime. It facilitates cross-language integration, type safety, and high performance code execution. The rules defined in CTS can be used to define your own classes and values.

Posted Date:- 2021-08-24 07:00:07

What are Properties in C#?

C# properties are members of a C# class that provide a flexible mechanism to read, write or compute the values of private fields, in other words, by using properties, we can access private fields and set their values. Properties in C# are always public data members. C# properties use get and set methods, also known as accessors, to access and assign values to private fields.

Posted Date:- 2021-08-24 06:59:43

What are the different components of .NET?

Following are the components of .NET

a) Common Language run-time
b) Application Domain
c) Common Type System
d) .NET Class Library
e) .NET Framework
f) Profiling

Posted Date:- 2021-08-24 06:59:19

What is CLR?

The .NET Framework provides a runtime environment called the Common Language Runtime or CLR. The CLR can be compared to the Java Virtual Machine or JVM in Java. CLR handles the execution of code and provides useful services for the implementation of the program. In addition to executing code, CLR provides services such as memory management, thread management, security management, code verification, compilation, and other system services. It enforces rules that in turn provide a robust and secure execution environment for .NET applications.

Posted Date:- 2021-08-24 06:55:04

Mention what are main components of .Net framework?

The main components of .Net framework are

1.Common Language Runtime (CLR)
2. .Net Framework Class Library (FCL)
3. Application Domains
4. Runtime Host
5. Cross-Language Interoperability
6. Side-by-Side Execution
7. Profiling
8. Dynamic Language Runtime (DLR)
9. Common Type System
10. Metadata and Self-Describing Components
11. .Net Framework Security
12. Model View Presenter (MVP) Architecture

Posted Date:- 2021-08-24 06:54:41

What does .NET Framework provides?

.NET Framework renders the necessary compile time and run time foundation to build and run any language that conforms to the Common Language Specification (CLS).

Posted Date:- 2021-08-24 06:51:55

What is the .NET Framework?

The .NET Framework is set of technologies that form an integral part of the .NET Platform. It is Microsoft's managed code programming model for building applications that have visually stunning user experiences, seamless and secure communication, and the ability to model a range of business processes.


The .NET Framework has two main components: the common language runtime (CLR) and .NET Framework class library. The CLR is the foundation of the .NET framework and provides a common set of services for projects that act as building blocks to build up applications across all tiers. It simplifies development and provides a robust and simplified environment which provides common services to build application. The .NET framework class library is a collection of reusable types and exposes features of the runtime. It contains of a set of classes that is used to access common functionality.

Posted Date:- 2021-08-24 06:51:02

Search
R4R Team
R4R provides C# (.NET Framework) Freshers questions and answers (C# (.NET Framework) Interview Questions and Answers) .The questions on R4R.in website is done by expert team! Mock Tests and Practice Papers for prepare yourself.. Mock Tests, Practice Papers,C# (.NET Framework) interview question set 1,C# (.NET Framework) Freshers & Experienced Interview Questions and Answers,C# (.NET Framework) Objetive choice questions and answers,C# (.NET Framework) Multiple choice questions and answers,C# (.NET Framework) objective, C# (.NET Framework) questions , C# (.NET Framework) answers,C# (.NET Framework) MCQs questions and answers R4r provides Python,General knowledge(GK),Computer,PHP,SQL,Java,JSP,Android,CSS,Hibernate,Servlets,Spring etc Interview tips for Freshers and Experienced for C# (.NET Framework) fresher interview questions ,C# (.NET Framework) Experienced interview questions,C# (.NET Framework) fresher interview questions and answers ,C# (.NET Framework) Experienced interview questions and answers,tricky C# (.NET Framework) queries for interview pdf,complex C# (.NET Framework) for practice with answers,C# (.NET Framework) for practice with answers You can search job and get offer latters by studing r4r.in .learn in easy ways .