.Net

.NET interview Questions – Part 16

1.What’s involved in certain piece of code being managed?

The advantages include automatic garbage collection, memory management, support for versioning and security. These advantages are provided through .NET FCL and CLR, while with the unmanaged code
similar capabilities had to be implemented through third-party libraries or as a part of the application itself.

2.Are COM objects managed or unmanaged?

Since COM objects were written before .NET, apparently they are unmanaged. Any code not written in the Microsoft .NET framework environment is UNMANAGED. So naturally
COM+ is unmanaged because it is written in Visual Basic 6.

3.So can a COM object talk to a .NET object?

Yes, through Runtime Callable Wrapper (RCW) or PInvoke.

4.How do you generate an RCW from a COM object?

Use the Type Library Import utility shipped with SDK. tlbimp COMobject.dll /out:.NETobject.dll or reference the COM library from Visual Studio in your project.

5.I can’t import the COM object that I have on my machine. Did you write that object?

You can only import your own objects. If you need to use a COM component from another developer,you should obtain a Primary Interop Assembly (PIA) from whoever authored the original object.
The answer to (5) is only partially correct. You *can* import COM objects, even if they are not yourown. It is recommended that you obtain the Primary Interop from the vendor, but not required. The
COM DLL. You can generate interops for these additional DLLs, and then refer to them when importing the problem DLL.

6.How do you call unmanaged methods from your .NET code through PInvoke?

Supply a DllImport attribute. Declare the methods in your .NET code as static extern. Do not implement the methods as they are implemented in your unmanaged code, you’re just providing
declarations for method signatures.

7.Can you retrieve complex data types like structs from the PInvoke calls?

Yes, just make sure you re-declare that struct, so that managed code knows what to do with it.

8.Can you inherit a COM class in a .NET application?

The .NET Framework extends the COM model for reusability by adding implementation inheritance.Managed types can derive directly or indirectly from a COM coclass; more specifically, they can derive
from the runtime callable wrapper generated by the runtime. The derived type can expose all the method and properties of the COM object as well as methods and properties implemented in managed
code. The resulting object is partly implemented in managed code and partly implemented in unmanaged code. Suppose I call a COM object from a .NET application, but COM object throws an error. What

9.happens on the .NET end?

COM methods report errors by returning HRESULTs; .NET methods report them by throwing exceptions. The runtime handles the transition between the two. Each exception class in the .NET
Framework maps to an HRESULT.

10.What do you know about .NET assemblies?

Assemblies are the smallest units of versioning and deployment in the .NET application. Assemblies are also the building blocks for programs such as Web services, Windows services, serviced
components, and .NET Remoting applications.

11.I want to expose my .NET objects to COM objects. Is that possible?

Yes, but few things should be considered first. Classes should implement interfaces explicitly.Managed types must be public. Methods, properties, fields, and events that are exposed to COM must
be public. Types must have a public default constructor with no arguments to be activated from COM.Types cannot be abstract.

12.What’s the difference between private and shared assembly?

Private assembly is used inside an application only and does not have to be identified by a strong name.
Shared assembly can be used by multiple applications and has to have a strong name.

13.What’s a strong name?

A strong name includes the name of the assembly, version number, culture identity, and a public key token.

14.How can you tell the application to look for assemblies at the locations other than its own install?

Use the directive in the XML .config file for a given application.
<probing privatePath=”c:mylibs; bindebug” />
should do the trick. Or you can add additional search paths in the Properties box of the deployed application.

15.How can you debug failed assembly binds?

Use the Assembly Binding Log Viewer (fuslogvw.exe) to find out the paths searched.

16.Where are shared assemblies stored?

Global assembly cache.

17.How can you create a strong name for a .NET assembly?

With the help of Strong Name tool (sn.exe).

18.Where’s global assembly cache located on the system?

Usually C:winntassembly

19.What is delay signing?

Delay signing allows you to place a shared assembly in the GAC by signing the assembly with just the public key. This allows the assembly to be signed with the private key at a later stage, when the
development process is complete and the component or assembly is ready to be deployed. This process enables developers to work with shared assemblies as if they were strongly named, and it secures the
private key of the signature from being accessed at different stages of development.

20.If I have more than one version of one assemblies, then how will I use old version in my application? Give an example.

Change the assembly version number in the AssemblyInfo.vb file

21.How does you handle this COM components developed in other programming languages in.NET?

While adding the refferences we can handle the COM components in other .Net programming languages.

Replication is used for distributing data and the execution of stored procedures across an enterprise. The replication technology allows you to make duplicate copies of your data, move those copies to
different locations, and synchronize the data automatically so that all copies have the same data values. The different types of replications are
a) transactional replication
b) merge replication

25.How do SQL Server 2000 and XML linked? What is SQL Server agent?

Every Request or the Response to or from SQL Server is converted into XML format. Its purpose is to ease the implementation of tasks for the DBA, with its full-function scheduling engine, which allows
you to schedule your own jobs and scripts.

26.What is the purpose of using COLLATE in a query?

Collation refers to a set of rules that determine how data is sorted and compared. Character data is sorted using rules that define the correct character sequence, with options for specifying casesensitivity,
accent marks, kana character types and character width.

27.What is an execution plan? When would you use it? How would you view the execution plan?

The Query Analyzer has a feature called Show Execution Plan. This option allows you to view the execution plan used by SQL Server’s Query Optimizer to actually execute the query. This option is
available from the Query menu on the main menu of Query Analyzer, and must be turned on before the query is executed. Once the query is executed, the results of the execution plan are displayed in
graphical format in a separate window, available from a tab that appears below the query results window on the screen.

28.What is the STUFF function and how does it differ from the REPLACE function?

stuff-> inserts into it without removing any thing. Replace->replace the given text with the new one.

29.What does it mean to have quoted_identifier on? What are the implications of having it off?

SET QUOTED_IDENTIFIER ON- Causes SQL Server to follow the SQL-92 rules regarding quotation mark delimiting identifiers and literal strings. Identifiers delimited by double quotation marks can be
either Transact-SQL reserved keywords or can contain characters not usually allowed by the Transact-SQL syntax rules for identifiers.

30.What is the difference between a Local temporary table and a Global temporary table? How is each one used?

Local templrary table will have a single # (#tablename) appended with the table name.Global temporary table will have Double # (##tablename) appended with the table name.
Ex:create table #table1
local temp. table will be available until the session who created it logs out, but global temp. table is
available till the last session gets close in SQLServer.

31.What are cursors? Name four type of cursors and when each one would be applied?

Opening a cursor on a result set allows processing the result set one row at a time.
The four API server cursor types supported by SQL Server are:
a) Static cursors
b) Dynamic cursors
c) Forward-only cursors
d) Keyset-driven cursors

32. What are remotable objects in .NET Remoting?

Remotable objects are the objects that can be marshaled across the application domains. You can marshal by value, where a deep copy of the object is created and then passed to the receiver. You can also marshal by reference, where just a reference to an existing object is passed.

33.What are the types of Authentication?

There are 3 types of Authentication.
Windows Authentication
Forms Authentication
Passport Authentication
.
34. What namespaces are necessary to create a localized application?

System.Globalization
System.Resources

35.What is indexing?

If we give proper indexes on a table so that any queries written against this table can run efficiently. As your data sets grow over time, SQL Server will continue to rebuild indexes and move data around as
efficiently as possible. This property is known as Indexing.

server.transfer-> transfers the server’s control to the requested page given in the parameter.
server.Execute-> executes the requested page from the current page itself, with no change in the address bar. after execution the next line of code is executed in the current page.

37. What is strong-typing versus weak-typing?

Strong type is checking at the variables in compile time.Weak typing is checking the variables at run-time.

38. What is the root class in .Net?

system.object is the root class in .net .

39. What is the maximum size of the textbox?

65536

40. What is managed code execution?

The .Net framework loads and executes the .Net applications, and manages the state of objects during program execution. This also provides automatically garbage collections.

41. Which namespaces are used for data access?

System.Data
System.Data.OleDB
System.Data.SQLClient

42. What is the strong name in .net assembly?

Strong Name is similar to GUID (It is supposed to be unique in space and time).In COM components. Strong name is only needed when we need to deploy assembly in GAC.
Strong names use public key cryptography (PKC) to ensure that no one can spoof it. PKC use public key and private key concept. Following are the step to generate a strong name and sign an assembly:

43.How to run a Dos command in Vb.net?

Shell(“cmd.exe /c c:first.exe < in.txt > out.txt”)

44. What are the assembly entry points?

An assembly can have only one entry point from DllMain, WinMain or Main.

45. What are the advantages of an assembly?

Increased performance.
Better code management and encapsulation.
It also introduces the n-tier concepts and business logic.

46. What is the purpose of an Assembly?

An assembly controls many aspects of an application. The assembly handles versioning, type and class scope, security permissions, as well as other metadata including references to other assemblies and resources. The rules described in an assembly are enforced at runtime.

47. How to view an assembly?

We can use the tool ildasm.exe known as Assembly Disassembler to view the assembly.

Assemblies are of two types, private and shared assemblies.
A private assembly is used by the clients of the same application directory structure as the assembly.
A shared assembly is stored in the global assembly cache (GAC), which is a repository of assemblies maintained by the runtime. A shared assembly can be referenced by more than one application.

50. Which namespace is the base class for .net Class library?

System.object

51. What are the satellite assemblies?

In a multilingual or multi-cultural application, the localized assemblies, which contain language specific instructions that modify the core application, are kept separately and they are called satellite assemblies.

52. What are the two main parts of the .NET Framework?

The .NET Framework has two main components :
The common language runtime
The .NET Framework class library

53. What are the benefits of.NET Framework?

.NET Framework offers many benefits to application developers. Some of these benefits are as follows :
Consistent programming model
Language interoperability
Automatic management of resources
Ease of deployment

54. Where are all .NET Collection classes located?

System.Collection namespace has all the collection classes available in .NET.

55. How many languages .NET is supporting now?

When .NET was introduced it came with several languages. VB.NET, C#, COBOL and Perl, etc. 44 languages are supported.

56. What are the advantages of VB.NET?

The main advantages of .net are :
.NET is a language independent
Automatic memory management(garbage collection)
Disconnected architecture Object Oriented.

57. What is meant by .NET framework?

The .NET Framework is an environment for building, deploying, and running Web Services and other applications.
It consists of three main parts :
The Common Language Runtime
The Framework classes
ASP.NET

58. What are the different types of applications supported in .NET (or) .NET Framework?

C# is case sensitive while VB is not case sensitive.
vb.net does not support xml while c# support xml
vb.net supports with constructor while c# do not.

61. What is namespaces?

Namespace is a logical grouping of class.It is a logical group of related classes and interfaces and that can be used by any language targeting the .net framework.

62. What is Delegates?

Delegates are a type-safe, object-oriented implementation of function pointers and are used in many situations where a component needs to call back to the component that is using it. Delegates are generally used as basis of events, which allow any delegate to easily be registered for as event.

63. Which is the root namespace for fundamental types in .NET Framework?

The System namespace is the root namespace for fundamental types in .NET Framework.

64. What is Intermediate Langauge?

Intermediate Language(IL) is also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .Net source code is compiled to IL. IL is then converted to machine code at the point where the software is installed, or at run time by a Just in time (JIT) Compiler.

65. What is Common Language Runtime (CLR)?

The .NET Framework provides a runtime environment called the Common Language Runtime or CLR (similar to the Java Virtual Machine or JVM in Java), which handles the execution of code and provides useful services for the implementation of the program.
All languages have runtime and it is responsibility of the runtime to take care of the code execution of the program.

66. What is Common Language Specification (CLS)?

This is a subset of the CTS, which all .NET languages are expected to support. It was always a dream of Microsoft to unite all different languages in to one umbrella and CLS is one-step towards that. Microsoft has defined CLS, which are nothing but guidelines, that language should follow so that it can communicate with other .NET languages in a seamless manner.

67. What is Common Type Specifications (CTS)?

The Common type system is a rich type system, built into the common language runtime, which supports the types and operations found in most programming languages.

68. What is Code Access Security?

CAS – Code Access Security is the part of the .NET security model that determines whether or not a piece of code is allowed to run, and what resources it can use when it is running.

69. What is GAC or Global Assembly Cache?

Global Assembly Cache (GAC) is a common place to share the .NET assemblies across many applications. GAC caches all strong named assembly references within it. All System assemblies that come with the .NET framework reside in the GAC.

70.What is the difference between early binding and late binding?

Calling a non-virtual method, decided at a compile time is known as early binding.
Calling a virtual method (Pure Polymorphism), decided at a runtime is known as late binding.

Managed code is the code that is executed directly by the CLR instead of the operating system.Unmanaged code is the code that is executed directly by the operating system outside the CLR environment.

73. What is the use of JIT compiler?

JIT compiler is a part of the runtime execution environment.

74.What are different types of JIT?

Pre-JIT: Pre-JIT compiles complete source code into native code in a single compilation cycle. This is done at the time of deployment of the application.
Econo-JIT:. Econo-JIT compiles only those methods that are called at runtime.However, these compiled methods are removed when they are not required.
Normal-JIT: Normal-JIT compiles only those methods that are called at runtime. These methods are compiled the first time they are called, and then they are stored in cache. When the same methods are called again, the compiled code from cache is used for execution.

75. What is the role of the JIT compiler in .NET Framework?

The JIT compiler is an important element of CLR, which loads MSIL on target machine for execution.
The MSIL is stored in .NET assemblies after the developer has compiled the code written in any .NET-compliant programming language, such as Visual Basic and C#.
JIT compiler translates the MSIL code of an assembly and uses the CPU architecture of the target machine to execute a .NET application.

76.What is the difference between convert.to.string and .to.string() method?

Convert function handles nulls while i.string() does not it will throw a null reference exception error.

77.What namespace does the Web page belong in the .NET Framework class hierarchy?

System.Web.UI.Page

78. What is managed code?

Managed code is the code that is executed directly by the CLR. The applications created by using managed code automatically have CLR services, such as type checking, security, and automatic garbage collection.

79. What is the difference between Authentication and Authorization?

Authentication is the process of identifying users. Authentication is identifying/validating the user against the credentials (username and password) and Authorization performs after authentication. Authorization is the process of granting access to those users based on identity. Authorization allowing access of specific resource to user.

80. What are the types of Authentication?

There are two types of authentication are
Windows authentication
Forms authentication
Passport authentication

81.What is the differences between dataset.clone and dataset.copy?

Dataset.clone copies just the structure of dataset (including all the datatables, schemas, relations and constraints.); however it doesn’t copy the data.
Dataset.copy, copies both the dataset structure and the data.

82.How does CAS work?

The CAS security policy revolves around two key concepts – code groups and permissions. Each .NET assembly is a member of a particular code group, and each code group is granted the permissions specified in a named permission set.

83. What is serialization in .NET?

Serialization is the process of converting an object into a stream of bytes.

84. What does an assembly contain?

Manifest – The metadata describing the information below.
Assembly name – Aids in versioning and visibility scope.
Version information – The version number is integrated into the assembly’s identity.
Types – Boundaries and scopes of methods, classes, properties, events and attributes.
Locale – Information describing language/culture.
Cryptographic Hash – Public key encoded hash acting as version/security check.
Security Permissions – The permissions within the assembly determine the permissions that can be granted for all aspects of the assembly contents.

85. What is a Windows process?

Windows process is an application that’s running and had been allocated memory.

86. Can one DLL file contains the compiled code of more than one .NET language?

No, a DLL file can contain the compiled code of only one programming language.

87.What is the syntax to declare a namespace in .NET?

In C#, the namespace keyword is used to declare a namespace in the code. The syntax for declaring a namespace in C# is: namespace MyNamespace

88. How many languages .NET is supporting now?

When .Net was introduced it came with some 16 languages. VB.NET, C#, COBOL and PERL etc

89. What is the difference between the Debug class and Trace class?

Use Debug class for debug builds. Use Trace class for both debug and release builds.

90. What is the difference between Array and Arraylist?

An array is a collection of the same type. The size of the array is fixed in its declaration. A linked list is similar to an array but it doesn’t have a limited size.

91. What are methods?

A method represents a behavior of a class.Methods are the building blocks of a class, in which they are linked together to share and process data to produce the result.

92. What is a postback? and when is it used in ASP.NET Web forms?

A postback is the name for the page request that an ASP.NET page sends to itself when a Web control is activated, such as when users click a button. Most Web forms use the HTML form control, which allows users to submit data using HTTP Post requests.

93.Which method do you use to redirect the user to another page without performing a round trip to the client?

Server.transfer()

94.What is a Session and Application object?

Session object store information between HTTP requests for a particular user, while application object are global across users.

95. What method is used to bind data items to an ASP.NET Web control?

The DataBinder.Eval method binds data items to ASP.NET Web controls

96. How do you turn off cookies for one page in your site?

Use the Cookie.Discard Property which Gets or sets the discard flag set by the server. When true, this property instructs the client application not to save the Cookie on the user’s hard disk when a session ends.

97. Which namespace is needed to implement debug and trace?

Debug and trace class belongs to System.Diagnostic namespace.

98,What events does the HttpSession class support?

The HttpSession class supports the Load and Unload events.

99.Which two properties are on every validation control?

Control To Validate
ErrorMessage propertie

100. What is a bubbled event?

When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their event handlers, allowing the main DataGrid event handler to take care of its constituents.

101. What makes a Web page dynamic?

Program code that you write makes a Web page dynamic. Dynamic pages respond to user input and perform useful services.

1.What’s involved in certain piece of code being managed?

The advantages include automatic garbage collection, memory management, support for versioning and security. These advantages are provided through .NET FCL and CLR, while with the unmanaged code
similar capabilities had to be implemented through third-party libraries or as a part of the application itself.

2.Are COM objects managed or unmanaged?

Since COM objects were written before .NET, apparently they are unmanaged. Any code not written in the Microsoft .NET framework environment is UNMANAGED. So naturally
COM+ is unmanaged because it is written in Visual Basic 6.

3.So can a COM object talk to a .NET object?

Yes, through Runtime Callable Wrapper (RCW) or PInvoke.

4.How do you generate an RCW from a COM object?

Use the Type Library Import utility shipped with SDK. tlbimp COMobject.dll /out:.NETobject.dll or reference the COM library from Visual Studio in your project.

5.I can’t import the COM object that I have on my machine. Did you write that object?

You can only import your own objects. If you need to use a COM component from another developer,you should obtain a Primary Interop Assembly (PIA) from whoever authored the original object.
The answer to (5) is only partially correct. You *can* import COM objects, even if they are not yourown. It is recommended that you obtain the Primary Interop from the vendor, but not required. The
COM DLL. You can generate interops for these additional DLLs, and then refer to them when importing the problem DLL.

6.How do you call unmanaged methods from your .NET code through PInvoke?

Supply a DllImport attribute. Declare the methods in your .NET code as static extern. Do not implement the methods as they are implemented in your unmanaged code, you’re just providing
declarations for method signatures.

7.Can you retrieve complex data types like structs from the PInvoke calls?

Yes, just make sure you re-declare that struct, so that managed code knows what to do with it.

8.Can you inherit a COM class in a .NET application?

The .NET Framework extends the COM model for reusability by adding implementation inheritance.Managed types can derive directly or indirectly from a COM coclass; more specifically, they can derive
from the runtime callable wrapper generated by the runtime. The derived type can expose all the method and properties of the COM object as well as methods and properties implemented in managed
code. The resulting object is partly implemented in managed code and partly implemented in unmanaged code. Suppose I call a COM object from a .NET application, but COM object throws an error. What

9.happens on the .NET end?

COM methods report errors by returning HRESULTs; .NET methods report them by throwing exceptions. The runtime handles the transition between the two. Each exception class in the .NET
Framework maps to an HRESULT.

10.What do you know about .NET assemblies?

Assemblies are the smallest units of versioning and deployment in the .NET application. Assemblies are also the building blocks for programs such as Web services, Windows services, serviced
components, and .NET Remoting applications.

11.I want to expose my .NET objects to COM objects. Is that possible?

Yes, but few things should be considered first. Classes should implement interfaces explicitly.Managed types must be public. Methods, properties, fields, and events that are exposed to COM must
be public. Types must have a public default constructor with no arguments to be activated from COM.Types cannot be abstract.

12.What’s the difference between private and shared assembly?

Private assembly is used inside an application only and does not have to be identified by a strong name.
Shared assembly can be used by multiple applications and has to have a strong name.

13.What’s a strong name?

A strong name includes the name of the assembly, version number, culture identity, and a public key token.

14.How can you tell the application to look for assemblies at the locations other than its own install?

Use the directive in the XML .config file for a given application.
<probing privatePath=”c:mylibs; bindebug” />
should do the trick. Or you can add additional search paths in the Properties box of the deployed application.

15.How can you debug failed assembly binds?

Use the Assembly Binding Log Viewer (fuslogvw.exe) to find out the paths searched.

16.Where are shared assemblies stored?

Global assembly cache.

17.How can you create a strong name for a .NET assembly?

With the help of Strong Name tool (sn.exe).

18.Where’s global assembly cache located on the system?

Usually C:winntassembly

19.What is delay signing?

Delay signing allows you to place a shared assembly in the GAC by signing the assembly with just the public key. This allows the assembly to be signed with the private key at a later stage, when the
development process is complete and the component or assembly is ready to be deployed. This process enables developers to work with shared assemblies as if they were strongly named, and it secures the
private key of the signature from being accessed at different stages of development.

20.If I have more than one version of one assemblies, then how will I use old version in my application? Give an example.

Change the assembly version number in the AssemblyInfo.vb file

21.How does you handle this COM components developed in other programming languages in.NET?

While adding the refferences we can handle the COM components in other .Net programming languages.

Replication is used for distributing data and the execution of stored procedures across an enterprise. The replication technology allows you to make duplicate copies of your data, move those copies to
different locations, and synchronize the data automatically so that all copies have the same data values. The different types of replications are
a) transactional replication
b) merge replication

25.How do SQL Server 2000 and XML linked? What is SQL Server agent?

Every Request or the Response to or from SQL Server is converted into XML format. Its purpose is to ease the implementation of tasks for the DBA, with its full-function scheduling engine, which allows
you to schedule your own jobs and scripts.

26.What is the purpose of using COLLATE in a query?

Collation refers to a set of rules that determine how data is sorted and compared. Character data is sorted using rules that define the correct character sequence, with options for specifying casesensitivity,
accent marks, kana character types and character width.

27.What is an execution plan? When would you use it? How would you view the execution plan?

The Query Analyzer has a feature called Show Execution Plan. This option allows you to view the execution plan used by SQL Server’s Query Optimizer to actually execute the query. This option is
available from the Query menu on the main menu of Query Analyzer, and must be turned on before the query is executed. Once the query is executed, the results of the execution plan are displayed in
graphical format in a separate window, available from a tab that appears below the query results window on the screen.

28.What is the STUFF function and how does it differ from the REPLACE function?

stuff-> inserts into it without removing any thing. Replace->replace the given text with the new one.

29.What does it mean to have quoted_identifier on? What are the implications of having it off?

SET QUOTED_IDENTIFIER ON- Causes SQL Server to follow the SQL-92 rules regarding quotation mark delimiting identifiers and literal strings. Identifiers delimited by double quotation marks can be
either Transact-SQL reserved keywords or can contain characters not usually allowed by the Transact-SQL syntax rules for identifiers.

30.What is the difference between a Local temporary table and a Global temporary table? How is each one used?

Local templrary table will have a single # (#tablename) appended with the table name.Global temporary table will have Double # (##tablename) appended with the table name.
Ex:create table #table1
local temp. table will be available until the session who created it logs out, but global temp. table is
available till the last session gets close in SQLServer.

31.What are cursors? Name four type of cursors and when each one would be applied?

Opening a cursor on a result set allows processing the result set one row at a time.
The four API server cursor types supported by SQL Server are:
a) Static cursors
b) Dynamic cursors
c) Forward-only cursors
d) Keyset-driven cursors

32. What are remotable objects in .NET Remoting?

Remotable objects are the objects that can be marshaled across the application domains. You can marshal by value, where a deep copy of the object is created and then passed to the receiver. You can also marshal by reference, where just a reference to an existing object is passed.

33.What are the types of Authentication?

There are 3 types of Authentication.
Windows Authentication
Forms Authentication
Passport Authentication
.
34. What namespaces are necessary to create a localized application?

System.Globalization
System.Resources

35.What is indexing?

If we give proper indexes on a table so that any queries written against this table can run efficiently. As your data sets grow over time, SQL Server will continue to rebuild indexes and move data around as
efficiently as possible. This property is known as Indexing.

server.transfer-> transfers the server’s control to the requested page given in the parameter.
server.Execute-> executes the requested page from the current page itself, with no change in the address bar. after execution the next line of code is executed in the current page.

37. What is strong-typing versus weak-typing?

Strong type is checking at the variables in compile time.Weak typing is checking the variables at run-time.

38. What is the root class in .Net?

system.object is the root class in .net .

39. What is the maximum size of the textbox?

65536

40. What is managed code execution?

The .Net framework loads and executes the .Net applications, and manages the state of objects during program execution. This also provides automatically garbage collections.

41. Which namespaces are used for data access?

System.Data
System.Data.OleDB
System.Data.SQLClient

42. What is the strong name in .net assembly?

Strong Name is similar to GUID (It is supposed to be unique in space and time).In COM components. Strong name is only needed when we need to deploy assembly in GAC.
Strong names use public key cryptography (PKC) to ensure that no one can spoof it. PKC use public key and private key concept. Following are the step to generate a strong name and sign an assembly:

43.How to run a Dos command in Vb.net?

Shell(“cmd.exe /c c:first.exe < in.txt > out.txt”)

44. What are the assembly entry points?

An assembly can have only one entry point from DllMain, WinMain or Main.

45. What are the advantages of an assembly?

Increased performance.
Better code management and encapsulation.
It also introduces the n-tier concepts and business logic.

46. What is the purpose of an Assembly?

An assembly controls many aspects of an application. The assembly handles versioning, type and class scope, security permissions, as well as other metadata including references to other assemblies and resources. The rules described in an assembly are enforced at runtime.

47. How to view an assembly?

We can use the tool ildasm.exe known as Assembly Disassembler to view the assembly.

Assemblies are of two types, private and shared assemblies.
A private assembly is used by the clients of the same application directory structure as the assembly.
A shared assembly is stored in the global assembly cache (GAC), which is a repository of assemblies maintained by the runtime. A shared assembly can be referenced by more than one application.

50. Which namespace is the base class for .net Class library?

System.object

51. What are the satellite assemblies?

In a multilingual or multi-cultural application, the localized assemblies, which contain language specific instructions that modify the core application, are kept separately and they are called satellite assemblies.

52. What are the two main parts of the .NET Framework?

The .NET Framework has two main components :
The common language runtime
The .NET Framework class library

53. What are the benefits of.NET Framework?

.NET Framework offers many benefits to application developers. Some of these benefits are as follows :
Consistent programming model
Language interoperability
Automatic management of resources
Ease of deployment

54. Where are all .NET Collection classes located?

System.Collection namespace has all the collection classes available in .NET.

55. How many languages .NET is supporting now?

When .NET was introduced it came with several languages. VB.NET, C#, COBOL and Perl, etc. 44 languages are supported.

56. What are the advantages of VB.NET?

The main advantages of .net are :
.NET is a language independent
Automatic memory management(garbage collection)
Disconnected architecture Object Oriented.

57. What is meant by .NET framework?

The .NET Framework is an environment for building, deploying, and running Web Services and other applications.
It consists of three main parts :
The Common Language Runtime
The Framework classes
ASP.NET

58. What are the different types of applications supported in .NET (or) .NET Framework?

C# is case sensitive while VB is not case sensitive.
vb.net does not support xml while c# support xml
vb.net supports with constructor while c# do not.

61. What is namespaces?

Namespace is a logical grouping of class.It is a logical group of related classes and interfaces and that can be used by any language targeting the .net framework.

62. What is Delegates?

Delegates are a type-safe, object-oriented implementation of function pointers and are used in many situations where a component needs to call back to the component that is using it. Delegates are generally used as basis of events, which allow any delegate to easily be registered for as event.

63. Which is the root namespace for fundamental types in .NET Framework?

The System namespace is the root namespace for fundamental types in .NET Framework.

64. What is Intermediate Langauge?

Intermediate Language(IL) is also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .Net source code is compiled to IL. IL is then converted to machine code at the point where the software is installed, or at run time by a Just in time (JIT) Compiler.

65. What is Common Language Runtime (CLR)?

The .NET Framework provides a runtime environment called the Common Language Runtime or CLR (similar to the Java Virtual Machine or JVM in Java), which handles the execution of code and provides useful services for the implementation of the program.
All languages have runtime and it is responsibility of the runtime to take care of the code execution of the program.

66. What is Common Language Specification (CLS)?

This is a subset of the CTS, which all .NET languages are expected to support. It was always a dream of Microsoft to unite all different languages in to one umbrella and CLS is one-step towards that. Microsoft has defined CLS, which are nothing but guidelines, that language should follow so that it can communicate with other .NET languages in a seamless manner.

67. What is Common Type Specifications (CTS)?

The Common type system is a rich type system, built into the common language runtime, which supports the types and operations found in most programming languages.

68. What is Code Access Security?

CAS – Code Access Security is the part of the .NET security model that determines whether or not a piece of code is allowed to run, and what resources it can use when it is running.

69. What is GAC or Global Assembly Cache?

Global Assembly Cache (GAC) is a common place to share the .NET assemblies across many applications. GAC caches all strong named assembly references within it. All System assemblies that come with the .NET framework reside in the GAC.

70.What is the difference between early binding and late binding?

Calling a non-virtual method, decided at a compile time is known as early binding.
Calling a virtual method (Pure Polymorphism), decided at a runtime is known as late binding.

Managed code is the code that is executed directly by the CLR instead of the operating system.Unmanaged code is the code that is executed directly by the operating system outside the CLR environment.

73. What is the use of JIT compiler?

JIT compiler is a part of the runtime execution environment.

74.What are different types of JIT?

Pre-JIT: Pre-JIT compiles complete source code into native code in a single compilation cycle. This is done at the time of deployment of the application.
Econo-JIT:. Econo-JIT compiles only those methods that are called at runtime.However, these compiled methods are removed when they are not required.
Normal-JIT: Normal-JIT compiles only those methods that are called at runtime. These methods are compiled the first time they are called, and then they are stored in cache. When the same methods are called again, the compiled code from cache is used for execution.

75. What is the role of the JIT compiler in .NET Framework?

The JIT compiler is an important element of CLR, which loads MSIL on target machine for execution.
The MSIL is stored in .NET assemblies after the developer has compiled the code written in any .NET-compliant programming language, such as Visual Basic and C#.
JIT compiler translates the MSIL code of an assembly and uses the CPU architecture of the target machine to execute a .NET application.

76.What is the difference between convert.to.string and .to.string() method?

Convert function handles nulls while i.string() does not it will throw a null reference exception error.

77.What namespace does the Web page belong in the .NET Framework class hierarchy?

System.Web.UI.Page

78. What is managed code?

Managed code is the code that is executed directly by the CLR. The applications created by using managed code automatically have CLR services, such as type checking, security, and automatic garbage collection.

79. What is the difference between Authentication and Authorization?

Authentication is the process of identifying users. Authentication is identifying/validating the user against the credentials (username and password) and Authorization performs after authentication. Authorization is the process of granting access to those users based on identity. Authorization allowing access of specific resource to user.

80. What are the types of Authentication?

There are two types of authentication are
Windows authentication
Forms authentication
Passport authentication

81.What is the differences between dataset.clone and dataset.copy?

Dataset.clone copies just the structure of dataset (including all the datatables, schemas, relations and constraints.); however it doesn’t copy the data.
Dataset.copy, copies both the dataset structure and the data.

82.How does CAS work?

The CAS security policy revolves around two key concepts – code groups and permissions. Each .NET assembly is a member of a particular code group, and each code group is granted the permissions specified in a named permission set.

83. What is serialization in .NET?

Serialization is the process of converting an object into a stream of bytes.

84. What does an assembly contain?

Manifest – The metadata describing the information below.
Assembly name – Aids in versioning and visibility scope.
Version information – The version number is integrated into the assembly’s identity.
Types – Boundaries and scopes of methods, classes, properties, events and attributes.
Locale – Information describing language/culture.
Cryptographic Hash – Public key encoded hash acting as version/security check.
Security Permissions – The permissions within the assembly determine the permissions that can be granted for all aspects of the assembly contents.

85. What is a Windows process?

Windows process is an application that’s running and had been allocated memory.

86. Can one DLL file contains the compiled code of more than one .NET language?

No, a DLL file can contain the compiled code of only one programming language.

87.What is the syntax to declare a namespace in .NET?

In C#, the namespace keyword is used to declare a namespace in the code. The syntax for declaring a namespace in C# is: namespace MyNamespace

88. How many languages .NET is supporting now?

When .Net was introduced it came with some 16 languages. VB.NET, C#, COBOL and PERL etc

89. What is the difference between the Debug class and Trace class?

Use Debug class for debug builds. Use Trace class for both debug and release builds.

90. What is the difference between Array and Arraylist?

An array is a collection of the same type. The size of the array is fixed in its declaration. A linked list is similar to an array but it doesn’t have a limited size.

91. What are methods?

A method represents a behavior of a class.Methods are the building blocks of a class, in which they are linked together to share and process data to produce the result.

92. What is a postback? and when is it used in ASP.NET Web forms?

A postback is the name for the page request that an ASP.NET page sends to itself when a Web control is activated, such as when users click a button. Most Web forms use the HTML form control, which allows users to submit data using HTTP Post requests.

93.Which method do you use to redirect the user to another page without performing a round trip to the client?

Server.transfer()

94.What is a Session and Application object?

Session object store information between HTTP requests for a particular user, while application object are global across users.

95. What method is used to bind data items to an ASP.NET Web control?

The DataBinder.Eval method binds data items to ASP.NET Web controls

96. How do you turn off cookies for one page in your site?

Use the Cookie.Discard Property which Gets or sets the discard flag set by the server. When true, this property instructs the client application not to save the Cookie on the user’s hard disk when a session ends.

97. Which namespace is needed to implement debug and trace?

Debug and trace class belongs to System.Diagnostic namespace.

98,What events does the HttpSession class support?

The HttpSession class supports the Load and Unload events.

99.Which two properties are on every validation control?

Control To Validate
ErrorMessage propertie

100. What is a bubbled event?

When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their event handlers, allowing the main DataGrid event handler to take care of its constituents.

101. What makes a Web page dynamic?

Program code that you write makes a Web page dynamic. Dynamic pages respond to user input and perform useful services.