.NET
Framework Interview Questions
1. What are the collection classes?
The .NET
Framework provides specialized classes for data storage and retrieval.
list the object-oriented concepts
Inheritance
Abstraction
Polymorphism
Encapsulation
Abstraction
Polymorphism
Encapsulation
2. What is difference between interface inhertance and
class inheritance?
If its a
interface inheritance and the inheritad class is not a abstact class or a interface
class then all the methods in the supper class needs to be implemented.
Class inheritance no need such thing.
Class inheritance no need such thing.
3. What are Abstract base classes?
Abstact Class
is nothing but a true virtual class..
This class cannot be instantiated instead it has to be inherited.
The method in abstract class are virtual and hence they can be overriden in the child class.
This class cannot be instantiated instead it has to be inherited.
The method in abstract class are virtual and hence they can be overriden in the child class.
4. When is web.config called?
Web.config is
an xml configuration file. It is never directly called unless we need to
retrieve a configurations setting.
5. What does connection string consist of?
Server, user
id, password, database name.
6. What is a runtime host?
The runtime
host is the environment in which the CLR is started and managed.
7. What inheritance does VB.NET support?
Single
inheritance using classes or multiple inheritance using interfaces.
8. Differences
between application and session ?
The application
level variable hold value at the application level and their instances are
destroyed when the no more client access that application, whereas session
correspond to a individual user accessing the application.
9. What is web application virtual directory?
Virtual
directory is the physical location of the application on the machine.
By default it’s - inetpub/wwwroot
By default it’s - inetpub/wwwroot
10. If cookies is disabled in client browser, will
session tracking work?
No, maintaining
value in cookie wont be possible. In that case you have to make use of other
ways to maintain state of the data on page.
you can check whether client support cookies or not by using
Request.Browser.Cookies property.
you can check whether client support cookies or not by using
Request.Browser.Cookies property.
11. What is a Process, Session and Cookie?
Process -
Instance of the application
Session - Instance of the user accessing the application
Cookie - Used for storing small amount of data on client machine.
Session - Instance of the user accessing the application
Cookie - Used for storing small amount of data on client machine.
12. Explain serialization?
Serialization
is a process of converting an object into a stream of bytes.
.Net has 2 serializers namely XMLSerializer and SOAP/BINARY Serializer.
Serialization is maily used in the concept of .Net Remoting.
.Net has 2 serializers namely XMLSerializer and SOAP/BINARY Serializer.
Serialization is maily used in the concept of .Net Remoting.
13. What is the difference between overloading and
overriding ? how can this be .NET?
Overriding -
Method has the same signature as the parent class method.
Overloading - Method having diff parameters list or type or the return type may be different.
Overloading - Method having diff parameters list or type or the return type may be different.
14. Explain friend and protected friend?
Friend/Internal
- Method, Properties in that class can be accessed by all the classes within
that particular assembly.
Protected Friend/Protected Internal - Methods, Properties can be accessed by the child classes of that particular class in that particular assembly.
Protected Friend/Protected Internal - Methods, Properties can be accessed by the child classes of that particular class in that particular assembly.
15. What is isPostback property?
This property
is used to check whether the page is being loaded and accessed for the first
time or whether the page is loaded in response to the client postback.
Example:
Consider two combo boxes
In one lets have a list of countries
In the other, the states.
Upon selection of the first, the subsequent one should be populated in accordance. So this requires postback property in combo boxes to be true.
Example:
Consider two combo boxes
In one lets have a list of countries
In the other, the states.
Upon selection of the first, the subsequent one should be populated in accordance. So this requires postback property in combo boxes to be true.
16. Can you give an example of when it would be
appropriate to use a web service as opposed to a non-serviced .NET component?
When to
use Web Service:
1. Communicating through a Firewall When building a distributed application with 100s/1000s of users spread over multiple locations, there is always the problem of communicating between client and server because of firewalls and proxy servers. Exposing your middle tier components as Web Services and invoking the directly from a Windows UI is a very valid option.
2. Application Integration When integrating applications written in various languages and running on disparate systems. Or even applications running on the same platform that have been written by separate vendors.
3. Business-to-Business Integration This is an enabler for B2B intergtation which allows one to expose vital business processes to authorized supplier and customers. An example would be exposing electronic ordering and invoicing, allowing customers to send you purchase orders and suppliers to send you invoices electronically.
4. Software Reuse This takes place at multiple levels. Code Reuse at the Source code level or binary componet-based resuse. The limiting factor here is that you can reuse the code but not the data behind it. Webservice overcome this limitation. A scenario could be when you are building an app that aggregates the functionality of serveral other Applicatons. Each of these functions could be performed by individual apps, but there is value in perhaps combining the the multiple apps to present a unifiend view in a Portal or Intranet.
When not to use Web Services:
1. Single machine Applicatons When the apps are running on the same machine and need to communicate with each other use a native API. You also have the options of using component technologies such as COM or .NET Componets as there is very little overhead.
2. Homogeneous Applications on a LAN If you have Win32 or Winforms apps that want to communicate to their server counterpart. It is much more efficient to use DCOM in the case of Win32 apps and .NET Remoting in the case of .NET Apps
1. Communicating through a Firewall When building a distributed application with 100s/1000s of users spread over multiple locations, there is always the problem of communicating between client and server because of firewalls and proxy servers. Exposing your middle tier components as Web Services and invoking the directly from a Windows UI is a very valid option.
2. Application Integration When integrating applications written in various languages and running on disparate systems. Or even applications running on the same platform that have been written by separate vendors.
3. Business-to-Business Integration This is an enabler for B2B intergtation which allows one to expose vital business processes to authorized supplier and customers. An example would be exposing electronic ordering and invoicing, allowing customers to send you purchase orders and suppliers to send you invoices electronically.
4. Software Reuse This takes place at multiple levels. Code Reuse at the Source code level or binary componet-based resuse. The limiting factor here is that you can reuse the code but not the data behind it. Webservice overcome this limitation. A scenario could be when you are building an app that aggregates the functionality of serveral other Applicatons. Each of these functions could be performed by individual apps, but there is value in perhaps combining the the multiple apps to present a unifiend view in a Portal or Intranet.
When not to use Web Services:
1. Single machine Applicatons When the apps are running on the same machine and need to communicate with each other use a native API. You also have the options of using component technologies such as COM or .NET Componets as there is very little overhead.
2. Homogeneous Applications on a LAN If you have Win32 or Winforms apps that want to communicate to their server counterpart. It is much more efficient to use DCOM in the case of Win32 apps and .NET Remoting in the case of .NET Apps
17. How to retrieve the last error occured in the
application?
Use Server.GetLastError();
18. How to clear the last error occured in the
application?
Use Server.ClearError();
19. Whats MSIL, and why should my developers need an
appreciation of it if at all?
MSIL is the
Microsoft Intermediate Language. All .NET compatible languages will get
converted to MSIL. MSIL also allows the .NET Framework to JIT compile the
assembly on the installed computer.
20. Can I use the Win32 API from a .NET Framework
program?
Yes. Using
platform invoke, .NET Framework programs can access native code libraries by
means of static DLL entry points.
Here is an example of C# calling the Win32 MessageBox function:
using System;
using System.Runtime.InteropServices;
class MainApp
{
[DllImport("user32.dll", EntryPoint="MessageBox")]
public static extern int MessageBox(int hWnd, String strMessage, String strCaption, uint uiType);
public static void Main()
{
MessageBox( 0, "Hello, this is PInvoke in operation!", ".NET", 0 );
}
}
Here is an example of C# calling the Win32 MessageBox function:
using System;
using System.Runtime.InteropServices;
class MainApp
{
[DllImport("user32.dll", EntryPoint="MessageBox")]
public static extern int MessageBox(int hWnd, String strMessage, String strCaption, uint uiType);
public static void Main()
{
MessageBox( 0, "Hello, this is PInvoke in operation!", ".NET", 0 );
}
}
No comments:
Post a Comment