.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 >> OOPS >> Post New Question Subscribe to Interview Questions

Main Difference between Method and function?

Posted By :Amit Mehra     Posted Date :April 07, 2010    Points :10   Category :OOPS 
Method which tied to a class where as function need not to be. In OOPS we can say there is no functions concept because all the method is tied to a class.

Function is available in procedural language, Scripting language that why we say JavaScript function etc.

You can also find related Interview Question to Main Difference between Method and function?  below: 

What is Method Overriding? How to override a function in C#?

  
Use the override modifier to modify a method, a property, an indexer, or an event. 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.
You cannot override a non-virtual or static method. The overridden base method must be virtual, abstract, or override. (More...)

Difference between a sub and a function.

  
A Sub Procedure is a method will not return a value
-A sub procedure will be defined with a "Sub" keyword
Sub ShowName(ByVal myName As String)
Console.WriteLine("My name is: " & myName)
End Sub
-A function is a method that will return value(s).
-A function will be defined with a "Function" keyword
Function FindSum(ByVal num1 As Integer, ByVal num2 As Integer) As Integer
Dim sum As Integer = num1 + num2
Return sum
End Function (More...)

What is the Main Difference between ASP and ASP.NET?

  
ASP Contains Scripts which are not complied where as in asp.net the code is compiled (More...)

What is the difference between Session.Clear() and Session.RemoveAll() method?

  
Well, actually there is no difference. Session.RemoveAll() methods internally makes a call to Clear() method only.

Thanks. (More...)

What is difference between TransferRequest and Transfer method?

  
Transfer: Terminates execution of the current page and starts execution of provided URL.
TransferRequest : Performs an asynchronous execution of the provided URL. (More...)

What are valid signatures for the Main function?

  
public static void Main ();
public static int Main ();
public static void Main ( string[] args );
public static int Main (string[] args ); (More...)

whats the difference between a stroed procedure and a user defined function

  
udf ll return only one output parameter where as sp returns more(2100 not sure)

udf are called directly by their name in a pgm where as exec spname
is used to execcute an sp (More...)

what is the main difference between delegate and an event in c#?

  
Delegates and Events Both are related.

Dalegete is a function pointer which can able to store the address of any function with same prototype.

Event is a function handler which can handles or run the functions in same prototype of its delegate.

For handling events delegate is used. (More...)

What is the difference between method activity and event activity in WorkFlow ?

  
A method activity is one that performs an action, such as creating or updating a task. An event activity is one that runs in response to an action occurring. (More...)

Difference between Function and Stored Procedure?

  
UDF can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section where as Stored procedures cannot be.
UDFs that return tables can be treated as another rowset. This can be used in JOINs with other tables.
Inline UDF's can be though of as views that take parameters and can be used in JOINs and other Rowset operations.
(More...)

Difference between Len and DataLength function in Sql Server?

  
LEN() function will not count the trailing spaces.

DATALENGTH() function will count the trailing function

example:

DECLARE @MyString VARCHAR(50)
SET @MyString = 'alwyn '
SELECT LEN(@MyString) AS LenFunction
SELECT DATALENGTH(@MyString) AS DataLength

LenFunction:
5

DataLength:
8 (More...)

Can you run the java program without main method?

  
A java applet application, a web application can run without main method. A Java program can run without using ' public static void main(String args[]) ' method by using a static block.

The static block gets executed soon after the class is loaded, even prior to the 'public static void main(String args[]) '. JVM searches for main method only after exiting from the static block. JVM throws an exception if main method is not found. To avoid throwing this exception we can use System.exit(0);

The following code depicts a class without main method; with only static block and System.exit(0).

class WithoutMainMethod {
static
{
System.out.println("This class has no public static void main(String args[]) ");
System.out.exit(0);
}
}. (More...)

What is Difference between Function and Stored Procedure?

  
UDF can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section where as Stored procedures cannot be. UDFs that return tables can be treated as another rowset. This can be used in JOINs with other tables. Inline UDF's can be thought of as views that take parameters and can be used in JOINs and other Rowset operations. (More...)

What is the difference between Convert.toString and .toString()
method?

  
Just to give an understanding of what the above question means see the below code :-

int val = 0;
MessageBox.Show(val.ToString());
MessageBox.Show(Convert.ToString(val));


We can convert the integer "val" using "val.ToString()" or "Convert.ToString" so what's the difference.

The basic difference between them is "Convert" function handles NULLS while "val.ToString()"
does not.

It will throw a NULL reference exception error. So as good coding practice using "Convert" is always safe. (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