C# (Sharp) Programming Language

  Home  Microsoft .Net Technologies  C# (Sharp) Programming Language


“Learn C# (Sharp) Programming Language by Interview Questions and Answers”



163 C# (Sharp) Programming Language Questions And Answers

63⟩ Difference between a sub and a function in C#.

Answer1

A Sub does not return anything whereas a Function returns something.

Answer2

-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

 190 views

67⟩ Constructor in C#.

Constructor is a method in the class which has the same name as the class (in VB.Net its New()). It initialises the member attributes whenever an instance of the class is created.

 196 views

76⟩ If a method is marked as protected internal who can access it?

1. Classes that are both in the same assembly and derived from the declaring class.

2. Only methods that are in the same class as the method in question.

3. Internal methods can be only be called using reflection.

4. Classes within the same assembly, and classes derived from the declaring class.

 189 views

77⟩ What is boxing in C#?

1. Encapsulating an object in a value type.

2. Encapsulating a copy of an object in a value type.

3. Encapsulating a value type in an object.

4. Encapsulating a copy of a value type in an object.

 201 views

78⟩ What's C#?

C# (pronounced C-sharp) is a new object oriented language from Microsoft and is derived from C and C++. It also borrows a lot of concepts from Java too including garbage collection. More at http://msdn.microsoft.com/vstudio/nextgen/technology/csharpintro.asp, http://msdn.microsoft.com/library/default.asp?URL=/library/dotnet/csspec/vclrfcsharpspec_Start.htm and http://msdn.microsoft.com/vstudio/nextgen/technology/csharpdownload.asp

 180 views

80⟩ What is a satellite assembly in C#?

When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies.

 187 views