DotNet Interview Questions – Any developer

Everyone who writes code

  1. Describe the difference between a Thread and a Process?

Answer:

    1. Both are individual execution paths, but process timeslicing (and memory space) is enforced by the OS, while thread differentiation is enforced by applications.
    2. We can have multiple threads in a single process. Thus we can say threads are working units of a process.
    3. We can execute a process (EXE) but threads can be created and executed from inside a process
  1. What is a Windows Service and how does its lifecycle differ from a "standard" EXE?

Answer:

    1. Services are loaded by the operating system and run in contained process spaces detached from user interaction; users logging on and off the system have no impact on them.
    2. A service opens before you even get to the login screen, whereas a standard exe cannot open until after you have logged on.
    3. Windows Service applications are long-running applications that are ideal for use in server environments. The applications do not have a user interface or produce any visual output. Any user messages are typically written to the Windows Event Log. Services can be automatically started when the computer is booted. They do not require a logged in user in order to execute and can run under the context of any user including the system. Windows Services are controlled through the Service Control Manager where they can be stopped, paused, and started as needed.
    4. Windows service is a application that runs in the background. It is equivalent to a NT service.

The executable created is not a Windows application, and hence you can't just click and run it . it needs to be installed as a service, VB.Net has a facility where we can add an installer to our program and then use a utility to install the service. Where as this is not the case with standard exe.

  1. What is the maximum amount of memory any single process on Windows can address? Is this different than the maximum virtual memory for the system? How would this affect a system design?

Answer:

Windows processes are allowed 4GB of virtual address space, regardless of the actual amount of memory on the machine. Windows x64 allows 16TB of address space.

Actually processes access virtual memory space, not physical memory. Applications never access RAM directly but only through the memory management interface of the processor. All processes have a 4GB virtual address space. The upper 2GB is common to all processes and is used by the system. The lower 2GB is private to each process and is inaccessable to all others. This is completely independent of the size of RAM or the pagefile. The system maps physical memory into this virtual address space according to both need and availability. At any given time the data in virtual memory space might be stored in RAM, on disk, or both. All of this is totally transparent to all applications. Frequently accessed data will be kept in RAM with the remainder left on disk.

  1. What is the difference between an EXE and a DLL?

Answer:

EXEs can be launched as processes by the operating system. DLL executable code must be invoked by an existing process.

DLL

    1. Its a Dynamic Link Library.
    2. DLL is inprocess.
    3. There are many entry points.
    4. The system loads a DLL into the context of an existing thread.
    5. In one windows Application, if any problem in DLL, just that specific form or part only will not work.but if any problem in Exe, entire application will not work.
    6. dll is the reusable software component.

EXE

  1. Executable file.
  2. exe is outprocess.
  3. There is only single main entry.
  4. When a system launches new exe, a new process is created.
  5. The entry thread is called in context of main thread of that process.

An EXE can run independently, whereas DLL will run within an EXE. DLL is an in-process file and EXE is an out-process file.

  1. What is strong-typing versus weak-typing? Which is preferred? Why?

Answer:

Strong-typing refers to defining the specific type of a reference at compile time rather than at run time. This results in more efficient execution and memory optimizations at compile time, as well as reduces the chance of a programmer accidentally providing a value of a type another component wasn't expecting.

Strong type is checking the types of variables as soon as possible, usually at compile time. While weak typing is delaying checking the types of the system as late as possible, usually to run-time. Which is preferred depends on what you want. For scripts & quick stuff you’ll usually want weak typing, because you want to write as much less (is this a correct way to use Ensligh?) code as possible. In big programs, strong typing can reduce errors at compile time.

Strong type is checking the types of variables at compile time. weak typing is checking the types of the system at run-time. For scripts & quick stuff we’ll use weak typing, In big programs, strong typing can reduce errors at compile time.

  1. What is a PID? How is it useful when troubleshooting a system?

Answer:

(Ambiguous) This could refer to either a Microsoft Product ID -- the unique key that brands each activatable component installed on a system -- or to a Process ID, which is a means of referring to a specific process in calls to the Windows API.

PID stands for Process Identifier, a uniquely assigned integer that identifies a process in the operating system. In any system, applications use PID to identify the process uniquely. Also, it is used in diagnosing the problems with the process in Multi-Tasking systems.

PID is caleld process id, its used to usually track the resources that a process is using. In a case where a process is stuck and is using valuable resouces, it is killed based on the PID.

  1. How many processes can listen on a single TCP/IP port?

Answer: One

  1. What is the GAC? What problem does it solve?

Answer:

The Global Assembly Cache. It stores strongly-named assemblies in a single location, allowing for verification of code library uniqueness when executing.

Should I Build a Windows or a Web Application?

The choice of which to build—a Windows or a Web application—can be a difficult one if you don't understand the key factors that go into such a decision. With Microsoft .NET, understanding your client options is the key.

Contents:

Developing an Application for Internal Use
Developing an Application for Business Customers
Developing an Application for the Masses
Conclusion

Developing an Application for Internal Use

When developing applications for internal use in your company, you often have far different requirements than you do for external applications. Most companies have some form of desktop standardization to lower their Total Cost of Ownership (TCO). This means that they can control what software is running on the client. Windows-based applications, sometimes called Thick Client applications, often make more sense in an Intranet setting because they can offer a more robust Graphical User Interface (GUI) and better features that increase your employees' productivity. Simple things like keyboard shortcuts, client side caching, multi-threading, and advanced user interface controls can make all the difference in the usability of an application.

Until Microsoft .NET, deployment and updates of a client-side application has traditionally been more difficult, but several features in Microsoft .NET have taken some of the hassle out of managing Thick Client applications. Side by Side execution allows two versions of the same application to run at the same time in separate isolated spaces which makes self-updating applications easier to create. Meta-data has been moved into the application itself, eliminating the need to use the registry, and making installs easier. Microsoft .NET applications can be self-contained so that deployment can be done by merely copying a folder and running the application.

If your application can run with a more limited set of privileges on the client's desktop system, you may be able to take advantage of enhancements in IE 5.01 and above that allow an application to be hosted at a web server virtual directory and run right from a URL. As the application needs additional components, it will return to the same URL to try to download those components as well. Microsoft .NET's tight integration with the Microsoft Windows operating system gives it speed advantages over other client technologies, and allows it to access more features provided by the operating system to help jump start development of client applications that will run on the Microsoft Windows operating system.

The largest hurdles to creating Thick Client applications on the Microsoft .NET platform is the distribution of the Microsoft .NET Framework. This must be installed on client computers that will run your application, but on Microsoft Windows based networks, this setup can be easy to deploy through the use of Active Directory Group Policy. Be aware that developing thick client applications is very different from developing web based applications, and that users have different expectations of them. It is often harder to develop quality user interfaces for a Windowed client versus a Web client, but the results can be much more satisfying for the users and can increase their productivity as well.

Developing an Application for Business Customers

When developing applications for business customers, you may or may not have control over what is run as the client, so this will contribute largely to your decision over whether to develop a Thick Client or a Web application. To develop a Thick Client application using Microsoft .NET, you will have to able to dictate that your customer's run some flavor of the Windows operating system, and they will have to install Microsoft .NET as well. For most companies this will not be a huge requirement, but others might not want to add the Microsoft .NET framework to their infrastructure support.

In the past, Firewall issues would have been a problem for client side applications, but Microsoft's strong support of XML Web Services gives client applications the ability to access data in a manner similar to a user browsing the Internet, so that Firewalls are no longer the problem for client applications that they once were.

If these client side restrictions are not realistic for your customers, you may be able to develop a Web application with enhanced client side features if you can dictate that they must be running one of the more modern web browsers, such as Microsoft Internet Explorer 5.01 and above, Netscape 6 and above, or Mozilla. Web applications that ensure a better client browser can offer better features using client side Javascript, but they can still fall short of the features that you can offer in a Thick Client application. If you cannot even dictate the client side browser selection, you will have to code your application for plain HTML to be most universally compliant. This can get the job done, but it means more traffic to the web server and a less than ideal user experience.

Developing an Application for the Masses

If you are targeting your application to the general public, a web application is really the best choice. The proliferation of the web browser has ensured that nearly all of your potential users will have access to a web browser and can run your application. Now you have to decide what level of features you would like in your application and what limits you want to put on your clients.

You can create web applications with more advanced features if you target your application to one of the more advanced web browser like Internet Explorer, Netscape, or Mozilla, but you then must ensure that your clients have one of these. You could target a broader audience by making your web application use more compliant HTML, or you could choose to support multiple versions to give some customers enhanced features and others broader access.

Supporting multiple versions can ensure the best user experience for the most people, but it will increase your development and maintenance costs as well.

Conclusion

There is no single right answer when choosing Windows versus Web, but many contributing factors might lead you to one solution or another. Windows applications have the best user interface and features, but they are available to the smallest audience, while Web applications have the most limited user interface features, but they are available to the broadest audience.

Use some of these determining factors to help select the right platform for you application, but keep in mind that a small application has a tendency to grow into a large application as more people discover its usefulness so keep growth factors in mind as well.

Dot Net Interview Questions - AXA

  1. What is the difference between Delete and Truncate in SQL.
  2. You have an SQL table and you have an XML file having same schema. How to display the data from SQL database and XML file together to the user?
  3. You have an SQL table ‘Employee’ having fields ‘Employee Number’ and ‘Employee Name’ and an XML file having ‘Phone Number’ and ‘Employee City’. How you will show data to a user having ‘Employee Number’, ‘Employee Name’, ‘Phone Number’ and ‘Employee City’ to the user.
  4. What is the difference between Clustered and Non-clustered index?
  5. What you use to have user defined event to fire before any of the application events? Options available are a) Global.asax b) HttpHandler c) HttpModule d) None of these.
  6. Write a query to select table without index. ‘Select * from table with (index=0)’
  7. How you will filter a dataset?
  8. How you will sort a dataset?
  9. What is done to remove dll hell?
  10. Which authentication is preferred for an application in internet?
  11. What are diffgrams?
  12. what is ‘yield’ in C#?
  13. What are nullable type?