.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Interview Question >> .NET Framework >> Post New Question Subscribe to Interview Questions

What is the difference between static and instance methods

Posted By :Ashutosh Jha     Posted Date :May 23, 2014    Points :40   Category :.NET Framework 
A method declared with a static modifier is a static method. A static method does not operate on a specific instance and can only access static members.

A method declared without a static modifier is an instance method. An instance method operates on a specific instance and can access both static and instance members. The instance on which an instance method was invoked can be explicitly accessed as this. It is an error to refer to this in a static method.


You can also find related Interview Question to What is the difference between static and instance methods  below: 

Difference between type constructor and instance constructor? What is static constructor, when it will be fired? And what is its use?

  
(Class constructor method is also known as type constructor or type initializer)
Instance constructor is executed when a new instance of type is created and the class constructor is executed after the type is loaded and before any one of the type members is accessed. (It will get executed only 1st time, when we call any static methods/fields in the same class.) Class constructors are used for static field initialization. Only one class constructor per type is permitted, and it cannot use the vararg (variable argument) calling convention. (More...)

Difference Between GET and POST methods in HTML

  
Difference Between GET and POST methods

GET:
1) Data is appended to the URL.
2) Data is not secret.
3) It is a single call system
4) Maximum data that can be sent is 256.
5) Data transmission is faster
6) This is the default method for many browsers

POST:
1) Data is appended to the URL.
2) Data is Secret
3) It is a two call system.
4) There is no Limit on the amount of data.That is characters any amount of data can be sent.
5) Data transmission is comparatively slow.
6) No default and should be Explicitly specified. (More...)

Expalin one difference between Abstract and virtual methods?

  
Virtual method can be overriden in any of its derived class and abstract method must be overriden in any of the non abstract class. (More...)

What is difference between lock vs static locks?

  
static lock is applicable to static methods and variables.
(More...)

What is the difference between int.Parse and int.TryParse methods?

  
Parse method throws an exception if the string you are trying to parse is not a valid number where as TryParse returns false and does not throw an exception if parsing fails. Hence TryParse is more efficient than Parse (More...)

What is difference between constants, readonly and, static ?

  
Constants: The value can't be changed
Read-only: The value will be initialized only once from the constructor of the class.
Static: Value can be initialized once.

(More...)

What is the difference between Skip() and SkipWhile() extension methods?

  
Skip() will take an integer argument and skips the top n numbers from the given IEnumerable

SkipWhile() continues to skip the elements as long as the input condition is true. Once condition turns false it will return all remaining elements. (More...)

What is the difference between Execute Reader, Execute Scalar and Execute Non Query methods?

  
Execute Reader
Execute Reader will be used to return the set of rows, on execution of SQL Query or Stored procedure using command object.

Execute Scalar
Execute Scalar will be used to return the single value, on execution of SQL Query or Stored procedure using command object.

Execute Non Query
If the command or stored procedure performs INSERT, DELETE or UPDATE operations, then we use Execute Non Query method. Execute Non Query method returns an integer specifying the number of rows inserted, deleted or updated.

(More...)

What is difference between Load() and LoadQuery() methods ?

  

Ans. Load method populates the client object directly with what it gets data from the server i.e. a collection object like ListItemCollection etc. but LoadQuery returns the data as a completely new collection in IEnumerable format. Other major difference is that the Collections that you load using the Load() method are eligible for garbage collection only when the client context variable itself goes out of scope where as, in these collections go out of scope at the end of IEnumerable list. (More...)


Q. What is difference between Load() and LoadQuery() methods ?

  
Ans. Load method populates the client object directly with what it gets data from the server i.e. a collection object like ListItemCollection etc. but LoadQuery returns the data as a completely new collection in IEnumerable format. Other major difference is that the Collections that you load using the Load() method are eligible for garbage collection only when the client context variable itself goes out of scope where as, in these collections go out of scope at the end of IEnumerable list.

(More...)

Difference between Static vs Constant

  
Static Variable:
1.Variable set at run time
2.Can be assigned for reference types.
3.Initialized on constructors
Constant:
1.Variable set at compile time itself.
2.Assigned for value types only
3.must be initialized at declaration time
4.only primitive data types. (More...)

What is the difference between Object and Instance?

  
An instance of a user-defined type is called an object. We can instantiate many objects from one class.
An object is an instance of a class.
(More...)

Difference between static and dynamic?

  
Static : we can mention how many things we need.
Dynamic : we cannot mention it generates depends upon the requirements. (More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

 
Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.


Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend