Você está na página 1de 18

Real Time .

NET Interview Question and Answers:

1. Page life cycle of ASP.NET (ASP.NET Interview Question)


2. Application life cycle in ASP.NET or MVC? (Ex: Application_Start, Application_Init,
Application_End, Application_End) (ASP.NET Interview Question)
3. Tell something, you initialize or write code inside application events in your
project. (ASP.NET Interview Question)
4. What is the use of global.asax file? (ASP.NET Interview Question)
5. What is application pool and what is the main use of application pool? (IIS – .NET
Interview Questions)
6. We have one interface with 5 methods? We implemented those methods in a
class. But one of your clients wants to use only three methods of that interface.
Then how you inherit the same interface to implement only three methods. (Real-
time interview question)
7. What are JQuery selectors? JQ
8. Explain some JQuery selectors you used in your application. JQ
9. How to hide all the controls in your asp.net page using a single line of JQuery
syntax. JQ Real-time
10. How to remove and add a CSS class in JQuery in single line. JQ Real-time
11. How many clustered indexes we can create in a table.
12. Is it possible to call multiple functions in one store procedure?
13. Is it possible to call one function in multiple stored procedures?
14. How to find all the stored procedure names which used a single function (for ex:
GetEmployeeName function?
15. What are the things you do to optimize a query or stored procedure?
16. What is the purpose of using profiler in SqlServer?
17. How to choose or find the column name which needs to implement clustered
index?
18. The execution time of a stored procedure is very high. How can you find which
query statement inside the procedure is very slow. Then how you optimize the
query to solve the performance issue of that SP?
19. Which one is good in performance while you compare between stored procedure
and functions?
20. Which one is good in performance while you compare between joins and sub
queries?
21. Write a simple query in LINQ.
22. Write a simple query in LINQ using Lambda Expression.
23. Write a simple join query in LINQ.
24. Write a join query using multiple tables in LINQ?
25. Write a left join query using 2 tables in LINQ?
26. We have two methods for method overloading? (a) public string Calculate(int a,
int b) (b) public int Calculate(int a , int b). Is these method implement method
overloading?
27. In ASP.NET, if any error throws it finally hits Application_Error event. Inside
Application_Error event you wrote a code to redirect to another page. That page
also has some error. If so, what will happen?
28. You call three store procedures (Insert, update and update) inside a stored
procedure, in some case, the insert stored procedure throws exception. Then
what happened to the next two store procedures. Those SPs are executed or not?
29. What are the things you do to improve the performance of you r application in
Data Access Layer level?
30. What are the things you do to improve the performance of your application in C#?
31. What are the main things you concentrate while you review the code of your
junior?
32. What the main things you give first importance while you design a database
structure?
33. Session management in ASP.NET. (Very important question)
34. Where the session is stored while you use session in your application?
35. Types of session storage you used in your application? How and Why?
36. Write the syntax of ajax call in MVC.
37. What is the difference between “Get” and “Post’ methods?
38. What is the purpose of using AllowGet in Json?
39. How to call a Grid control inside a grid control in ASP.NET?
40. What is XSS (Cross site scripting) in MVC?
41. What is anti-forgery token? How to implement anti-forgery token in MVC?
42. What is dependency injection?
43. What is IOC (Inversion of control) concept?
44. Types of dependency injections.
45. How you implement the DI (Dependency injection) in your application?
46. What is HTML helper class?
47. Did you use any custom HTML helper classes in you MVC project? If yes, then
explain the purpose of it.
48. What are the types of validation you used in your MVC application? How you
implement those validations in you MVC applications?
49. What are the types of exception handling methods you used in your applications?
50. You implement an application which is used inside a premise (Intranet
application). Then which WCF binding method you used in your application.
51. What is the difference between HttpBindings and wsHttpBindings?
52. What are the types of authentications you used in application (ASP.Net or
MVC).Explain it in brief.
53. What are the tools you used to test the Rest API?
54. What is the purpose of using having clause in SqlServer?
55. What is the use of Dynamic keyword in C#?
56. How to authenticate the WebAPI you wrote?
57. How to define or differentiate the Get and Post in your WebAPI?
58. What is the default timeout of session in your application?
59. What is the maximum length of Query string?
60. What is use of RenderBody, RenderSection and RenderPage in MVC?
61. What is ViewBag, ViewData and TempData?
62. What is the difference between ViewBag, ViewData and TempData?
63. I transferred a value using TempData from one action to another action. In the
second action method, I call (redirect to ) another action method. In that third
action method, I try to get the value of the TempData. Is that value is available in
that TempData?
64. You have a three gridviews in a page. First grid contains 100 records. Second grid
contains 10 billion records. Third grid contains 10 records. You call ajax methods
to retrieve the data. In this case, which grid is loaded first? Or else, is all the grids
are loaded at the same time?
65. A MVC view page contains two grids. One is Employee details and another one is
Customer details. In the view page you should call only the employee model
class. Then how you fill the customer details in the second grid?
66. How to call more than one model inside a view in MVC?
67. Explain about the MVC architecture.
68. Explain about the MVC life cycle.
69. What is the use of map routing in MVC?
70. How many route tables are available in a MVC application?
71. Write the syntax of implement routing in MVC?
72. Write a CSS class or method to view a page in multiple resolutions (Responsive
design).
73. What is bundling?
74. In an ASP.NET page, two content panels each have a text box and a button
control. How to load/reload only the first panel, if we hit the button in the first
panel?
75. What is the difference between abstract class and interface? C#
76. Ads

---

Asp.NET Interview Questions


Question # 1 What is ASP.NET?

Answer # ASP.NET is a web development platform, which provides a programming model, a


comprehensive software infrastructure and various services required to build web-based applications.

Question # 2 Is asp net free?

Answer # Misconception: It’s Closed. Microsoft makes the source code for the .NET Framework
available for free. Microsoft is a company that sells software, and they are naturally very protective
of their products’ source code. So, one might think that ASP.NET (and .NET in general) is closed
source, but that is not the case.

Question # 3 What is CSS in asp net?


Answer # ASP.NET Web pages function as HTML pages at run time. You can therefore use
cascading style sheets (CSS) to set the appearance of any elements on the page other than Web server
controls.

Question # 4 What is asp net c#?


C# is a CLS programming language designed for the .NET framework. ASP.NET is part of the .NET
framework allowing you to write web applications using any CLS compliant language such as C#,
VB.NET, F#, etc.

Question # 5 What is the full meaning of ASP Net?

Answer # It was first released in January 2002 with version 1.0 of the .NET Framework, and is the
successor to Microsoft’s. Active Server Pages (ASP) technology. ASP.NET is built on the Common
Language Runtime (CLR), allowing programmers to writeASP.NET code using any supported .NET
language.

Question # 6 Why do we use ASP net?

Answer # ASP.NET is an open-source server-side web application framework designed for web
development to produce dynamic web pages. It was developed by Microsoft to allow programmers to
build dynamic web sites, web applications and web services.

Question # 7 What is ASP short for?

Answer # ASP is also an abbreviation for Active Server Page. An application service provider (ASP)
is a company that offers individuals or enterprises access over the Internet to applications and related
services that would otherwise have to be located in their own personal or enterprise computers.

Question # 8 What is the difference between C# and .NET?

Answer # C# is a language, .NET is an application framework. The .NET libraries can run on the
CLR and thus any language which can run on the CLR can also use the .NET libraries. This common
.net format is what allows libraries to be shared between .net languages (C#, VB.Net, F# and others)
easily.

Question # 9 What is the difference between ASP and ASP NET?


ASP is interpreted whereas, ASP.NET is compiled. This implies that since ASP uses VBScript;
therefore, when an ASP page is executed, it is interpreted. On the other hand, ASP.NET uses .NET
languages, such as C# and VB.NET, which are compiled to Microsoft Intermediate Language
(MSIL).

Question # 10 Is asp net a programming language or framework?

Answer # ASP.NET is a framework generally written in one of two languages – VB script or C#.
ASP .NET is a server-side scripting language. Your .aspx pages are just scripts that tell IIS how to
render a page.
Asp.NET Interview Questions For
Freshers
Question # 11 Can you use C# without .net?

Answer # C# is just a programming language. … C# is the choice for developing managed


applications which run on .NET Framework. If you want to avoid it, you can go to Visual C++
(without .NET) development using Visual Studio. However, .NET framework comes pre-installed
with latest Operating system.

Question # 12 What are the advantages of ASP Net?

Answer # Some key advantages of ASP.NET framework for Web development are as follows:
* Built-in Windows authentication and per-application configuration keep your applications secured.
* ASP.NET reduces the line of code needed to develop large applications.
* The ASP code and HTML smoothly mix with each other to generate dynamic web pages.
* It is an ideal server-side scripting technology that is why code runs on the windows server before
displaying on the web browser.
* Dot NET framework is language independent, so choose any programming language that best
suited to develop your application.
* ASP.NET is easy to deploy because of built-in configuration information.
* The Windows Web server precisely monitors the web pages, various components and application
running over it.
* It immediately gives an alert for any memory leaks, unbounded loops and other illegal behaviors. It
instantly kills those behaviors and restarts automatically.
* ASP.Net features such as early binding, JIT compilation, caching services and native optimization
supports to get high level of performance.
* All the applications are minutely monitored and managed to help application continuously
available to handle requests.
* WYSIWYG is an editor tool available in Visual studio.ASP.NET, with its advantages, is the next-
generation platform of Microsoft’s ASP. It is a widely used development framework for developing
an enterprise level web application. Either for building a small website or a large corporate web
application, ASP.NET is the best development application that today’s developers love to use.

Question # 13 What is the MVC framework?

Answer # The Model-View-Controller (MVC) architectural pattern separates an application into


three main components: the model, the view, and the controller. The ASP.NET MVC framework
provides an alternative to the ASP.NET Web Forms pattern for creating Web applications.

Question # 14 What is the difference between asp net and MVC?

Answer # ASP.NET Web Forms is another framework specifically for building web applications, and
the new ASP.NET Web API is a platform for building web services.

Question # 15 ASP.NET MVC2 web application is based on MVC pattern in order to facilitate unit
test, without mocking pipeline asp.net, because it’s very difficult. you don’t have code on Code
Behind in order to separate your code graphic and your code functional. With MVC your application
becomes independent of view. you can replace easily technology of creating view.

Question # 16 What is the difference between Visual Basic and ASP Net?

Answer # VB.NET is a language that is used in writing programs that are utilizing the ASP.NET
framework. ASP.NET is a server side technology that is language independent. Any .NET languages
such as C#, VB.NET can be used to develop web applications through ASP.NET. VB.NET is a .NET
programming language.

Question # 17 What is the CLR?

Answer # The Common Language Runtime (CLR), the virtual machine component of Microsoft’s
.NET framework, manages the execution of .NET programs. A process known as just-in-time
compilation converts compiled code into machine instructions which the computer’s CPU then
executes.

Question # 18 What is CSS and what is it used for?

Answer # CSS is the language for describing the presentation of Web pages, including colors, layout,
and fonts. It allows one to adapt the presentation to different types of devices, such as large screens,
small screens, or printers. CSS is independent of HTML and can be used with any XML-based
markup language.

Question # 19 What is the use of ASP Net Web API?

Answer # ASP.NET Web API is a framework that makes it easy to build HTTP services that reach a
broad range of clients, including browsers and mobile devices. ASP.NET Web API is an ideal
platform for building RESTful applications on the .NET Framework.

Question # 20 What is the MVC model?

Answer # Model–view–controller (MVC) is a software architectural pattern for implementing user


interfaces on computers. It divides a given application into three interconnected parts. This is done to
separate internal representations of information from the ways information is presented to, and
accepted from, the user.

Asp.NET Interview Questions For 1 Year


Experience
Question # 21 What is MVC in angular?

Answer # AngularJS – MVC Architecture. Advertisements. Model View Controller or MVC as it is


popularly called, is a software design pattern for developing web applications. A Model View
Controller pattern is made up of the following three parts − Model − It is the lowest level of the
pattern responsible for maintaining data.

Question # 22 Is asp net a programming language or framework?


Answer # ASP.NET is a framework generally written in one of two languages – VB script or C#.
ASP .NET is a server-side scripting language. Your .aspx pages are just scripts that tell IIS how to
render a page.

Advanced ASP.NET Interview Questions

Question # 23 What is STA?


STA stands for Single Threaded Apartment. In STA, there may be multiple apartment. But only
single thread can be executed in an apartment.

Question # 24 What is MTA?

Answer # MTA stands for Multi Threaded Apartment. In MTA, only one apartment will be there and
all threads will execute within that single apartment.

Question # 25 What threading model used in asp and asp.net?

Answer # ASP used STA threading model and ASP.NET uses MTA threading model.

Question # 26 What is a web farm?

Answer # A web farm is a group of two or more servers used to host the same site. Web farms
increase the capacity of a web site, and improve availability by providing fail-over. Web farms are
universally used for high-traffic and mission critical web sites.

Question # 27 What is web garden?

Answer # Application pool is used to separate sets of IIS worker processes and enables a better
security, reliability, and availability for any web application. Now, by default, each and every
Application pool contains a single worker process. Application which contains the multiple worker
process is called “Web Garden”.

Question # 28 What is a Web pool?

Answer # When you run IIS 6.0 in worker process isolation mode, you can separate different Web
applications and Web sites into groups known as application pools. An application pool is a group of
one or more URLs that are served by a worker process or set of worker processes.

Question # 29 What is the use of worker process in asp net?

Answer # Application Pool. Worker Process: Worker Process (w3wp.exe) runs the ASP.Net
application in IIS. This process is responsible for managing all the request and response that are
coming from the client system. All the ASP.Net functionality runs under the scope of the worker
process.
Question # 30 What is a server farm in IIS?

Answer # The first step in installing and configuring an IIS 8 web farm is to install IIS on the web
servers and load balancing server. Then install Application Request Routing (ARR) on the load
balancing server. Finally, set up your website on one of the web servers.

Question # 31 What is the application pool?


Answer # Application pools are used to separate sets of IIS worker processes that share the same
configuration and application boundaries. Application pools used to isolate our web application for
better security, reliability, and availability and performance and keep running without impacting each
other .

Question # 32 How does the IIS work?

Answer # IIS (Internet Information Server) is one of the most powerful web servers from Microsoft
that is used to host your Web application. IIS has it’s own Process Engine to handle the request. So,
when a request comes from client to server, IIS takes that request and process it and send response
back to clients.

Question # 33 What is the difference between trace and debug in asp.net?

Answer # The Debug and Trace classes have very similar methods. The primary difference is that
calls to the Debug class are typically only included in Debug build and Trace are included in all
builds (Debug and Release). You can control this through the compiler flags DEBUG and TRACE.

Question # 34 Explain different types of validators in ASP.NET?

Answer #

Required field Validator


Range Validator
Compare Validator
Custom Validator
Regular expression Validator
Summary Validator

Question # 35 How many types of session state management options available in ASP.NET?

Answer # In ASP.Net, there are two session state managemtn options are available, they are:
In-Process
Out-of-Process.

Question # 36 What are the page life cycle events?

Answer # List the events in page life cycle.

1) Page_PreInit
2) Page_Init
3) Page_InitComplete
4) Page_PreLoad
5) Page_Load
6) Page_LoadComplete
7) Page_PreRender
8) Render

Question # 37 How many types of cookies are there in ASP.NET?


Answer # Session Cookie – Resides on the client machine for a single session until the user logs out.
Persistent Cookie – Resides on a user’s machine for a period specified for its expiry, such as 10 days,
one month, and never based on the settings.

ASP.NET Interview Questions And


Answers For 2 Years Experience
Question # 38 What is the difference between Union and Union all?

Answer # The difference between Union and Union all is that Union all will not eliminate duplicate
rows, instead it just pulls all rows from all tables fitting your query specifics and combines them into
a table. A UNION statement effectively does a SELECT DISTINCT on the results set.

Question # 39 Which is faster union or union all?

Answer # Just like JOINS, UNION combines data into a single record-set but vertically by adding
rows from another table. JOINS combine data horizontally by adding columns from another table.
UNION insures you get DISTINCT records from both the tables.

Question # 40 What is the difference between union and join?

Answer # By using JOINs, you can retrieve data from two or more tables based on logical
relationships between the tables. Joins indicate how SQL should use data from one table to select the
rows in another table. The UNION operation is different from using JOINs that combine columns
from two tables.

Question # 41 What is the difference between union and structure?

Answer # The difference between structure and union is, The amount of memory required to store a
structure variable is the sum of the size of all the members. On the other hand, in case of unions, the
amount of memory required is always equal to that required by its largest member.

Question # 42 Which is better union or union all?

Answer # UNION ALL command is equal to UNION command, except that UNION ALL selects all
the values. The difference between Union and Union all is that Union all will not eliminate duplicate
rows, instead it just pulls all the rows from all the tables fitting your query specifics and combines
them into a table.

Question # 43 What are SQL Joins?

Answer # SQL Joins clause is used to combine records from two or more tables in a database. A
JOIN is a means for combining fields from two tables by using values common to each.

 Inner join
 Outer join
 Left outer join
 Right outer join
 Full outer join
Question # 44 What is a session in asp net?

Answer # ASP.NET session state enables you to store and retrieve values for a user as the user
navigates ASP.NET pages in a Web application. HTTP is a stateless protocol. This means that a Web
server treats each HTTP request for a page as an independent request.

Question # 45 What is application and session in ASP.NET?

Answer # Application and Session Variables. The Application and Session objects can be used to
store values that are global either to a particular user (the Session ) or to all users (the Application )

Question # 46 What are the types of session in asp net?

Answer # Following are the different types of session modes available in ASP.NET:

 Off.
 InProc.
 StateServer.
 SQLServer.
 Custom.
Question # 47 What is the difference between session and viewstate in asp net?

Answer # SessionState persist the data of particular user in the server. This data available till user
close the browser or session time completes. View State are valid mainly during postbacks and
information is stored in client only. Viewstate are valid for serializable data only.

Question # 48 When does a session actually start?


Answer # Session actually starts when a visitor requests a website for the first time.

Question # 48 How is a session stored and maintained in ASP.NET?

Answer # When a web app is requested by the user for the first time, the server creates a sessionID
and stores it in the cookie of the client browser. This sessionID is sent to the server in all the
subsequent requests.

Question # 49 What are HTML helpers in ASP.NET?

Answer # ASP.NET MVC provides HtmlHelper class which contains different methods that help you
create HTML controls programmatically.

Question # 50 What is the difference between Session.Abandon() vs Clear()?

Answer # Clear – Removes all keys and values from the session-state collection. Abandon –
removes all the objects stored in a Session. If you do not call the Abandon method explicitly, the
server removes these objects and destroys the session when the session times out.
Advanced ASP.NET Interview Questions
And Answers
Question # 51 What is the difference between Stored Procedure vs Function?

Answer # Function must return a value but in Stored Procedure it is optional( Procedure can return
zero or n values). Functions can have only input parameters for it whereas Procedures can have
input/output parameters . Functions can be called from Procedure whereas Procedures cannot be
called from Function.

Question # 52 What are the various ways to send content from one page to another?

Answer # There are different ways are there to send content from one page another page.

 Response. Redirect()
 Server.Transfer()
 WebClient.DownloadFile()
Question # 53 What is the difference between sealed vs static class?

Answer # When a class defined as sealed its not possible to inherit. A static class can have only static
member (e.g static method, property, and variables). A static class restrict the user to call default
constructor of the class. Static classes can only have static constructor to initialize static members.

ASP.NET Interview Questions And


Answers For 3 Years Experience
Question # 54 What is your current project?

Question # 55 What is your team size in the current project?

Question # 56 What is the team hierarchy of your project?

Question # 57 What are your roles and responsibilities in your project?

Question # 58 Can you explain about your previous projects?

Answer # Interviewers ask these type of questions to know if you are a genuine candidate or not.
Explain these type of questions with confidence.

Question # 59 What is the difference between abstract class vs interface? Can give me the real time
examples?

Answer # A class that implements an interface must provide an implementation of all the methods of
that interface. abstract classes may contain state (data members) and/or implementation (methods)
abstract classes can be inherited without implementing the abstract methods (though such a derived
class is abstract itself)

Question # 60 What is Authentication in ASP.NET?


Answer # Authentication is the process of obtaining identification credentials such as name and
password from a user and validating those credentials against some authority. If the credentials are
valid, the entity that submitted the credentials is considered an authenticated identity.

Question # 61 What are the authentication types in asp.net?

Answer #

 Windows authentication and IIS.


 Passport authentication.
 Forms authentication.
 After your application has authenticated users, you can proceed to authorize their access to
resources.
Question # 62 Which authentication uses a combination of Windows and IIS authentication?

Answer # In IIS7, ASP.NET is integrated into the request pipeline, and the composite effect is that
there is only one authentication mechanism to maintain. Passport authentication uses Microsoft’s
Windows Live ID Authentication (formally .NET Passport), which you have to be licensed to use.

Question # 63 What is the default authentication mode for asp net?

Answer # Windows authentication is used together with IIS authentication. Authentication is


performed by IIS in the following ways: basic, digest, or Integrated Windows Authentication. When
IIS authentication is complete, ASP.NET uses the authenticated identity to authorize access. This is
the default setting.

Question # 64 What is the difference between authentication and authorization?

Answer # When you log on to a PC with a user name and password you are authenticating.
Authorization is the process of verifying that you have access to something. Gaining access to a
resource (e.g. directory on a hard disk) because the permissions configured on it allow you access is
authorization.

Question # 65 What is Windows Active Directory authentication?

Answer # Active Directory authentication offers users a faster, more secure, and more scalable
authentication mechanism than LDAP authentication. By using the Kerberos authentication protocol,
SGD can securely authenticate any user against any domain in a forest. Active Directory
authentication is disabled by default.

Question # 66 What is anonymous authentication?

Answer # Anonymous authentication allows any user to access any public content without providing
a user name and password challenge to the client browser. By default, Anonymous authentication is
enabled in IIS 7.

Question # 67 Is oauth for authentication or authorization?


Answer # Many point to Identity Providers like Facebook to prove their point. The problem is that
OAuth 2.0 is a Delegated Authorization protocol, and not a Authentication protocol. This is generally
a four party model User, Website, Authorization server, and Protected resource.

Question # 68 What is the difference between LDAP and Active Directory?

Answer # LDAP (Lightweight Directory Access Protocol) is an application protocol for querying and
modifying items in directory service providers like Active Directory, which supports a form of
LDAP. Short answer: AD is a directory services database, and LDAP is one of the protocols you can
use to talk to it.

Question # 69 Why we use DBMS for projects ? Why don’t we save any application data in separate
files instead of DBMS?

Answer # Normalization of the data is the main advantage of using DBMS instead of saving data in
seperate files.

Question # 70 What is the differences between a Primary key and a Unique key in SQL server?

Answer # Primary Key is used to identify a row (record) in a table, whereas Unique-key is to prevent
duplicate values in a column (with the exception of a null entry). By default SQL-engine creates
Clustered Index on primary-key if not exists and Non-Clustered Index on Unique-key.

ASP.NET Real Time Interview Questions


And Answers
Question # 71 What are the differences between primary foreign and unique keys?

Answer # A primary key is a column or a set of columns that uniquely identify a row in a table. A
primary key should be short, stable and simple.

A foreign key is a field (or collection of fields) in a table whose value is required to match the value
of the primary key for a second table. A table can have multiple foreign keys.

Question # 72 What is the difference between a candidate key and primary key?

Answer # Candidate Key – A Candidate Key can be any column or a combination of columns that
can qualify as unique key in database. There can be multiple Candidate Keys in one table. Each
Candidate Key can qualify as Primary Key.

Primary Key – A Primary Key is a column or a combination of columns that uniquely identify a
record.

Question # 73 Can the unique key be null?

Answer # One row in the database is allowed to have null for the value of the unique key constraint.

Question # 74 Can I have a unique key as foreign key?


A FOREIGN KEY constraint does not have to be linked only to a PRIMARY KEY constraint in
another table; it can also be defined to reference the columns of a UNIQUE constraint in another
table. So in your case if you make AnotherID unique, it will be allowed.

Question # 75 How may clustered index we can create in table?

Answer # Generally we can create only one clustered index in a table, but if required there is a way
to create more clustered index in a table.

Question # 76 What is the difference between clustered and nonclustered index?

Answer # A clustered index actually describes the order in which records are physically stored on
the disk, hence the reason you can only have one. A Non-Clustered Index defines a logical order
that does not match the physical order on disk.

Question # 77 What is distributed system in ASP.NET?

Answer # A distributed system is a network that consists of autonomous computers that are
connected using a distribution middleware. They help in sharing different resources and capabilities
to provide users with a single and integrated coherent network.
Question # 78 What is Web API and why to use it?

Answer # Asp.Net Web API is a framework for building HTTP services that can be consumed by a
broad range of clients including browsers, mobiles, iphone and tablets. … It is a part of the core
ASP.NET platform and can be used with MVC and other types of Web applications like Asp.Net
WebForms.

Question # 79 What is difference between Web API and Web services?

Answer # Web Services are based on the SOAP protocol. Web API is a newer Microsoft framework
which helps you to build REST based interfaces. The response can be either JSON or XML, but there
is no way to generate clients automatically because Web Api does not offer a service description like
the WSDL from Web Services.

Question # 80 What is Web API vs WCF?

Answer # While WCF is a unified framework for building service oriented applications, Web API is
a light weight alternative to build RESTful services that can be consumed by many different clients.
RESTful services use basic HTTP and are simple with much less payload compared to SOAP
services.

Question # 81 What is difference between REST and SOAP?

Answer # Web services are of two kinds: Simple Object Access Protocol (SOAP) and
Representational State Transfer (REST). SOAP defines a standard communication protocol (set of
rules) specification for XML-based message exchange. SOAP uses different transport protocols, such
as HTTP and SMTP.

Question # 82 Why Web API is better than WCF?


Answer # Since WCF is SOAP based, which uses standard XML schema over HTTP, it could lead to
slower performance. WEB API is a better choice for simpler, light weight services. WEB API can
use any text format including XML and is faster than WCF. WEB API can be used to create full-
blown REST Services.

Question # 83 What is the difference between rest and restful?

Answer # Representational state transfer (REST) is a style of software architecture. As described in a


dissertation by Roy Fielding, REST is an “architectural style” that basically exploits the existing
technology and protocols of the Web. RESTful is typically used to refer to web services
implementing such an architecture.

ASP.NET Interview Questions and


Answers for 4 Years Experience
Question # 84 What is the difference between a process and a thread?

Answer # Threads are used for small tasks, whereas processesare used for more ‘heavyweight’ tasks
– basically the execution of applications. Another difference betweena thread and a process is
that threads within the same process share the same address space, whereas different processes do
not.

Question # 85 What is the difference between exe and dll?

Answer # Difference between exe and dll–

1.EXE is an extension used for executable files while DLL is the extension for a dynamic link
library.

2.An EXE file can be run independently while a DLL is used by other applications.

3.An EXE file defines an entry point while a DLL does not.

Question # 86 Is a DLL file an executable?

Answer # EXE file is a executable file which runs in a separate process which is managed by OS.
DLLs are not directly executable . They are separate files containing functions that can be called by
programs and other DLLs to perform computations and functions. DLL: They can be reused for some
other application.

Question # 87 What is the GAC?

Answer # The Global Assembly Cache (GAC) is a folder in Windows directory to store the .NET
assemblies that are specifically designated to be shared by all applications executed on a system.

Question # 88 What is strong-typing versus weak-typing? Which is preferred?

Answer #
Strong typing: It checks the type of variables as soon as possible, usually at compile time. It
prevents mixing operations between mismatched types.
Weak Typing: While weak typing is delaying checking the types of the system as late as possible,
usually to run-time. In this you can mix types without an explicit conversion.
A “weak-typed” programming language is simply one which is not strong-typed.

which is preferred depeneds on what you want. for scripts and good stuff you will usually want
weak typing, because you want to write as much less code as possible. in big programs, strong typing
can reduce errors at compile time.

Question # 89 What is the difference between equals() and == in c#?

Answer # The only difference between Equal and == is on object type comparison. in other cases,
such as reference types and value types, they are almost the same(either both are bit-wise equality or
both are reference equality). The == operator can be used to compare two variables of any kind, and
it simply compares the bits.

Question # 90 What is boxing and unboxing in asp.net?

Answer # 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 CLR boxes a value type, it wraps the value inside a
System.Object and stores it on the managed heap. Unboxing extracts the value type from the object.

ASP.NET MVC Interview Questions For


Experienced
Question # 91 What is Reflection?

Answer # With reflection we can dynamically create an instance of a type, bind the type to an
existing object, or get the type from an existing object and invoke its methods or access its fields and
properties. We can also access attribute information using reflection.

Question # 92 What is full trust in ASP.NET?

Answer # Full trust is the default, allows ASP.NET applications to execute native code, to read from
the Registry and Windows Event Log, and to read and write to files outside of the application’s
virtual directory. In short, with full trust one web application could delete the entire contents of
another web application.

Question # 93 What is the difference between debug and release?

Answer # The biggest difference between these is that: In a debug build the complete
symbolic debug information is emitted to help while debugging applications and also the code
optimization is not taken into account. While in release build the symbolic debug info is not emitted
and the code execution is optimized.
ASP.NET Interview Questions And
Answers For 5+ Years Experience
Question # 94 What is the purpose of XML Namespaces?

Answers # XML namespace. XML namespaces are used for providing uniquely named elements
and attributes in an XML document. They are defined in a W3C recommendation. An XML instance
may contain element or attribute names from more than one XML vocabulary.

Question # 95 What is the difference between typeof() vs GetType()?

Answers # typeOf is a C# keyword that is used when you have the name of the class. It is calculated
at compile time and thus cannot be used on an instance, which is created at runtime. GetType is a
method of the object class that can be used on an instance.

Question # 96 Why would anyone need to implement their own hashtable or linked list?

Answers # I’m not implying that the Dictionary class is inferior or that people should roll their own
hashtable. This is a basic question which tests whether a person has a minimal understanding of
datastructures. Thats what these questions test for: bare minimum understanding.
Question # 97 what is XSS?

Answer # Cross-site Scripting (XSS) refers to client-side code injection attack wherein an attacker
can execute malicious scripts (also commonly referred to as a malicious payload) into a legitimate
website or web application.
Question # 98 What is X XSS protection?

Answer # The HTTP X–XSS–Protection response header is a feature of Internet Explorer,


Chrome and Safari that stops pages from loading when they detect reflected cross-site
scripting (XSS) attacks.
Question # 99 What is data cache in SQL Server?
Answer # An SQL Server buffer pool, also called an SQL Server buffer cache, is a place in
system memory that is used for caching table and index data pages as they are modified or read
from disk.
Question # 100 How do you implement SQL caching in ASP.NET?
Answer # ASP.NET allows us to use the SqlCacheDependency class to create a cache item
dependency on a table in a database. It has the ability to automatically invalidate a cached data
object when the related data is modified in the database. This feature is supported in
from SQL Server 2005+ versions

Você também pode gostar