.net Interview Questions for freshers [Set-2]

Updated on     Kisan Patel

.net interview questions and answers with explanation for interview, placement test, online test, competitive examination and entrance test.

1. What are the advantages of the code-behind feature?

  1. Makes code easy to understand and debug by separating application logic from HTML tags
  2. Provides the isolation of effort between graphic designers and software engineers
  3. Removes the problems of browser incompatibility by providing code files to exist on the Web server and supporting Web pages to be compiled on demand.

2. Define a multilingual Web site.
A multilingual Web site serves content in a number of languages. It contains multiple copies for its content and other resources, such as date and time, in different languages.

3. What is IIS? Why is it used?
Internet Information Services (IIS) is created by Microsoft to provide Internet-based services to ASP.NET Web applications. It makes your computer to work as a Web server and provides the functionality to develop and deploy Web applications on the server. IIS handles the request and response cycle on the Web server. It also offers the services of SMTP and FrontPage server extensions. The SMTP is used to send emails and use FrontPage server extensions to get the dynamic features of IIS, such as form handler.

4. How can you register a custom server control to a Web page?
You can register a custom server control to a Web page using the @Register directive.

5. Which ASP.NET objects encapsulate the state of the client and the browser?
The Session object encapsulates the state of the client and browser.

6. Differentiate globalization and localization.
The globalization is a technique to identify the specific part of a Web application that is different for different languages and make separate that portion from the core of the Web application. The localization is a procedure of configuring a Web application to be supported for a specific language or locale.

7. What is ViewState?
The ViewState is a feature used by ASP.NET Web page to store the value of a page and its controls just before posting the page. Once the page is posted, the first task by the page processing is to restore the ViewState to get the values of the controls.

8. Which method is used to force all the validation controls to run?
The Page.Validate() method is used to force all the validation controls to run and to perform validation.

9. What does the Orientation property do in a Menu control?
Orientation property of the Menu control sets the horizontal or vertical display of a menu on a Web page. By default, the orientation is vertical.

10. Differentiate between client-side and server-side validations in Web pages.
Client-side validations take place at the client end with the help of JavaScript and VBScript before the Web page is sent to the server. On the other hand, server-side validations take place at the server end.

11. What is garbage collection?
Garbage collection is a heap-management strategy where a run-time component takes responsibility for managing the lifetime of the memory used by objects. This concept is not new to .NET – Java and many other languages/runtimes have used garbage collection for some time.

12. What is serialization?
Serialization is the process of converting an object into a stream of bytes.Deserialization is the opposite process, i.e. creating an object from a stream of bytes. Serialization/Deserialization is mostly used to transport objects (e.g. during remoting), or to persist objects (e.g. to a file or database).

13. Where do you add an event handler?
It’s the Attributesproperty, the Add function inside that property.

e.g.

btnSubmit.Attributes.Add("onMouseOver","someClientCode();");

14. What do you mean by authentication and authorization?
Authentication is the process of validating a user on the credentials(username and password) and authorization performs after authentication. After Authentication a user will be verified for performing the various tasks, It access is limited it is known as authorization.

15. What is portable executable (PE) ?
The file format used for executable programs and for files to be linked together to form executable programs

16. Differences between DLL and EXE?
.exe

  • These are outbound file.
  • Only one .exe file exists per application.
  • .Exe cannot be shared with other applications.

.dll

  • These are inbound file .
  • Many .dll files may exists in one application.
  • .dll can be shared with other applications.

17. What is shadowing?
Shadowing is either through scope or through inheritance. Shadowing through inheritance is hiding a method of a base class and providing a new implementation for the same. This is the default when a derived class writes an implementation of a method of base class which is not declared as overridden in the base class. This also serves the purpose of protecting an implementation of a new method against subsequent addition of a method with the same name in the base class.’shadows’ keyword is recommended although not necessary since it is the default.

18. What is Method Overriding? How to override a function in C#?
An override method provides a new implementation of a member inherited from a base class. The method overridden by an override declaration is known as the overridden base method. The overridden base method must have the same signature as the override method.
Use the override modifier to modify a method, a property, an indexer, or an event. You cannot override a non-virtual or static method. The overridden base method must be virtual, abstract, or override.

19. Differences between DataSet.Clone and DataSet.Copy?

Clone – Copies the structure of the DataSet, including all DataTable schemas, relations, and constraints. Does not copy any data.

Copy – Copies both the structure and data for this DataSet.

20. What is the managed and unmanaged code in .net?
The .NET Framework provides a run-time environment called the Common Language Runtime, which manages the execution of code and provides services that make the development process easier. Compilers and tools expose the runtime’s functionality and enable you to write code that benefits from this managed execution environment. Code that you develop with a language compiler that targets the runtime is called managed code; it benefits from features such as cross-language integration, cross-language exception handling, enhanced security, versioning and deployment support, a simplified model for component interaction, and debugging and profiling services.

21. Whats an assembly?
Assemblies are the building blocks of .NET Framework applications; they form the fundamental unit of deployment, version control, reuse, activation scoping, and security permissions. An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality. An assembly provides the common language runtime with the information it needs to be aware of type implementations. To the runtime, a type does not exist outside the context of an assembly.

22. How do you create a permanent cookie?
Setting the Expires property to MinValue means that the Cookie never expires.

23. What’s a Windows process in .NET?
Windows process is an application that’s running and had been allocated memory in .NET

24. What is Delegation in .NET?
A delegate acts like a strongly type function pointer. Delegates can invoke the methods that they reference without making explicit calls to those methods.

Delegate is an entity that is entrusted with the task of representation, assign or passing on information. In code sense, it means a Delegate is entrusted with a Method to report information back to it when a certain task (which the Method expects) is accomplished outside the Method’s class.

25. What is Serialization in .NET?
The serialization is the process of converting the objects into stream of bytes.
they or used for transport the objects(via remoting) and persist objects(via files and databases)

26. Difference between Class And Interface in .NET?

  • Class is logical representation of object. It is collection of data and related sub procedures with definition.
  • Interface is also a class containing methods which is not having any definitions.
  • Class does not support multiple inheritance. But interface can support

27. Can any object be stored in a Viewstate in .NET?
An object that either is serializable or has a TypeConverter defined for it can be persisted in ViewState.

28 What is the use of ErrorProvider Control in .NET?
The ErrorProvider control is used to indicate invalid data on a data entry form. Using this control, you can attach error messages that display next to the control when the data is invalid, as seen in the following image. A red circle with an exclamation point blinks, and when the user mouses over the icon, the error message is displayed as a tooltip.

29. How do you validate the controls in an ASP .NET page?
Using special validation controls that are meant for validation of any control.

We have Range Validator, Email Validator in .NET to validate any control.

30. How to manage pagination in a page using .NET?
Using pagination option in DataGrid control is available in .NET. We have to set the number of records for a page, then it takes care of pagination by itself automatically.


ASP.NET C# Interview

Leave a Reply