Interviews Questions asp.net developer Ask Question
By   Junaid A     23-Jan-2025    1

Most Popular Interviews Questions  asp.net developer with Answers

 

1- Design patterns (Singleton, Abstract, Repository)
    is template for how to solve a problem that can be used in many different situations.

    Singleton Design Pattern:  This pattern ensures that the class has only one instance and provides a global point of access to it.
    the static keyword ensures that only one instance of the object is created and you can call methods of the class without creating an object.

    
    Repository Design Pattern: acts as a middleman or middle layer between the rest of the application and the data access logic. 
    That means a repository pattern isolates all the data access code from the rest of the application. The advantage of doing so is that,     
    if you need to do any changes then you need to do it in one place. Another benefit is that testing your controllers becomes easy because 
    the testing framework need not run against the actual database access code. With repository design pattern


    Factory Design Pattern states that “A factory is an object which is used for creating other objects”. In technical terms, we can say that a factory is a class with a method.
     That method will create and return different types of objects based on the input parameter, it received. In simple words, if we have a superclass and n number of subclasses, 
    and based on the data provided, if we have to create and return the object of one of the subclasses, then we need to use the Factory Design Pattern in C#.
    In the Factory Design pattern, we create an object without exposing the object creation logic to the client and the client will refer to the newly created object using a 
    common interface. The basic principle behind the factory design pattern is that, at run time, we get an object of a similar type based on the parameter we pass. 
    ref=> https://dotnettutorials.net/lesson/factory-design-pattern-csharp/
 
    2- .Net Components
    The two major components of . NET Framework are the Common Language Runtime and the . NET Framework Class Library. 
    The Common Language Runtime (CLR) is the execution engine that handles running applications.

    1) .NET Class Library
    .NET framework contains multiple classes that are readily available for developers. The classes in the FCL (framework class library) are grouped under multiple namespaces.

    2) Common Language Runtime
    CLR provides interoperability between different language, like C# , VB, Visual C++, by providing a common environment for the execution of code written in of these languages.

    3) Dynamic Language runtime
    DLR provides to execute dynamic languages on .NET Framework by adding some special services to the CLR.

    4) Application domains
    It is used to isolate the process of different applications and can be defined by .NET framework.

    5) .NET Framework Security
    .NET framework provides multiple tools that can be used by developers to protect the resources and code from unauthorized users.

    6) Cross Language interoperability
    Object or complied code of one language can be used in other .NET compatible language.

    7) Side by side execution
    In the same application we can use multiple versions of CLR simultaneously.

    8) Common Type System
    CTS is used to maintain data integrity across the code written in different .NET compliant languages. CTS also used to prevent data loss when a type in one language transfers data to its equivalent type in other language


    
3- CLR working
    The Common Language Runtime (CLR), the virtual machine component of Microsoft . NET Framework, manages the execution of . NET programs. 
    Just-in-time compilation converts the managed code (compiled intermediate language code) into machine instructions which are then executed on the CPU of the computer.

4- managed unmanaged code
    the code, which is developed in .NET framework, is known as managed code. This code is directly executed by CLR with help of managed code execution.
     Any language that is written in .NET Framework is managed code.
    Managed code uses CLR which in turns looks after your applications by managing memory, handling security, allowing cross - language debugging, and so on.

    Unmanaged Code: is developed outside .NET, Framework is known as unmanaged code.
    Applications that do not run under the control of the CLR are said to be unmanaged, and certain languages such as C++ can be used to write such applications, which, for example, access low - level functions of the operating system. Background compatibility with code of VB, ASP and COM are examples of unmanaged code. 
    Unmanaged code can be unmanaged source code and unmanaged compile code.

    

5- How to secure API's
    
    - Use OAuth2
    - Use API keys
    - Validate and sanitize all data in API requests;
    - Rate Limit
    - Https
    - Encrypt traffic using TLS
    - Enforce IP address filtering

6- Query optimization
    - Add missing indexes
    - Check for unused indexes
    - Avoid using multiple OR in the FILTER predicate
    - Use wildcards at the end of a phrase only
    - Avoid too many JOINs
    - Avoid using SELECT DISTINCT
    - Use SELECT fields instead of SELECT *
    - Use TOP to sample query results
    - Avoid data types conversion in where
    - Run the query during off-peak hours
    - Create JOINs with INNER JOIN (not WHERE)
    
7- Redis
    Redis is an open source (BSD licensed), in-memory data structure store used as a database, cache, message broker, and streaming engine. 
    Redis provides data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes, and streams.

8- Caching
    Caching enables you to store data in memory for rapid access. When the data is accessed again, applications can get the data from the cache instead of
     retrieving it from the original source. This can improve performance and scalability

9- Soap API's
    Simple Objects Access Protocol is a web communication protocol designed by Microsoft back in 1998. 
    Today, it’s mostly used to expose web services and transmit data over HTTP/HTTPS. SOAP, 
    supports the XML data format only and strongly follows preset standards such as messaging structure, 
    a set of encoding rules, and a convention for providing procedure requests and responses.
    The built-in functionality to create web-based services allows SOAP to handle communications and make responses language- and platform-independent.

10- .exe files
    An executable file (EXE file) is a computer file that contains an encoded sequence of instructions that the system can execute
     directly when the user clicks the file icon. Executable files commonly have an EXE file extension, but there are hundreds of other executable file formats.

11- Assemblies
    An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality. 
    Assemblies take the form of executable (.exe) or dynamic link library (. dll) files, and are the building blocks of . NET applications.

12- dlls
    A DLL is a library that contains code and data that can be used by more than one program at the same time. For example, 
    in Windows operating systems, the Comdlg32 DLL performs common dialog box related functions. Each program can use the 
    functionality that is contained in this DLL to implement an Open dialog box

4:47 pm 05/10/2022

13- Indexing
    Indexing is a way to optimize the performance of a database by minimizing the number of disk accesses required when a query is processed.
    It is a data structure technique which is used to quickly locate and access the data in a database.
    
    There are two types of Indexes in SQL Server:
    Clustered Index
    Non-Clustered Index
    Clustered Index
    A clustered index defines the order in which data is physically stored in a table. Table data can be sorted in only way, therefore, 
    there can be only one clustered index per table. In SQL Server, the primary key constraint automatically creates a clustered index on that particular column.
        e.g. CREATE CLUSTERED INDEX IX_tblStudent_Gender_Score ON student(gender ASC, total_score DESC)
    
    Non-Clustered Indexes
    A non-clustered index doesn’t sort the physical data inside the table. In fact, a non-clustered index is stored at one place and table data is stored in another place. 
    This is similar to a textbook where the book content is located in one place and the index is located in another. This allows for more than one non-clustered index per table.
    
     e.g CREATE NONCLUSTERED INDEX IX_tblStudent_Name     ON student(name ASC)

14- Http verbs and their differences
    HTTP Verb    CRUD    Entire Collection (e.g. /customers)    Specific Item (e.g. /customers/{id})
    POST    Create    201 (Created), 'Location' header with link to /customers/{id} containing new ID.    404 (Not Found), 409 (Conflict) if resource already exists..
    GET    Read    200 (OK), list of customers. Use pagination, sorting and filtering to navigate big lists.    200 (OK), single customer. 404 (Not Found), if ID not found or invalid.
    PUT    Update/Replace    405 (Method Not Allowed), unless you want to update/replace every resource in the entire collection.    200 (OK) or 204 (No Content). 404 (Not Found), if ID not found or invalid.
    PATCH    Update/Modify    405 (Method Not Allowed), unless you want to modify the collection itself.    200 (OK) or 204 (No Content). 404 (Not Found), if ID not found or invalid.
    DELETE    Delete    405 (Method Not Allowed), unless you want to delete the whole collection—not often desirable.    200 (OK). 404 (Not Found), if ID not found or invalid.
    
15- API Response codes like what is 400, 401 etc     

    200 OK The request was successfully completed.
    201 Created A new resource was successfully created.
    400 Bad Request The request was invalid.
    401 Unauthorized The request did not include an authentication token or the authentication token was expired.
    403 Forbidden The client did not have permission to access the requested resource.
    404 Not Found The requested resource was not found.
    405 Method Not Allowed The HTTP method in the request was not supported by the resource. For example, the DELETE method cannot be used with the Agent API.    
    409 Conflict The request could not be completed due to a conflict. For example,  POST ContentStore Folder API cannot complete if the given file or folder name already exists in the parent location.
    500 Internal Server Error The request was not completed due to an internal error on the server side.
    503 Service Unavailable The server was unavailable.

    

16- OutBoundException, NetworkException , exception hierarchy 

    The StringIndexOutOfBoundsException is an unchecked exception in Java that occurs when an attempt is made to access the character of
     a string at an index which is either negative or greater than the length of the string.

    Network exception? Error code indicating the IP address being contacted is unreachable, meaning there is no route to the specified host or network.

    What is the hierarchy of exceptions: The class at the top of the exception class hierarchy is the Throwable class, 
    which is a direct subclass of the Object class. Throwable has two direct subclasses - Exception and Error. The Exception class is used for exception conditions that the application may need to handle


17- Views in SQL
     a view is a virtual table based on the result-set of an SQL statement. A view contains rows and columns, 
    just like a real table. The fields in a view are fields from one or more real tables in the database.

18- Can we apply orderyby in Views.
    The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP, OFFSET or FOR XML is also specified.
19- Transaction in SQL
    A transaction is a sequence of operations performed (using one or more SQL statements) on a database as a single logical unit of work. 
    The effects of all the SQL statements in a transaction can be either all committed (applied to the database) or all rolled back (undone from the database). 
    A database transaction must be atomic, consistent, isolated and durable.

    COMMIT WORK;
    A database transaction must be atomic, consistent, isolated and durable. Bellow we have discussed these four points.
    Atomic : A transaction is a logical unit of work which must be either completed with all of its data modifications, or none of them is performed.
    Consistent : At the end of the transaction, all data must be left in a consistent state.
    Isolated : Modifications of data performed by a transaction must be independent of another transaction. Unless this happens, the outcome of a transaction may be erroneous.
    Durable : When the transaction is completed, effects of the modifications performed by the transaction must be permanent in the system.
          Often these four properties of a transaction are acronymed as ACID.

20- CI/CD pipelines
    A continuous integration and continuous deployment (CI/CD) pipeline is a series of steps that must be performed in order to deliver a new version of software. 
    CI/CD pipelines are a practice focused on improving software delivery throughout the software development life cycle via automation

21- EF structure and working
    The Entity Framework enables developers to work with data in the form of domain-specific objects and properties, 
    such as customers and customer addresses, without having to concern themselves with the underlying database tables and columns where this data is stored
    
22- Anti forgery
    The purpose of using anti-forgery tokens is to prevent cross-site request forgery (CSRF) attacks. 
    It does this by submitting two different values to the server on any given POST, both of which must exist in order for the server to allow the request

23- CSRF
    Cross-Site Request Forgery (CSRF) is an attack that forces authenticated users to submit a request to a Web application against which they are currently authenticated.

24- Response return from MVC redirect to route.
    Return View
    Return partial View
    Redirect
    Redirect To Action
    Return content
    Return JSON
    Return Javascript
    Return File

25- Return File
    FileResult
    FileContentResult
    FileStreamResult
    VirtualFileResult
    PhysicalFileResult
    
26- Cookies
    Cookies is a small piece of information stored on the client machine. This file is located on 
    client machines "C:\Document and Settings\Currently_Login user\Cookie" path. Its is used to store user preference information like Username, Password,City and PhoneNo etc on client machines

27- How to maintain sessions on different servers.
    If you are deploying application on more than one server, you should use "Clustering".
     Application servers are able to handle this scenario using "session replication". With session replication, each server will have a copy of the active users session. IF the first request goes to server A and second request goes to server B, it will be transparent to application code and end user

     configure the sessionState element in your web. config to use cookieName="SOME_COOKIE_NAME_HERE" in both apps. Then, 
    just make sure the urls have the same TLD (top-level domain), i.e. app1.mydomain.com and app2.mydomain.com and you should be able to handle the Session_Start event in Global.


28- Binding
    The term 'data binding in ASP.NET simply means that the data that is collected from a source is bound to the controls that provide the read and write connection to the data.
    
    Binding is an association of function calls to an object. The binding of a member function, which is called within an object and is 
    called compiler time or static type or early binding. All the methods are called an object or class name are the examples of compile time binding

29- Bundling
    Bundling allows us to load the bunch of static files (css,js) from the server in a single HTTP request

30- Boxing unboxing
    Boxing is the process of converting a value type to the type object or to any interface type implemented by this value type.
     When the common language runtime (CLR) boxes a value type, it wraps the value inside a System. Object instance and stores it on the managed heap.
     Unboxing extracts the value type from the object

31- Diff between stack and heap    
    The major difference between Stack memory and heap memory is that the stack is used to store the order of method execution  and local variables 
    while the heap memory stores the objects and it uses dynamic memory allocation and deallocation.

    

32- Diff between value types and ref types
     Variables of reference types store references to their data (objects), while variables of value types directly contain their data

33- What’s the difference between Abstract Classes and interfaces?
     An abstract class allows you to create functionality that subclasses can implement or override. 
    An interface only allows you to define functionality, not implement it. And whereas a class can extend only one abstract class, it can take advantage of multiple interfaces

34- How we can achieve abstraction?
    We can achieve 100% abstraction using interfaces. Abstract classes and Abstract methods : 
    An abstract class is a class that is declared with an abstract keyword. An abstract method is a method that is declared without implementation

35- Benefits of using the Interfaces? 
    1. Interfaces allow us to implement polymorphic behaviour
    2. Interfaces allow us to develop very loosely coupled systems.
    3. Interfaces enable mocking for better unit testing.
    4. Interfaces enables us to implement multiple class inheritance in C#.
    5. Interfaces are great for implementing Inverson of Control or Dependancy Injection.

    
36- What’s the difference between static constructor /  default constructor?
    Static constructor runs once per AppDomain just before you access the instance of class first time. 
    You can use it to initialize static variables. On the other hand default constructor runs every time you create new instance of the class. 
    in default constructor you can initialize non-static fields of the instance

37- What is the difference between .net framework and .net Core?

     NET Core is much faster.
    -cross plateform
    - much secure

38- How we can manage state in .net framework / .net core

    State management is a process by which you maintain the state of an object or variable throughout the lifetime of a page. 
    In ASP.NET, there are two types of state management: client-side state management and server-side state management


39- How we can implement caching?
40- Describe the web form events?
Page_Init


Page_Load


Page_PreRender


Page_Unload


Page_Disposed


Page_Error


Page_AbortTransaction


Page_CommitTransaction 


Page_DataBinding

41- Describe Global.asax events
42- What’s the difference between Repeater Control and Data grid?
43- In which event of page you can change the master page of a child page?

    The Page_PreInit event occurs immediately before the page processing occurs and is the last opportunity to change the master page that will be used to render the page.

44- What is the purpose of using view state? Pros & Cons

45- What is DI?
     dependency injection (DI) software design pattern, which is a technique for achieving Inversion of Control (IoC) between classes and their dependencies. 
    Dependency injection in . NET is a built-in part of the framework, along with configuration, logging, and the options pattern

46- What’s the difference between Transient and Scoped in .net Core?
    Scoped approach => This is a better option when you want to maintain a state within a request. 
    Transient approach => Use this approach for the lightweight service with little or no state

47- How we can manage sessions? Where we can store session in case of Web Farm?
    For on-premises deployments, ASP.NET Session State provides three built-in storage options (InProc, StateServer, and SqlServer)

48- What are Rest APIs
    REST is a set of architectural constraints, not a protocol or a standard. API developers can implement REST in a variety of ways.s

    A client-server architecture made up of clients, servers, and resources, with requests managed through HTTP.
    Stateless client-server communication, meaning no client information is stored between get requests and each request is separate and unconnected.
    Cacheable data that streamlines client-server interactions.
    A uniform interface between components so that information is transferred in a standard form. 
    A layered system that organizes each type of server (those responsible for security, load-balancing, etc.) involved the retrieval of requested information into hierarchies, invisible to the client.
    Code-on-demand (optional): the ability to send executable code from the server to the client when requested, extending client functionality. 
    
    
49- How we can secure Rest APIs
50- What is JWT? And how it works?
    JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information
     between parties as a JSON object. This information can be verified and trusted because it is digitally signed.

51- What are action filters?
    An action filter is an attribute that you can apply to a controller action -- or an entire controller -- that modifies the way in which the action is executed

    Authorization filters – Implements the IAuthorizationFilter attribute.
    Action filters – Implements the IActionFilter attribute.
    Result filters – Implements the IResultFilter attribute.
    Exception filters – Implements the IExceptionFilter attribute.

52- How MVC pipeline works?
    We can say that pipeline of MVC contains the following processes,
    Routing.
    Controller Initialization.
    Action Execution.
    Result Execution.
    View Initialization and Rendering.
    
52- Any idea about logging frameworks? 
    log4net
53- How we can optimize a SQL? Describe the best practices?

54- Difference between temp table and table variable
    A Temp table is easy to create and back up data. Table variable involves the effort when you usually create the normal tables. 
    Temp table result can be used by multiple users. Table variable can be used by the current user only


55- What’s the difference between IN operation and Exists Operator?

56- Why we use Stored procedures instead of inline queries?

57- Any idea about Indexs?

58- How you will identify the Index is required?
59- Any idea about the query optimization plan?

60- What’s the difference between seek and scan?
    Index scan means it retrieves all the rows from the table 
    and index seek means it retrieves selective rows from the table

61- Is it good approach to use scalar function in where clause? If not then what will be the alternative?
62- What is ORM?

63- different types of Entity framework approaches
64- what are POCO classes?
    A POCO entity is a class that doesn't depend on any framework-specific base class. It is like any other normal . 
    NET CLR class, which is why it is called "Plain Old CLR Objects". POCO entities are supported in both EF 6 and EF Core.

65- main components of Entity Framework Architecture
66- different types of inheritance in Entity Framework
67- DbEntityEntry Class in EF
68- What is migration history table?
    Migrations history table is a table used by Code First Migrations to store details about migrations applied to the database. 
    By default the name of the table in the database is __MigrationHistory and it is created when applying the first migration to the database.
    
69- Difference between lazy loading and eager loading
70- Pros and cons of different types of loading?
71- Difference between LINQ to Entities and Entity SQL
72- What are different entity states in EF
73- Describe SSDL , MSL and CSDL in an Edmx file
74- Difference between LINQ and Entity Framework
    Entity Framework is an object-relational mapping (ORM) framework for connecting C# code to external databases, usually SQL Server. LINQ is a query language embedded into C# and a set of extension methods in order to make it useful.

75- Filter indexing
76- MSIL
77- Solid Principal
78- ABCs of WCF
    A: Address 
    Where exactly os your service hosted? In other words, what is the location of the service? An address could be an IP Address, server name, URL and so on.
    
    B: Binding 
    It is about how the messages are handled in the service side and the client side. Binding is a group of elements that correspond to the transport and 
    protocol channels located in the channel stack. The channel stack is the sequence of channels that each passes through to the runtime execution.
    
    Contract: Agreement 
    The contract is an agreement between the client and the server about the structure and content of messages being exchanged. The Data Contract is about the structure of the message, whereas the message contract is about the content of the message being exchanged
    To reach an endpoint, the Where (Address), the How (Binding) and the What (Contract) are really important for establishing communication.

79) Dispose Function vs using statement
    The Dispose() method
        The Dispose method performs all object cleanup, so the garbage collector no longer needs to call the objects' Object.
         Finalize override. Therefore, the call to the SuppressFinalize method prevents the garbage collector from running the finalizer. If the type has no finalizer,
         the call to GC.

    purpose of using statement
        The main goal is to manage resources and release all the resources automatically


80) Filtered Index
    - is non clustered index with where conditions
    - cluster index are faster as storage in same table and ONLY ONE cluster index per table
     e.g  create clustered index tbl_systemUsers_Gender_Salary  on sytemusers (gender desc,Salary asc)
     e.g  create nonclustered index tbl_systemUsers_name  on sytemusers (name)

81) Marinating sessions


82) Key points to Introduce yourself

1) Greetings

2) Thank you

3) Your Name

4) Qualifications

5) Additional Qualifications

6) Position & Company

7) Role & Responsibility

8) why you wants to leave/join

9) Read about JDR and company
10) Ask atleast 2 question from the interviwer

Solutions


10378
Copyright Future Minutes © 2015- 2025 All Rights Reserved.   Terms of Service  |   Privacy Policy |  Contact US|  Pages|  Whats new?
Update on: Dec 20 2023 05:10 PM