laravel interview questions LEARNOVITA

40+ [REAL-TIME] Dot Net Framework Interview Questions and Answers

Last updated on 08th Dec 2022, Blog, Interview Question

About author

Sanjay (Sr Big Data DevOps Engineer )

Highly Expertise in Respective Industry Domain with 7+ Years of Experience Also, He is a Technical Blog Writer for Past 4 Years to Renders A Kind Of Informative Knowledge for JOB Seeker

(5.0) | 13265 Ratings 1709

1. What is .NET?

Ans:

.NET is the framework for a software development. It is just like the other software development frameworks like (J2EE). It provides a runtime capabilities and a rich set of pre-built functionality in form of a class libraries and APIs. This .NET framework is the environment to build, deploy and run a web services and other applications.

The .NET framework contains a three main parts:

  • Common Language Runtime
  • Framework classes
  • ASP.NET

2. How many languages are supported by a .NET at present time?

Ans:

When .NET was introduced a first time, it supports more languages like VB.NET,C#,COBOL, and Perl etc. At present time it supports the almost 44 languages.

3. How is it possible for .NET to the support many languages?

Ans:

The .NET language code is compiled to a Microsoft Intermediate Language (MSIL). The generated code is called the managed code. This managed code is to be run in .NET environment. So after compilation language is not a barrier and the code can call or use a functions of another language also.

4. Is ASP.NET different from the ASP? If yes, explain how?

Ans:

Yes, ASP.NET is different from a ASP. These are main differences:

  • ASP.NET is developed by a Microsoft to create dynamic web applications while an ASP (Active Server Pages) is Microsoft’s server side technology used to create a web pages.
  • ASP.NET is to be compiled while ASP is interpreted.
  • ASP uses a technology named ADO while a ASP.NET uses ADO.NET.
  • ASP.NET is completely object oriented while an ASP is partially object oriented.

5. What is state management in a ASP.NET?

Ans:

State management is the technique that is used to manage a state of object on various requests. It is more important to manage state in any web application. There are two types of a state management systems in an ASP.NET.

  • Client side state management.
  • Server side state management.

6. What is difference between the trace and debug?

Ans:

Debug class is used to debug the builds while Trace is used for the both debug and release builds.

7. What are differences between the system.stringbuilder and system.string?

Ans:

The main differences between the system.stringbuilder and system.string are:

  • system.stringbuilder is the mutable while system.string is be immutable.
  • Append keyword is used in a system.stringbuilder but not in a system.string.

8. What is difference between the int and int32?

Ans:

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

9. What is difference between the namespace and assembly?

Ans:

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

10. Explain differences between the value type and reference type.

Ans:

  • Value type contains the variables while reference type doesn’t contain a value directly in its memory.
  • In a reference type, memory is allocated in a managed heap and in value type of memory allocated in stack.
  • Reference type ex-class value be type-struct, enumeration.

11. What is difference between the session object and application object?

Ans:

The session object is used to keep the session of every user.

For example: If a user enters into application then he will get the session id. If he leaves from a application then the session id is deleted. If he again enters into application, he will get a various session id.

12. What are differences between the function and stored procedure in .Net programming language?

Ans:

  • Function returns the only one value but procedure can return a one or more than one value.
  • Function can be used in select a statements but procedure cannot be used.
  • Function has only a input parameters while Procedure can have input and output parameters.
  • Exceptions can be handled by a try-catch blocks in procedures but that is not possible in a function.

13. How to retrieve user name in case of a Window Authentication?

Ans:

System.Environment.UserName

14. What is difference between Hash table and Array list?

Ans:

  • Hash table saves data in a form of value pair and name while an Array list stores only values.
  • Need to pass a name to access the value from the Hash table while in a Array need to pass index number to the access value.
  • In Array, can store only similar data types while in the Hash table you can store various types of data types. ex. int, string etc.

15. What is meaning of an Immutable?

Ans:

Immutable means once create a thing, and cannot modify it.

For example: If want to give a new value to old value then it will discard a old value and create new instance in memory to hold new value.

16. What are advantages of using a session?

Ans:

  • A session stores a user states and data to all over an application.
  • It is very simple to implement and can save any kind of object.
  • It can save every user data separately.
  • Session is secure and transparent from user because session object is stored on a server.

17. What are disadvantages of using a session?

Ans:

  • Performance overhead occurs in case of large number of the users, because session data is stored in a server memory.
  • Overhead involved in the serializing and De-Serializing session Data. Because In case of a StateServer and SQLServer session mode need to serialize object before store.

18. What is a Manifest?

Ans:

Assembly metadata is a stored in Manifest. Manifest contains all metadata needed to do following things.

  • Version of assembly.
  • Security identity.
  • Scope of the assembly.
  • Resolve references to resources and classes.

19. Explain boxing and unboxing concept in .Net?

Ans:

Boxing: Boxing is the process of converting value type into the reference type.

Unboxing: Unboxing is the process of converting the reference type to value type.

20. Is it possible to change a index of the primary key on a table?

Ans:

No.

21. What is the HTTPhandler?

Ans:

HttpHandler is the low level request and response API which is made to service incoming a Http requests. Each incoming Http request received by ASP.NET is ultimately processed by the instance of a class that implements a HttpHandler.

22. What are main components of a .NET Framework?

Ans:

  • Class library.
  • Common Language Runtime (CLR).
  • Dynamic Language Runtime (DLR).
  • Application Domains.
  • Runtime Hosts.
  • Cross-language interoperability.
  • Framework security.
  • Profiling etc.

23. What is the manifest in .NET Framework?

Ans:

Manifest is used to save a assembly metadata. It contains all metadata which are necessary for the following things.

  • Version of an assembly.
  • Security identity.
  • Scope of the assembly.
  • To resolve the references to resources and classes.

24. What are memory-mapped files?

Ans:

Memory-mapped files are used to map a content of a file to logical address of an application. It makes it possible to run a multiple processes on a same machine to share data with each other. To obtain the memory mapped file object, and can use the method MemoryMappedFile.CreateFromFiles( ). It represents persistent memory-mapped file from file on disk.

25. Which method is used to enforce a garbage collection in .NET?

Ans:

System.GC.Collect() method.

26. What is difference between the dispose() and finalize()?

Ans:

Although a Dispose and Finalize both methods are used by a CLR to perform garbage collection of a runtime objects of .NET applications but there is the difference between them.

The Finalize method is called an automatically by the runtime while Dispose method is called by a programmer.

27. Explain Code Access Security (CAS) in .NET framework.

Ans:

.NET security model is used to prevent the unauthorized access of a resources and operations and also restrict codes to perform a particular tasks. Code Access Security is the part of that .NET security.

28. What is the Garbage collection?

Ans:

Garbage collection is used to prevent a memory leaks during execution of the programs. There is a low-priority process name as a garbage collector manages allocation and deallocation of memory for the applications. It also checks for a unreferenced variables and objects. If there is any object which is no further used by the application the Garbage collector frees up a memory from that object.

29. How can identify that page is posted back?

Ans:

There is the property, named as “IsPostBack” property. And can check it to know that page is post backed or not.

30. What is the variable and constant in .NET programming language?

Ans:

Variable: A variable is the data storage location in a computer memory that contains a value and has meaningful name. Each variable is attached to the data type which determines what type of a value can be stored in a variable.

Variables can be declared by using a following syntax:

  • <"data_type><"variable_name>;

Constant: Constant is similar to a variable except that value. Value once assigned to the constant can’t be changed. Constants must be initialized at a same time they are declared.

Constants can be declared by using a following syntax:

  • const int interestRate =10;

31. If want to replace a multiple if-else statements in code, which statement will use?

Ans:

In a Visual basic, can use a Select-Case statements to replace the multiple If-Else statements. In C#, and should use a Switch-Case statements to replace multiple If-Else statements.

32. What are different types of indexes in .Net?

Ans:

There are the two types of indexes in .Net: Clustered index and a non-clustered index.

33. How many types of the memories are there in .Net?

Ans:

  • Stack memory
  • Heap Memory

34. Which are new features added in .NET framework 4.0?

Ans:

  • Improved Application of Compatibility and Deployment Support.
  • A Dynamic Language Runtime.
  • A Managed Extensibility Framework.
  • A Parallel Programming framework.
  • An Improved Security Model.
  • A Networking Improvements.
  • Improved Core ASP.NET Services.
  • Improvements in WPF 4.
  • Improved Entity Framework (EF).
  • Integration between a WCF and WF.

35. What are the cookies?

Ans:

A cookie is the small amount of data created by a server on a client. When web server creates a cookie, additional HTTP header is sent to a browser when a page is served to a browser.

36. What are disadvantages of cookies?

Ans:

  • Cookies can save only string values.
  • Cookies are the browser dependent.
  • Cookies are not be secure.
  • Cookies can save only a small amount of data.

37. What is IL?

Ans:

  • IL stands for an Intermediate Language. It is also known as a MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language).
  • All .NET source codes are first compiled to the IL. Then, IL is converted toa machine code at the point where a software is installed, or at run-time by Just-In-Time (JIT) compiler.

38. Which method is used to enforce a garbage collection in .NET?

Ans:

System.GC.Collect() method is used to enforce a garbage collection in .Net.

39. What are the tuples in .Net?

Ans:

A tuple is a fixed-size collection that can have elements of either same or various data types. The user must have to specify the size of a tuple at a time of declaration just like arrays.

40. How many elements of tuple can hold?

Ans:

Tuple can hold up a from 1 to 8 elements. In case of more thana 8 elements, then 8th element can be explained as another tuple. Tuples can be specified as a parameters or return type of method.

41. Which architecture does the Dataset follow?

Ans:

A Dataset follows a disconnected data architecture.

42. How do check whether a DataReader is closed or opened?

Ans:

There is a property named “IsClosed” property is used to check a whether DataReader is closed or opened. This property returns the true value if a Data Reader is closed, otherwise a false value is be returned.

43. What are basic requirements for a connection pooling?

Ans:

  • There must be a multiple processes to share a same connection describing a same parameters and security settings.
  • The connection string must be an identical.

44. Which adapter should be used to get a data from an Access database?

Ans:

OleDbDataAdapter is used to get a data from Access database.

45. What are parameters that control most of connection pooling behaviors?

Ans:

  • Connect Timeout
  • Max Pool Size
  • Min Pool Size
  • Pooling

46. What is mean by a AutoPostBack?

Ans:

AutoPostBack is the property which is used to postback automatically when an event is be raised. And have to set a AutoPostBack property of the control to True.

47. Which properties are used to bind the DataGridView control?

Ans:

The DataSource property and a DataMember property are used to bind DataGridView control.

48. What is a ASP.Net?

Ans:

It is the framework developed by a Microsoft on which we can develop a new generation web sites using web forms(aspx), MVC, HTML, Javascript, CSS etc. It is a successor of Microsoft Active Server Pages(ASP). Currently there is an ASP.NET 4.0, which is used to develop a web sites. There are different page extensions provided by a Microsoft that are being used for website development. Eg: aspx, asmx, ascx, ashx, cs, vb, html, XML etc.

49. What’s the use of a Response.Output.Write()?

Ans:

Can write a formatted output using a Response.Output.Write().

50. In which event of page cycle is a ViewState available?

Ans:

After an Init() and before the Page_Load().

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

Ans:

In a Server.Transfer : Page processing transfers from the one page to other page without making round-trip back to a client’s browser. This provides a faster response with the little less overhead on a server. The clients url history list or current url Server does not update in case of a Server.Transfer.

Response.Redirect : Is used to redirect a user’s browser to the another page or site. It performs the trip back to the client where a client’s browser is redirected to a new page. The user’s browser history list is updated to the reflect a new address.

52. From which base class all the Web Forms are inherited?

Ans:

Page class.

53. What are different validators in an ASP.NET?

Ans:

  • A Required field Validator.
  • A Range Validator.
  • A Compare Validator.
  • Custom Validator.
  • Regular expression Validator.
  • Summary Validator.

54. Which validator control use if need to make sure the values in a two different controls match?

Ans:

Compare the Validator control.

55. What is a ViewState?

Ans:

ViewState is used to retain a state of server-side objects between the page post backs.

56. Where viewstate is stored after page postback?

Ans:

ViewState is stored in the hidden field on the page at a client side. ViewState is transported to a client and back to a server, and is not stored on server or any other external source.

57. How long the items in a ViewState exist?

Ans:

They exist for a life of current page.

58. What are different Session state management options available in a ASP.NET?

Ans:

  • In-Process.
  • Out-of-Process.

In-Process: Stores a session in memory on a web server.

Out-of-Process: Session state management stores data in the external server. The external server may be either SQL Server or a State Server. All objects stored in a session are required to be a serializable for Out-of-Process state management.

59. How can add an event handler?

Ans:

Using a Attributes property of a server side control.

  • btnSubmit.Attributes.Add(“onMouseOver”,”JavascriptCode();”)

60. What is a caching?

Ans:

Caching is the technique used to increase a performance by keeping frequently accessed a data or files in memory. The request for cached file/data will be accessed from a cache instead of an actual location of that file.

61. What are different types of the caching?

Ans:

  • Output Caching,
  • Fragment Caching,
  • Data Caching.

62. What is IL?

Ans:

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

63. List an events in a page life cycle.

Ans:

  • Page_PreInit
  • Page_Init
  • Page_InitComplete
  • Page_PreLoad
  • Page_Load
  • Page_LoadComplete
  • Page_PreRender
  • Render

64.What is a managed extensibility framework?

Ans:

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

65. Is it possible to create web application with both the webforms and mvc?

Ans:

Yes. have to include a below mvc assembly references in a web forms application to create a hybrid applications.

66. Can add a code files of different languages in a App_Code folder?

Ans:

No. The code files must be in a same language to be kept in a App_code folder.

67. What is the Protected Configuration?

Ans:

It is the feature used to secure a connection string information.

68. Write code to send an email from an ASP.NET application?

Ans:

  • MailMessage mailMess = new MailMessage ();
  • mailMess.From = “abc@gmail.com
  • “;
  • mailMess.To = “xyz@gmail.com”;
  • mailMess.Subject = “Test email”;
  • ailMess.Body = “Hi This is a test mail.”;
  • SmtpMail.SmtpServer = “localhost”;
  • mtpMail.Send (mailMess);
  • MailMessage and SmtpMail are classes explained System.Web.Mail namespace.

69. How can prevent browsers from a caching an ASPX page?

Ans:

Can SetNoStore on HttpCachePolicy object exposed by a Response object’s Cache property:

\
  • Response.Cache.SetNoStore ();
  • Response.Write (DateTime.Now.ToLongTimeString ());

70. What is good practice to implement validations in a aspx page?

Ans:

Client-side validation is a best way to validate data of the web page. It reduces a network traffic and saves server resources.

71. What are event handlers that can have in a Global.asax file?

Ans:

A Session Events: Session_Start,Session_End

72. Which protocol is used to call the Web service?

Ans:

HTTP Protocol

73. Can have multiple a web config files for an asp.net application?

Ans:

Yes.

74. What is difference between the web config and machine config?

Ans:

Web config file is a specific to the a web application whereas machine config is specific to the machine or server. There can be a multiple web config files into application where as can have only one machine config file on the server.

75. What are the code contracts?

Ans:

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

76. What is the Cross Page Posting?

Ans:

When click a submit button on web page, the page posts the data to a same page. The technique in which post a data to various pages is called Cross Page posting. This can be achieved by setting a POSTBACKURL property of button that causes a postback. Findcontrol method of PreviousPage can be used to get a posted values on a page to which the page has been posted.

77. How can apply Themes to asp.net application?

Ans:

  • <"configuration>
  • <"system.web>
  • <"pages theme=”Windows7″ />

78. What isa RedirectPermanent in ASP.Net?

Ans:

RedirectPermanent Performs the permanent redirection from a requested URL to the specified URL. Once a redirection is done, it also returns 301 Moved a Permanently responses.

79. What is a MVC?

Ans:

MVC is a framework used to create a web applications. The web application base builds on a Model-View-Controller pattern which separates a application logic from UI, and an input and events from a user will be controlled by a Controller.

80. Explain working of a passport authentication.

Ans:

First of all it checks a passport authentication cookie. If cookie is not available then an application redirects a user to Passport Sign on page. Passport service authenticates a user details on sign on a page and if valid then saves the authenticated cookie on a client machine and then redirect a user to requested page.

81. What are advantages of a Passport authentication?

Ans:

  • All websites can be accessed using a single login credentials. So no need to remember a login credentials for every web site.
  • Users can maintain his/ her information in the single location.

82. What are asp.net Security Controls?

Ans:

<"asp:Login">: Offers a standard login capability that allows users to enter their credentials.

<"asp:LoginName">: Allows to display a name of logged-in user.

<"asp:LoginStatus">: Displays whether a user is authenticated or not.

<"asp:LoginView">: Provides different login views depending on a selected template.

<"asp:PasswordRecovery">: Email users their lost password.

83. How do register a JavaScript for webcontrols ?

Ans:

Can register a javascript for controls using a <"CONTROL -name">Attributes.Add(scriptname,scripttext) method.

84. In which event are controls fully loaded?

Ans:

  • A Page load event.
  • Unboxing is a reverse of boxing ie. Assigning reference type variable to the value type variable.

85. What is a code access security (CAS)?

Ans:

Code access security (CAS) is part of .NET security model that prevents an unauthorized access of a resources and operations, and restricts the code to perform a particular tasks.

86. Differentiate the strong typing and weak typing

Ans:

In strong typing, a data types of variables are checked at a compile time. On a other hand, in case of a weak typing variable data types are checked at a runtime. In case of a strong typing, there is no chance of the compilation error. Scripts use a weak typing and hence problems arise at a runtime.

87. How can force all validation controls to run?

Ans:

The Page.Validate() method is used to force all validation controls to run and to perform a validation.

88. List all templates of a Repeater control.

Ans:

  • ItemTemplate.
  • AlternatingitemTemplate.
  • SeparatorTemplate.
  • HeaderTemplate.
  • FooterTemplate.

89. List major built-in objects in a ASP.NET?

Ans:

  • Application
  • Request
  • Response
  • Server
  • Session
  • Context
  • Trace

90. How does a CAS works?

Ans:

There are two key concepts of a CAS security policy- code groups and also permissions. A code group contains an assemblies in it in a manner that each .NET assembly is related to particular code group and some permissions are granted to be each code group.

91. Which data type does a RangeValidator control support?

Ans:

The data types supported by a RangeValidator control are Integer, Double, String, Currency, and Date.

92. What is difference between a HtmlInputCheckBox control and an HtmlInputRadioButton control?

Ans:

In a HtmlInputCheckBoxcontrol, multiple item selection is possible whereas in a HtmlInputRadioButton controls, and can select only a single item from a group of items.

93. Which namespaces are necessary to create the localized application?

Ans:

  • System.Globalization
  • System.Resources

94. What are different types of cookies in a ASP.NET?

Ans:

Session Cookie : Resides on a client machine for the single session until user does not log out.

Persistent Cookie : Resides on the user’s machine for a period specified for its expiry, like 10 days, one month, and never.

95. What is a file extension of web service?

Ans:

Web services have a file extension .asmx.

96. What are components of a ADO.NET?

Ans:

The components of a ADO.Net are Dataset, Data Reader, Data Adaptor, Command, connection.

97. What is difference between the ExecuteScalar and ExecuteNonQuery?

Ans:

ExecuteScalar returns an output value whereas a ExecuteNonQuery does not return any value but a number of rows affected by query. ExecuteScalar used for a fetching a single value and an ExecuteNonQuery used to execute Insert and Update statements.

98. Mention execution process for a managed code.

Ans:

  • Choosing language compiler.
  • Compiling a code to MSIL.
  • Compiling MSIL to a native code.
  • Executing a code.

99. What is a CTS?

Ans:

CTS stands for a Common Type System. It has a set of the rules which state how a data type should be declared, explained and used in the program. It explains the data types that are to be used in an application.

100. What is a CLR?

Ans:

CLR stands for a Common Language Runtime. It is one of most important components of a .Net framework. It provides a building blocks for many applications.

Are you looking training with Right Jobs?

Contact Us

Popular Courses