ASP.net Interview Questions - 6
Friday, September 19, 2008
What is CLS (Common Language Specificaiton)?
It provides the set of specificaiton which has to be adhered by any new language writer / Compiler writer for .NET Framework. This ensures Interoperability. For example: Within a ASP.NET application written in C#.NET language, we can refer to any DLL written in any other language supported by .NET Framework. As of now .NET Supports around 32 languages.
What is CTS (Common Type System)?
It defines about how Objects should be declard, defined and used within .NET. CLS is the subset of CTS.
What is Boxing and UnBoxing?
Boxing is implicit conversion of ValueTypes to Reference Types (Object) .
UnBoxing is explicit conversion of Reference Types (Object) to its equivalent ValueTypes. It requires type-casting.
What is the difference between Value Types and Reference Types?
Value Types uses Stack to store the data where as the later uses the Heap to store the data.
What are the different types of assemblies available and their purpose?
Private, Public/shared and Satellite Assemblies.
Private Assemblies : Assembly used within an application is known as private assemblies
Public/shared Assemblies : Assembly which can be shared across application is known as shared assemblies. Strong Name has to be created to create a shared assembly. This can be done using SN.EXE. The same has to be registered using GACUtil.exe (Global Assembly Cache).
Satellite Assemblies : These assemblies contain resource files pertaining to a locale (Culture+Language). These assemblies are used in deploying an Gloabl applicaiton for different languages.
Is String is Value Type or Reference Type in C#?
String is an object (Reference Type).
Which controls do not have events?
Ans:Timer control.
What is the maximum size of the textbox?
Ans:65536.
Which property of the textbox cannot be changed at runtime?
Ans:Locked Porperty.
Which control cannot be placed in MDI?
Ans:The controls that do not have events.
Difference between a sub and a function.
Ands -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
Explain manifest & metadata.
Ands: Manifest is metadata about assemblies. Metadata is machine-readable information about a resource, or “”data about data.” In .NET, metadata includes type definitions, version information, external assembly references, and other standardized information.
Difference between imperative and interrogative code
Ans. There are imperative and interrogative functions. Imperative functions are the one which return a value while the interrogative functions do not return a value.
What are the two kinds of properties
Ans. Two types of properties in .Net: Get & Set
Two kind of properties are scalar properties and indexed properties
Explain constructor
Ans. 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.
Describe ways of cleaning up objects
Ans. The run time will maintain a service called as garbage collector. This service will take care of deallocating memory corresponding to objects. It works as a thread with least priority.when application demands for memory the runtime will take care of setting the high priority for the garbage collector,so that it will be called for execution and memory will be released.the programmer can make a call to garbage collector by using GC class in system name space.