.NET Interview Questions for freshers and experienced :-
1. What Is The Microsoft.net?
.NET is a set of technologies designed to transform the internet into a full scale distributed platform. It provides new ways of connecting systems, information and devices through a collection of web services.It also provides a language independent, consistent programming model across all tiers of an application.
The goal of the .NET platform is to simplify web development by providing all of the tools and technologies that one needs to build distributed web applications
2. What Is The .net Framework?
The .NET Framework is set of technologies that form an integral part of the .NET Platform. It is Microsoft’s managed code programming model for building applications that have visually stunning user experiences, seamless and secure communication, and the ability to model a range of business processes.
The .NET Framework has two main components: the common language runtime (CLR) and .NET Framework class library. The CLR is the foundation of the .NET framework and provides a common set of services for projects that act as building blocks to build up applications across all tiers. It simplifies development and provides a robust and simplified environment which provides common services to build application. The .NET framework class library is a collection of reusable types and exposes features of the runtime. It contains of a set of classes that is used to access common functionality
3. What Is Clr?
The .NET Framework provides a runtime environment called the Common Language Runtime or CLR. The CLR can be compared to the Java Virtual Machine or JVM in Java. CLR handles the execution of code and provides useful services for the implementation of the program. In addition to executing code, CLR provides services such as memory management, thread management, security management, code verification, compilation, and other system services. It enforces rules that in turn provide a robust and secure execution environment for .NET applications
4. What Is Cts?
Common Type System (CTS) describes the datatypes that can be used by managed code. CTS defines how these types are declared, used and managed in the runtime. It facilitates cross-language integration, type safety, and high performance code execution. The rules defined in CTS can be used to define your own classes and values.
5. What Is Cls?
Common Language Specification (CLS) defines the rules and standards to which languages must adhere to in order to be compatible with other .NET languages. This enables C# developers to inherit from classes defined in VB.NET or other .NET compatible languages
6. What Is Managed Code?
The .NET Framework provides a run-time environment called the Common Language Runtime, which manages the execution of code and provides services that make the development process easier. Compilers and tools expose the runtime’s functionality and enable you to write code that benefits from this managed execution environment. The code that runs within the common language runtime is called managed code
7. What Is Msil?
When the code is compiled, the compiler translates your code into Microsoft intermediate language (MSIL). The common language runtime includes a JIT compiler for converting this MSIL then to native code.
MSIL contains metadata that is the key to cross language interoperability. Since this metadata is standardized across all .NET languages, a program written in one language can understand the metadata and execute code, written in a different language.MSIL includes instructions for loading, storing,initializing, and calling methods on objects,as well as instructions for arithmetic and logical operations,control flow,direct memory access, exception handling, and other operations
8. What Is Jit?
JIT is a compiler that converts MSIL to native code. The native code consists of hardware specific instructions that can be executed by the CPU.
Rather than converting the entire MSIL (in a portable executable[PE]file) to native code, the JIT converts the MSIL as it is needed during execution. This converted native code is stored so that it is accessible for subsequent calls
9. What Is Portable Executable (pe)?
PE is the file format defining the structure that all executable files (EXE) and Dynamic Link Libraries (DLL) must use to allow them to be loaded and executed by Windows. PE is derived from the Microsoft Common Object File Format (COFF). The EXE and DLL files created using the .NET Framework obey the PE/COFF formats and also add additional header and data sections to the files that are only used by the CLR.
10. What Is An Application Domain?
Application domain is the boundary within which an application runs. A process can contain multiple application domains. Application domains provide an isolated environment to applications that is similar to the isolation provided by processes. An application running inside one application domain cannot directly access the code running inside another application domain. To access the code running in another application domain, an application needs to use a proxy
11. How Does An Appdomain Get Created?
AppDomains are usually created by hosts. Examples of hosts are the Windows Shell, ASP.NET and IE. When you run a .NET application from the command-line, the host is the Shell. The Shell creates a new AppDomain for every application. AppDomains can also be explicitly created by .NET applications
12. What Is An Assembly?
An assembly is a collection of one or more .exe or dll’s. An assembly is the fundamental unit for application development and deployment in the .NET Framework. An assembly contains a collection of types and resources that are built to work together and form a logical unit of functionality. An assembly provides the CLR with the information it needs to be aware of type implementations
13. What Are The Contents Of Assembly?
A static assembly can consist of four elements:
- Assembly manifest-Contains the assembly metadata. An assembly manifest contains the information about the identity and version of the assembly. It also contains the information required to resolve references to types and resources.
- Type metadata-Binary information that describes a program.
- Microsoft intermediate language(MSIL)code.
- A set of resources
14. What Are The Different Types Of Assembly?
Assemblies can also be private or shared. A private assembly is installed in the installation directory of an application and is accessible to that application only. On the other hand, a shared assembly is shared by multiple applications. A shared assembly has a strong name and is installed in the GAC.
We also have satellite assemblies that are often used to deploy language-specific resources for an application.
15. What Is A Dynamic Assembly?
A dynamic assembly is created dynamically at run time when an application requires the types within these assemblies
16. What Is A Strong Name?
You need to assign a strong name to an assembly to place it in the GAC and make it globally accessible. A strong name consists of a name that consists of an assembly’s identity (text name, version number, and culture information), a public key and a digital signature generated over the assembly. The .NET Framework provides a tool called the Strong Name Tool (Sn.exe), which allows verification and key pair and signature generation
17. What Is Gac? What Are The Steps To Create An Assembly And Add It To The Gac?
The global assembly cache (GAC) is a machine-wide code cache that stores assemblies specifically designated to be shared by several applications on the computer. You should share assemblies by installing them into the global assembly cache only when you need to.
Steps
- Create a strong name using sn.exe tool eg: sn -k mykey.snk
- in AssemblyInfo.cs, add the strong name eg: [assembly: AssemblyKeyFile(“mykey.snk”)]
- recompile project, and then install it to GAC in two ways:
drag & drop it to assembly folder (C:\WINDOWS\assembly OR C:\WINNT\assembly) (shfusion.dll tool)
gacutil -i abc.dll
18. What Is The Caspol.exe Tool Used For?
The caspol tool grants and modifies permissions to code groups at the user policy, machine policy, and enterprise policy levels.
19. What Is A Garbage Collector?
A garbage collector performs periodic checks on the managed heap to identify objects that are no longer required by the program and removes them from memory.
20. What Are Generations And How Are They Used By The Garbage Collector?
Generations are the division of objects on the managed heap used by the garbage collector. This mechanism allows the garbage collector to perform highly optimized garbage collection. The unreachable objects are placed in generation 0, the reachable objects are placed in generation 1, and the objects that survive the collection process are promoted to higher generations
21. What Is Ilasm.exe Used For?
Ilasm.exe is a tool that generates PE files from MSIL code. You can run the resulting executable to determine whether the MSIL code performs as expected.
22. What Is Ildasm.exe Used For?
Ildasm.exe is a tool that takes a PE file containing the MSIL code as a parameter and creates a text file that contains managed code.
23. What Is The Resgen.exe Tool Used For?
ResGen.exe is a tool that is used to convert resource files in the form of .txt or .resx files to common language runtime binary .resources files that can be compiled into satellite assemblies.
24. What Is Boxing And Unboxing?
- Boxing
Value type to object type. Allocates memory on Heap. - UnBoxing
Object type to value type. Allocates memory on Stack
25. How Can We Make A Thread Sleep For Infinite Period ?
You can also place a thread into the sleep state for an indeterminate amount of time by calling Thread.Sleep (System.Threading.Timeout.Infinite). To interrupt this sleep you can call the Thread.Interrupt method
26. In Which Format You Can Pass The Value In The Sleep Function?
In milliseconds
27. What’s Thread.sleep() In Threading ?
Thread’s execution can be paused by calling the Thread.Sleep method. This method takes an integer value that determines how long the thread should sleep. Example Thread.CurrentThread.Sleep(2000). it will paused for 2 second.
28. How Can You Reference Current Thread Of The Method ?
“Thread.CurrentThread” refers to the current thread running in the method.”CurrentThread” is a public static property.
29. What Does Addressof Operator Do In Background ?
The AddressOf operator creates a delegate object to the BackgroundProcess method. A delegate within VB.NET is a type-safe, object-oriented function pointer. After the thread has been instantiated, you begin the execution of the code by calling the Start() method of the thread
30. Different Levels Of Priority Provided By .net.
i)ThreadPriority.Highest
ii)ThreadPriority.AboveNormal
iii)ThreadPriority.Normal
iv)ThreadPriority.BelowNormal
v)ThreadPriority.Lowest
31. Is There Any Thread In Our .net Programs?
.NET program always has at least two threads running one is the main program and second is the garbage collector.
32. Namespace For The Thread Class?
All threading classes are defined in System.Threading namespace
33. Can We Have Multiple Threads In One App Domain ?
One or more threads run in an AppDomain. An AppDomain is a runtime representation of a logical process within a physical process. Each AppDomain is started with a single thread, but can create additional threads from any of its threads.
34. Did Vb6 Support Multi-threading ?
While VB6 supports multiple single-threaded apartments, it does not support a freethreading model, which allows multiple threads to run against the same set of data.
35. What Is A Thread ?
A thread is the basic unit to which the operating system allocates processor time
36. What Is Multi-threading ?
Multi-threading forms subset of Multi-tasking. Instead of having to switch between programs this feature switches between different parts of the same program. Example you are writing in word and at the same time word is doing a spell check in background.
37. What Is Multi-tasking ?
It’s a feature of modern operating systems with which we can run multiple programs at same time example Word, Excel etc.
38. What Is Equivalent For Regsvr32 Exe In .net ?
Regasm
39. How Do We Create Dcom Object In Vb6?
Using the CreateObject method you can create a DCOM object. You have to put the server name in the registry.
40. Can You Explain What Is Dcom ?
DCOM differs from COM in that it allows for creating objects distributed across a network, a protocol for invoking that object’s methods, and secures access to the object. DCOM provides a wrapper around COM, hence it is a backwards compatible extension. DCOM uses Remote Procedural Calls (RPC) using Open Software Foundation’s Distributed Computing Environment.
41. What Is Satellite Assembly? And Steps To Create Satellite Assembly?
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.
Steps to Create Satellite Assembly
a. Set the paths for resgen and al.exe:
b. Create a .resources file.
c. Create the satellite assembly.
d. The assembly should have the naming convention for .NET to be able to search for it.
e. Specify the settings for culture.
f. Put the satellite assembly in the appropriate folder.
g. Once the satellite assembly is created, physically copy it to the appropriate directory.
h. Repeat the process for each language in which you are creating an assembly.
42. How To Exclude A Property From Xml Serialization?
[XmlIgnore]
(use attribute on the property)
Eg:
[XmlIgnore]
public string Name
{
..
}
43. What Is Garbage Collector ?
Garbage collection consists of the following steps:
- The garbage collector searches for managed objects that are referenced in managed code.
- The garbage collector attempts to finalize objects that are not referenced.
- The garbage collector frees objects that are not referenced and reclaims their memory.
44. What Is Difference Between Code Access And Role Based Security?
Code security is the approach of using permissions and permission sets for a given code to run. The admin, for example, can disable running executables off the Internet or restrict access to corporate database to only few applications.
Role security most of the time involves the code running with the privileges of the current user. This way the code cannot supposedly do more harm than mess up a single user account.
Neither is better. It depends on the nature of the application; both code-based and role-based security could be implemented to an extent.
45. What Is Cas?
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.
See CAS objects — Run ‘caspol -lg’ from command line.
Add CAS objects — caspol -ag 1.3
Change CAS obj — caspol -cg 1.3 FullTrust
Turn Off — caspol -s off
46. Can We Customize The Serialization Process?
Yes. XmlSerializer supports a range of attributes that can be used to configure serialization for a particular class. For example, a field or property can be marked with the [XmlIgnore] attribute to exclude it from serialization. Another example is the [XmlElement] attribute, which can be used to specify the XML element name to be used for a particular property or field.
Serialization via SoapFormatter/BinaryFormatter can also be controlled to some extent by attributes. For example, the [NonSerialized] attribute is the equivalent of XmlSerializer’s [XmlIgnore] attribute. Ultimate control of the serialization process can be acheived by implementing the the ISerializable interface on the class whose instances are to be serialized.
47. Types Of Serialization
1. Binary Serialization – preserves type fidelity, which is useful for preserving the state of an object between different invocations of an application.
2. XML Serialization – serializes only public properties and fields and does not preserve type fidelity. This is useful when you want to provide or consume data without restricting the application that uses the data.
48. What Is Serialization?
It is the process of storing the state of an object to a storage medium. During this process, the public and private fields of the object and the name of the class, including the assembly containing the class, are converted to a stream of bytes, which is then written to a data stream. When the object is subsequently de-serialized, an exact clone of the original object is created.
- used to save session state in ASP.NET.
- Copy objects to the Clipboard in Windows Forms
- Remoting to pass objects by value from one application domain to another.
49. What Is Namespace?
It is a logical naming scheme for types in which a simple type name, such as MyType, is preceded with a dot-separated hierarchical name. Such a naming scheme is completely under control of the developer. This concept is not related to that of an assembly.
50. What Is Gac? How To Put Assembly In Gac?
The global assembly cache stores assemblies specifically designated to be shared by several applications on the computer. You should share assemblies by installing them into the global assembly cache only when you need to. Assemblies deployed in the global assembly cache must have a strong name. When an assembly is added to the global assembly cache, integrity checks are performed on all files that make up the assembly. The cache performs these integrity checks to ensure that an assembly has not been tampered with, for example, when a file has changed but the manifest does not reflect the change. Use a developer tool called the Global Assembly Cache tool (Gacutil.exe), provided by the .NET Framework SDK or Use Windows Explorer to drag assemblies into the cache. To install a strong-named assembly into the global assembly cache At the command prompt, type the following command: gacutil I In this command, assembly name is the name of the assembly to install in the global assembly cache.
51. What Is An Assembly Loader?
- Checks if the assembly is Strongly signed.
- If yes it will search in the GAC
- Loader will search the policy file name in the format of Policy. Assembly Major Version .Assembly Minor Version .Assembly Name
Eg. MyPolicy.1.2.Assembly1
- If such a file exists it will look inside of it if the version of the assembly that we are trying to load matches the version/versions range written in the policy file. If it does, it will try to load the assembly with the version specified there. If no such policy file exists, it will try to load the assembly from the GAC.
- If it will fail to find it in the GAC, it will start to search in the system’s search path.
- In web applications it will also include the application’s Bin directory in the search path.
52. What Is An Assembly Qualified Name
An assembly qualified name isn’t the filename of the assembly; it’s the internal name of the assembly combined with the assembly version, culture, and public key, thus making it unique.
Example:
(“”System .Xml .Xml Document, System .Xml, Version =1.0.3300.0, Culture =neutral, PublicKey Token = b77 a5c561934 e089″”)
53. What Is Partial Assembly Reference
We can dynamically reference an assembly by providing only partial information, such as specifying only the assembly name. When you specify a partial assembly reference, the runtime looks for the assembly only in the application directory.
We can make partial references to an assembly in your code one of the following ways:
-> Use a method such as System.Reflection.Assembly.Load and specify only a partial reference. The runtime checks for the assembly in the application directory.
-> Use the System.Reflection.Assembly.LoadWithPartialName method and specify only a partial reference. The runtime checks for the assembly in the application directory and in the global assembly cache.
54. What Is Full Assembly Reference
A full assembly reference includes the assembly’s text name, version, culture, and public key token (if the assembly has a strong name). A full assembly reference is required if you reference any assembly that is part of the common language runtime or any assembly located in the global assembly cache.
55. What Are The Contents Of An Assembly ?
- Type metadata.
- The assembly manifest, which contains assembly metadata.
- Microsoft intermediate language (MSIL) code that implements the types.
- A set of resources
56. What Are The Types Of Assembly Available
- Private-The assembly is intended only for one application
- Shared-If the assembly is to be made into a Shared Assembly
- Static-These are the .NET PE files that you create at compile time.
- Dynamic-These are PE-formatted, in-memory assemblies
57. What Are Attributes?
Attributes are declarative tags in code that insert additional metadata into an assembly. There exist two types of attributes in the .NET Framework: Predefined attributes such as Assembly Version, which already exist and are accessed through the Runtime Classes; and custom attributes, which you write yourself by extending the System.Attribute class.
Example-Custom Attribute for entire assembly
1.using System;
2.[assembly : MyAttributeClass] class X {}
58. What Is Manifest?
An assembly manifest contains all the metadata needed to specify the assembly’s version requirements and security identity, and all metadata needed to define the scope of the assembly and resolve references to resources and classes. The assembly manifest can be stored in either a PE (Portable Executable) file (an .exe or .dll) with Microsoft intermediate language (MSIL) code or in a standalone PE (Portable Executable) file that contains only assembly manifest information.
59. What Is Jit Compiler
It is a compiler which converts MS IL code to Native Code (ie.. CPU-specific code that runs on the same computer architecture). Just-In-Time compiler- it converts the language that you write in .Net into machine language that a computer can understand.
60. What Debugging Tools Come With The .net Sdk?
1.CorDBG – command-line debugger. To use CorDbg, you must compile the original C# file using the /debug switch.
2.DbgCLR – graphic debugger. Visual Studio .NET uses the DbgCLR
61. What’s The .net Collection Class That Allows An Element To Be Accessed Using A Unique Key?
HashTable.
62. What Is Cls?
It is the collection of the rules and constraints that every language (that seeks to achieve .NET compatibility) must follow. It is a subsection of CTS and it specifies how it shares and extends one another libraries.
63. What Is Clr?
It is the runtime that converts a MSIL code into the host machine language code, which is then executed appropriately. It is the execution engine for .NET Frameworkapplications. It provides a number of services, including:
- Code management (loading and execution)
- Application memory isolation
- Verification of type safety
- Conversion of IL to native code.
- Access to metadata (enhanced type information)
- Managing memory for managed objects
- Enforcement of code access security
- Exception handling, including cross-language exceptions
- Interoperation between managed code, COM objects, and pre-existing DLL’s (unmanaged code and data)
- Automation of object layout
- Support for developer services (profiling, debugging, and so on}.
64. What Is Dependency Injection?
It is the mechanism through with dynamic capabilities are added in the runtime. Most of the time it would be through proxy classes.
Some frameworks in this regard are:
Spring.Net, NInject, Enterprise Library Policy Injection etc.
65. Can You Describe Iuknown Interface In Short?
Every COM object supports at least one interface, the IUnknown interface.
All interfaces are classes derived from the base class IUnknown. Each interface supports methods access data and perform operations transparently to the programmer.
For example, IUnknown supports three methods, AddRef, Release(), and QueryInterface().
Suppose that pinterf is a pointer to an IUnknown.
pinterf->AddRef() increments the reference count. pinterf->Release() decrements the reference count, deleting the object when the reference count reaches zero.
pinterf->QueryInterface( IDesired,pDesired) checks to see if the current interface (IUnknown) supports another interface, IDesired, creates an instance (via a call to CoCreateInstance()) of the object if the reference count is zero (the object does not yet exist), and then calls pDesired->AddRef() to increment the reference count(where pDesired is a pointer to IDesired) and returns the pointer to the caller.
66. What Is Reference Counting In Com?
Reference counting is a memory management technique used to count how many times an object has a pointer referring to it. The first time it is created, the reference count is set to one. When the last reference to the object is nulled, the reference count is set to zero and the object is deleted.
Care must be exercised to prevent a context switch from changing the reference count at the time of deletion. In the methods that follow, the syntax is shortened to keep the scope of the discussion brief and manageable.
67. What Is Com?
Microsoft’s COM is a technology for component software development. It is a binary standard which is language independent. DCOM is a distributed extension of COM.
68. When We Use Windows Api In .net Is It Managed Or Unmanaged Code?
Windows API in .NET is unmanaged code
69. Once I Have Developed The Com Wrapper Do I Have To Still Register The Com In Registry?
Yes
70. In Which Order The Destructor Is Called For An Inherited Class?
Child class destructor is called first
71. In Which Order The Constructor Is Called For An Inherited Class?
Constructor of Parent class is called
Then,
Constructor of Child class
72. What Are Value Types And Reference Types ?
Value types directly contain their data which are either allocated on the stack or allocated in-line in a structure.
Reference types store a reference to the value’s memory address, and are allocated on the heap.
Reference types can be self-describing types, pointer types, or interface types.
Variables that are value types each have their own copy of the data, and therefore operations on one variable do not affect other variables. Variables that are reference types can refer to the same object; therefore, operations on one variable can affect the same object referred to by another variable. All types derive from the System.Object base type.
73. What Is The Difference Between Viewstate And Sessionstate?
ViewState persist the values of controls of particular page in the client (browser) when post back operation done. When user requests another page previous page data no longer available.
SessionState persist the data of particular user in the server. This data available till user close the browser or session time completes.
ViewState Relate to Controls, it means when Client send request in the form of Controls’ value to server,In case any validation problem relating to Clients data then the entire data is not cleaned as it was occur is asp,it can restore the existing data in the form of hidden control and render data by server to respective controls,as a result user will not enter the complete information again, where as SessionState relates to individual user,it manages the user related information and maintain the session between client ans server.
74. Difference Between Machine.config And Web.config?
Machine.config->Configuration file for all the applications in the system.
Web.config->Config file for single application.
75. How Is .net Able To Support Multiple Languages?
a language should comply with the Common Language Runtime standard to become a .NET language. In .NET, code is compiled to Microsoft Intermediate Language (MSIL for short). This is called as Managed Code. This Managed code is run in .NET environment. So after compilation to this IL the language is not a barrier. A code can call or use a function written in another language.
76. What Is View State?
The web is stateless. But in ASP.NET, the state of a page is maintained in the page itself automatically. The values are encrypted and saved in hidden controls. this is done automatically by the ASP.NET. This can be switched off / on for a single control.
77. Can The Validation Be Done In The Server Side? Or This Can Be Done Only In The Client Side?
Client side is done by default. Server side validation is also possible. We can switch off the client side and server side can be done.
78. How To Manage Pagination In A Page?
Using pagination option in DataGrid control. We have to set the number of records for a page, then it takes care of pagination by itself.
79. What Is Ado .net And What Is Difference Between Ado And Ado.net?
ADO.NET is stateless mechanism. I can treat the ADO.Net as a separate in-memory database where in I can use relationships between the tables and select insert and updates to the database. I can update the actual database as a batch.
80. How To Get The Sum Of Last 3 Items In A List Using Lambda Expressions?
Use
int sum = list.Reverse().Take(3).Sum();
81. You Have Got 1 Million Parking Slots. At A Time A Parking Slot Can Be Free Or Not. To Get Next Slot Easily Which Data Structure To Implement?
Use Stack.
If you use Stack, we can just get the next slot by using stack.Pop()
If you use List, we have to iterate through all list and check the status and retrieve. So stack would be advantageous.
82. Why Can’t Struct Be Used Instead Of Class For Storing Entity?
Struct is of value type. If we pass it across methods in layers, a new object will be created in the stack thus increasing memory and processing requirement.
So class should be used for creating entity like Employee, Supplier etc.
83. What Is Assembly Version Series Sequence?
major.minor.build.revision
84. What Tool We Have To Use To Install Assembli In Gac Folder.
we can use GACUTIL Tool to intall assemby in GAC folder
85. Ho We Can See Assembly Information?
We can see the assembly information using ILDASM Tool.
86. What Is Private And Shared Assembly?
The assembly which is used only by a single application is called as private assembly. Thus the assembly is private to your application.Suppose that you are creating a general purpose DLL which provides functionality which will be used by variety of applications. Now, instead of each client application having its own copy of DLL you can place the DLL in ‘global assembly cache’. Such assemblies are called as shared assemblies.
87. What Is Type Safety?
Type safe code can access only the memory locations that it has permission to execute. Type safe code can never access any private members of an object. Type safe code ensures that objects are isolated from each other.
88. What Is The Difference Between Datareader And Dataadapter?
1. Data Reader is read only forward only and much faster than DataAdapter.
2. If you use DataReader you have to open and close connection explicitly where as if you use DataAdapter the connection is automatically opened and closed.
3. DataReader is connection oriented where as Data Adapter is disconnected
89. What Is Func In .net 3.5?
Func is a delegate in .Net that returns a value.
The return type is specified using the TResult argument.
There are 5 versions of Func in .Net.
Func Func<T,TResult>
Func<T1,T2,TResult>
Func<T1,T2,T3,TResult>
Func<T1,T2,T3,T4,TResult>
90. What Is Action In C# 3.5?
Action is a built-in delegate which returns void.
There are 5 versions of Action
Action Action
Action<T1,T2>
Action<T1,T2,T3>
Action<T1,T2,T3,T4>
91. What Is The Advantage Of Mvc?
More Manageability, Multiple View Support, More unit testing compatibility.
92. Advantages Of Vb.net And C#
Advantages VB.NET :-
- Has support for optional parameters which makes COM interoperability much easy.
- With Option Strict off late binding is supported.Legacy VB functionalities can be used by using Microsoft.VisualBasic namespace.
- Has the WITH construct which is not in C#.
- The VB.NET part of Visual Studio .NET compiles your code in the background.
While this is considered an advantage for small projects, people creating very large projects have found that the IDE slows down considerably as the project gets larger.
Advantages of C#
- XML documentation is generated from source code but this is now been incorporated in Whidbey.
- Operator overloading which is not in current VB.NET but is been introduced in Whidbey.
- The using statement, which makes unmanaged resource disposal simple.
- Access to Unsafe code. This allows pointer arithmetic etc, and can improve performance in some situations. However, it is not to be used lightly, as a lot of the normal safety of C# is lost (as the name implies).This is the major difference that you can access unmanaged code in C# and not in VB.NET
93. What Is Garbage Collection?
Garbage collection is a CLR feature which automatically manages memory. Programmers forget to release the objects while coding. CLR automatically releases objects when they are no longer referenced and in use. CLR runs on non-deterministic to see the unused objects and cleans them. One side effect of this non-deterministic feature is that we cannot assume an object is destroyed when it goes out of the scope of a function. Therefore, we should not put code into a class destructor to release resources.
94. How Many Types Of Stored Procedures Are There In Sql Server?
1.User Defined Stored Procedures.
a.Transact-SQL stored procedure
b.CLR Stored Procedure.
2.System Stored Procedures
95. What Is The Purpose Of Linked Server Configuration In Sql Server?
It enabled us to query remote database servers of different providers.
Thus we can copy or select table data between multiple servers.
96. What Is Difference Between Tostring() Vs Convert.tostring() Vs (string) Cast
There is a simple but important difference between these three.
ToString() raise exception when the object is null
So in the case of object.ToString(), if object is null, it raise NullReferenceException.
Convert.ToString() return string.Empty in case of null object
(string) cast assign the object in case of null
So in case of
MyObject o = (string)NullObject;
But when you use o to access any property, it will raise NullReferenceException.
97. In How Many Ways You Can Invoke Ssrs Reports?
you can invoke it in 3 ways.
- Using rs script and command Prompt
- From web browser.
- Using SOAP API
98. What Is A Static Constructor?
A Static Constructor of a class gets initialised and invoked when the assembly loads itself.
99. Why Do I Get Errors When I Try To Serialize A Hashtable?
XmlSerializer will refuse to serialize instances of any class that implements IDictionary, e.g. Hashtable. SoapFormatter and BinaryFormatter do not have this restriction.
100. Why Is Xmlserializer So Slow?
There is a once-per-process-per-type overhead with XmlSerializer. So the first time you serialize or deserialize an object of a given type in an application, there is a significant delay. This normally doesn’t matter, but it may mean, for example, that XmlSerializer is a poor choice for loading configuration settings during startup of a GUI application.
101. Can I Customise The Serialization Process?
Yes. XmlSerializer supports a range of attributes that can be used to configure serialization for a particular class. For example, a field or property can be marked with the [XmlIgnore] attribute to exclude it from serialization. Another example is the [XmlElement] attribute, which can be used to specify the XML element name to be used for a particular property or field. Serialization via SoapFormatter/BinaryFormatter can also be controlled to some extent by attributes. For example, the [NonSerialized] attribute is the equivalent of XmlSerializer’s [XmlIgnore] attribute. Ultimate control of the serialization process can be acheived by implementing the the ISerializable interface on the class whose instances are to be serialized.
102. Does The .net Framework Have In-built Support For Serialization?
There are two separate mechanisms provided by the .NET class library-XmlSerializer and SoapFormatter/BinaryFormatter. Microsoft uses XmlSerializer for Web Services, and uses
SoapFormatter/BinaryFormatter for remoting. Both are available for use in your own code
103. Is The Lack Of Deterministic Destruction In .net A Problem?
It’s certainly an issue that affects component design. If you have objects that maintain expensive or scarce resources (e.g. database locks), you need to provide some way for the client to tell the object to release the resource when it is done. Microsoft recommend that you provide a method called Dispose() for this purpose. However, this causes problems for distributed objects – in a distributed system who calls the Dispose() method? Some form of reference-counting or ownership-management mechanism is needed to handle distributed objects – unfortunately the runtime offers no help with this
104. Why Doesn’t The .net Runtime Offer Deterministic Destruction?
Because of the garbage collection algorithm. The .NET garbage collector works by periodically running through a list of all the objects that are currently being referenced by an application. All the objects that it doesn’t find during this search are ready to be destroyed and the memory reclaimed. The implication of this algorithm is that the runtime doesn’t get notified immediately when the final reference on an object goes away – it only finds out during the next sweep of the heap.
Futhermore, this type of algorithm works best by performing the garbage collection sweep as rarely as possible. Normally heap exhaustion is the trigger for a collection sweep.
105. How Does Assembly Versioning Work?
Each assembly has a version number called the compatibility version. Also each reference to an assembly (from another assembly) includes both the name and version of the referenced assembly.The version number has four numeric parts (e.g. 5.5.2.33). Assemblies with either of the first two parts different are normally viewed as incompatible. If the first two parts are the same, but the third is different, the assemblies are deemed as ‘maybe compatible’. If only the fourth part is different, the assemblies are deemed compatible. However, this is just the default guideline – it is the version policy that decides to what extent these rules are enforced. The version policy can be specified via the application configuration
106. How Do Assemblies Find Each Other?
By searching directory paths. There are several factors which can affect the path (such as the AppDomain host, and application configuration files), but for private assemblies the search path is normally the application’s directory and its sub-directories. For shared assemblies, the search path is normally same as the private assembly path plus the shared assembly cache.
107. Where Is The Output Of Textwritertracelistener Redirected?
To the Console or a text file depending on the parameter passed to the constructor.
108. Why Are There Five Tracing Levels In System.diagnostics.traceswitcher?
The tracing dumps can be quite verbose. For applications that are constantly running you run the risk of overloading the machine and the hard drive. Five levels range from None to Verbose, allowing you to fine-tune the tracing activities.
109. What’s The Difference Between The Debug Class And Trace Class?
Documentation looks the same. Use Debug class for debug builds, use Trace class for both debug and release builds.
110. What Does Assert() Method Do?
In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true.
111. Why String Are Called Immutable Data Type ?
The memory representation of string is an Array of Characters, So on re-assigning the new array of Char is formed & the start address is changed . Thus keeping the Old string in Memory for Garbage Collector to be disposed.
112. What Is Side-by-side Execution? Can Two Application One Using Private Assembly And Other Using Shared Assembly Be Stated As A Side-by-side Executables?
Side-by-side execution is the ability to run multiple versions of an application or component on the same computer. You can have multiple versions of the common language runtime, and multiple versions of applications and components that use a version of the runtime, on the same computer at the same time. Since versioning is only applied to shared assemblies, and not to private assemblies, two application one using private assembly and one using shared assembly cannot be stated as side-by-side executables,
113. Changes To Which Portion Of Version Number Indicates An Incompatible Change?
Major or minor. Changes to the major or minor portion of the version number indicate an incompatible change. Under this convention then, version 2.0.0.0 would be considered incompatible with version 1.0.0.0. Examples of an incompatible change would be a change to the types of some method parameters or the removal of a type or method altogether. Build. The Build number is typically used to distinguish between daily builds or smaller compatible releases. Revision. Changes to the revision number are typically reserved for an incremental build needed to fix a particular bug. You’ll sometimes hear this referred to as the “emergency bug fix” number in that the revision is what is often changed when a fix to a specific bug is shipped to a customer.
114. What Is Partial Assembly References?
Full Assembly reference: A full assembly reference includes the assembly’s text name, version, culture, and public key token (if the assembly has a strong name). A full assembly reference is required if you reference any assembly that is part of the common language runtime or any assembly located in the global assembly cache.
Partial Assembly reference: We can dynamically reference an assembly by providing only partial information, such as specifying only the assembly name. When you specify a partial assembly reference, the runtime looks for the assembly only in the application directory.
We can make partial references to an assembly in your code one of the following ways:
-> Use a method such as System.Reflection.Assembly.Load and specify only a partial reference. The runtime checks for the assembly in the application directory.
-> Use the System.Reflection.Assembly.LoadWithPartialName method and specify only a partial reference. The runtime checks for the assembly in the application directory and in the global assembly cache
115. What Is The Difference Between Finalize And Dispose (garbage Collection) ?
Class instances often encapsulate control over resources that are not managed by the runtime, such as window handles (HWND), database connections, and so on. Therefore, you should provide both an explicit and an implicit way to free those resources. Provide implicit control by implementing the protected Finalize Method on an object (destructor syntax in C# and the Managed Extensions for C++). The garbage collector calls this method at some point after there are no longer any valid references to the object. In some cases, you might want to provide programmers using an object with the ability to explicitly release these external resources before the garbage collector frees the object. If an external resource is scarce or expensive, better performance can be achieved if the programmer explicitly releases resources when they are no longer being used. To provide explicit control, implement the Dispose method provided by the IDisposable Interface. The consumer of the object should call this method when it is done using the object.
Dispose can be called even if other references to the object are alive. Note that even when you provide explicit control by way of Dispose, you should provide implicit cleanup using the Finalize method. Finalize provides a backup to prevent resources from permanently leaking if the programmer fails to call Dispose.
116. What Is Reflection?
All .NET compilers produce metadata about the types defined in the modules they produce. This metadata is packaged along with the module (modules in turn are packaged together in assemblies), and can be accessed by a mechanism called reflection. The System.Reflection namespace contains classes that can be used to interrogate the types for a module/assembly.
Using reflection to access .NET metadata is very similar to using ITypeLib/ITypeInfo to access type library data in COM, and it is used for similar purposes – e.g. determining data type sizes for marshaling data across context/process/machine boundaries. Reflection can also be used to dynamically invoke methods (see System.Type.Invoke Member), or even create types dynamically at run-time. (see System. Reflection. Emit.Type Builder).
117. What Does ‘managed’ Mean In The .net Context?
The term ‘managed’ is the cause of much confusion. It is used in various places within .NET, meaning slightly different things.Managed code: The .NET framework provides several core run-time services to the programs that run within it – for example exception handling and security.
For these services to work, the code must provide a minimum level of information to the runtime.
Such code is called managed code. All C# and Visual Basic.NET code is managed by default. VS7 C++ code is not managed by default, but the compiler can produce managed code by specifying a command-line switch (/com+).
Managed data: This is data that is allocated and de-allocated by the .NET runtime’s garbage collector. C# and VB.NET data is always managed. VS7 C++ data is unmanaged by default, even when using the /com+ switch, but it can be marked as managed using the __gc keyword.Managed classes: This is usually referred to in the context of Managed Extensions (ME) for C++. When using ME C++, a class can be marked with the __gc keyword. As the name suggests, this means that the memory for instances of the class is managed by the garbage collector, but it also means more than that. The class becomes a fully paid-up member of the .NET community with the benefits and restrictions that brings. An example of a benefit is proper interop with classes written in other languages – for example, a managed C++ class can inherit from a VB class. An example of a restriction is that a managed class can only inherit from one base class.
118. What Platforms Does The .net Framework Run On?
The runtime supports Windows XP, Windows 2000, NT4 SP6a and Windows ME/98. Windows 95 is not supported. Some parts of the framework do not work on all platforms – for example, ASP.NET is only supported on Windows XP and Windows 2000. Windows 98/ME cannot be used for development.
IIS is not supported on Windows XP Home Edition, and so cannot be used to host ASP.NET. However, the ASP.NET Web Matrix web server does run on XP Home.
The Mono project is attempting to implement the .NET framework on Linux.
119. When Was The First Version Of .net Released?
The final version of the 1.0 SDK and runtime was made publicly available around 6pm PST on 15-Jan-2002. At the same time, the final version of Visual Studio.NET was made available to MSDN subscribers.
120. When Was .net Announced?
Bill Gates delivered a keynote at Forum 2000, held June 22, 2000, outlining the .NET ‘vision’. The July 2000 PDC had a number of sessions on .NET technology, and delegates were given CDs containing a pre-release version of the .NET framework/SDK and Visual Studio.NET.
121. What Is .net Remoting?
Netremoting replaces DCOM. Web Services that uses remoting can run in anyApplication type i.e. Console Application, Windows Form Applications,Window Services etc. In CLR Object Remoting we can call objectsacross network.
122. How Do You Generate A Strong Name?
.NET provides an utility called strong name tool. You can run this toolfrom the VS.NET command prompt to generate a strong name with an option “-k” and providing the strong key file name. i.e. sn- -k < file-name >
123. What Is The Gac? What Problem Does It Solve?
Each computer where the common language runtime is installed has a machine-wide code cache called the global assembly cache. The global assembly cache stores assemblies that are to be shared by several applications on the computer. This area is typically the folder under windows or winnt in the machine.
All the assemblies that need to be shared across applications need to be done through the Global assembly Cache only. However it is not necessary to install assemblies into the global assembly cache to make them accessible to COM interop or unmanaged code.
There are several ways to deploy an assembly into the global assembly cache:
Use an installer designed to work with the global assembly cache. This is the preferred option for installing assemblies into the global assembly cache.
Use a developer tool called the Global Assembly Cache tool (Gacutil.exe), provided by the .NET Framework SDK.
Use Windows Explorer to drag assemblies into the cache.
GAC solves the problem of DLL Hell and DLL versioning. Unlike earlier situations, GAC can hold two assemblies of the same name but different version. This ensures that the applications which access a particular assembly continue to access the same assembly even if another version of that assembly is installed on that machine.
124. What Is Strong-typing Versus Weak-typing? Which Is Preferred? Why?
Strong typing implies that the types of variables involved in operations are associated to the variable, checked at compile-time, and require explicit conversion; weak typing implies that they are associated to the value, checked at run-time, and are implicitly converted as required. (Which is preferred is a disputable point, but I personally prefer strong typing because I like my errors to be found as soon as possible.)
125. What Is The Difference Between An Exe And A Dll?
- You can create an objects of Dll but not of the EXE.
- Dll is an In-Process Component whereas EXE is an OUt-Process Component.
- Exe is for single use whereas you can use Dll for multiple use.
- Exe can be started as standalone where dll cannot be.
126. Describe The Advantages Of Writing A Managed Code Application Instead Of Unmanaged One. What’s Involved In Certain Piece Of Code Being Managed?
“Advantage includes automatic garbage collection,memory management,security,type checking,versioning Managed code is compiled for the .NET run-time environment. It runs in the Common Language Runtime (CLR), which is the heart of the .NET Framework. The CLR provides services such as security,memory management, and cross-language integration. Managed applications written to take advantage of the features of the CLR perform more efficiently and safely, and take better advantage of developers existing expertise in languages that support the .NET Framework.
Unmanaged code includes all code written before the .NET Framework was introduced-this includes code written to use COM, native Win32, and Visual Basic 6. Because it does not run inside the .NET environment, unmanaged code cannot make use of any .NET managed facilities.”
127. What Is Public Or Shared Assemblies ?
These are static assemblies that must have a unique shared name and can be used by any application.
An application uses a private assembly by referring to the assembly using a static path or through an XML-based application configuration file. While the CLR doesn’t enforce versioning policies-checking whether the correct version is used-for private assemblies, it ensures that an application uses the correct shared assemblies with which the application was built. Thus, an application uses a specific shared assembly by referring to the specific shared assembly, and the CLR ensures that the correct version is loaded at runtime.
128. What Is Metadata?
Metadata is machine-readable information about a resource, or “”data about data.”” Such information might include details on content, format, size, or other characteristics of a data source. In .NET, metadata includes type definitions, version information, external assembly references, and other standardized information.
129. What Are The Mobile Devices Supported By .net Platform
The Microsoft .NET Compact Framework is designed to run on mobile devices such as mobile phones, Personal Digital Assistants (PDAs), and embedded devices. The easiest way to develop and test a Smart Device Application is to use an emulator.
These devices are divided into two main divisions:
- Those that are directly supported by .NET (Pocket PCs, i-Mode phones, and WAP devices)
- Those that are not (Palm OS and J2ME-powered devices).
130. Can You Declare The Override Method Static While The Original Method Is Non-static?
No, you can’t, the signature of the virtual method must remain the same, only the keyword virtual is changed to keyword override.
131. What Is Boxing And Unboxing ?
Boxing:
The conversion of a value type instance to an object, which implies that the instance will carry full type information at run time and will be allocated in the heap. The Microsoft intermediate language (MSIL) instruction set’s box instruction converts a value type to an object by making a copy of the value type and embedding it in a newly allocated object.
Un-Boxing:
The conversion of an object instance to a value type.
132. What Is Msil, Il, Cts And, Clr ?
MSIL: (Microsoft intermediate language):
When compiling to managed code, the compiler translates your source code into Microsoft intermediate language (MSIL), which is a CPU-independent set of instructions that can be efficiently converted to native code. MSIL includes instructions for loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations. Before code can be executed, MSIL must be converted to CPU-specific code, usually by a just-in-time (JIT) compiler. Because the common language runtime supplies one or more JIT compilers for each computer architecture it supports, the same set of MSIL can be JIT-compiled and executed on any supported architecture.
When a compiler produces MSIL, it also produces metadata. Metadata describes the types in your code, including the definition of each type, the signatures of each type’s members, the members that your code references, and other data that the runtime uses at execution time. The MSIL and metadata are contained in a portable executable (PE) file that is based on and extends the published Microsoft PE and Common Object File Format (COFF) used historically for executable content. This file format, which accommodates
MSIL or native code as well as metadata, enables the operating system to recognize common language runtime images. The presence of metadata in the file along with the MSIL enables your code to describe itself, which means that there is no need for type libraries or Interface Definition Language (IDL). The runtime locates and extracts the metadata from the file as needed during execution.
IL: (Intermediate Language):
A language used as the output of a number of compilers and as the input to a just-in-time (JIT) compiler. The common language runtime includes a JIT compiler for converting MSIL to native code.
CTS: (Common Type System):
The specification that determines how the common language runtime defines, uses, and manages types
CLR: (Common Language Runtime):
The engine at the core of managed code execution. The runtime supplies managed code with services such as cross-language integration, code access security, object lifetime management, and debugging and profiling support.
133. What Is Gc (garbage Collection) And How It Works
One of the good features of the CLR is Garbage Collection, which runs in the background collecting unused object references, freeing us from having to ensure we always destroy them. In reality the time difference between you releasing the object instance and it being garbage collected is likely to be very small, since the GC is always running.
[The process of transitively tracing through all pointers to actively used objects in order to locate all objects that can be referenced, and then arranging to reuse any heap memory that was not found during this trace. The common language runtime garbage collector also compacts the memory that is in use to reduce the working space needed for the heap.]
Heap:
A portion of memory reserved for a program to use for the temporary storage of data structures whose existence or size cannot be determined until the program is running.
134. How Do I Unload An Application Domain?
You should use the following static method in the System.AppDomain
class:
public static void Unload(AppDomain domain)
The Unload method gracefully shuts down the specified application domain. During shutdown no new threads are allowed to enter the application domain and all application domain specific data structures are freed. You cannot unload an application domain in a finalizer or destructor.
If the application domain has run code from a domain-neutral assembly, the domains copy of the statics and related CLR data structures are freed, but the code for the domain-neutral assembly remains until the process is shutdown. There is no mechanism to fully unload a domain-neutral assembly other than shutting down the process.
135. How Do I Unload An Assembly?
CLR does not provide a way to unload an assembly. The only mechanism to remove the assembly is to unload the application domain in which the assembly is loaded. If you wish to remove an assembly after it has been used, you should create an application domain, load the assembly into the created application domain, and then unload the application domain when you no longer need the assembly.
136. How Do I Run Managed Code In A Process?
The first step in running managed code in a process is to get the CLR loaded and initialized using a CLR host. Typically, a host consists of both managed code and unmanaged code. The managed code which executes in the default domain is usually responsible for creating the application domains in which the user code exists. All CLR hosts must contain unmanaged code because execution must begin in unmanaged code. The .NET Frameworks provides a set of unmanaged APIs that the host can use to configure the CLR, load the CLR into a process, load the hosts managed code into the default domain, and transition from the unmanaged code to the managed code. The second step in running managed code in a process is to create application domains in which the user code will execute. The creator of the application domain can specify criteria which control code isolation, security, and loading of assemblies. The third step in running managed code in a process is to execute user code in one or more application domains created in the previous step. All code that is run in the CLR must be part of an assembly. There are three options for loading assemblies. First, precompiled assemblies can be loaded from disk. Second, precompiled assemblies can be loaded from an array of bytes. Third, assemblies can be built dynamically in an application domain using the BCL Reflection Emit APIs.
Note. For an application launched from the command-line, the shell host executes the steps described above on behalf of the user and hides the complexity from the user.
137. What Is The Difference Between An Application Domain And A Process?
An application domain is lighter than a process. Application domains are appropriate for scenarios that require isolation without the heavy cost associated with running an application within a process. A process runs exactly one application. In contrast, the CLR allows multiple applications to be run in a single process by loading them into separate application domains. Additionally, the CLR verifies that user code in an application domain is type safe.
138. What Is A Clr Host?
The Windows operating system does not provide support for running a CLR application. That support is provided by a CLR host. A CLR host is an application that is responsible for loading the CLR into a process, creating application domains within the process, and executing user code within the application domains. Examples of hosts that ship with the .NET Framework include:
ASP.NET. An ISAPI filter that ships with ASP.NET loads the CLR and does the initialization necessary to handle web requests.
Internet Explorer. A MIME filter hooks into Internet Explorer versions 5.01 and higher to execute managed controls referenced from HTML pages.
Shell Executables. When a managed application is launched from a shell, a small piece of unmanaged code loads the CLR and transitions control of the application to the CLR.
139. Can We Maintain State In Webservice?
Yes. Webservice don’t have any mechanism.So, It can maintain state. By default, webservice class is derived for state maintenance.
140. Difference Between Authentication And Authorization?
Authentication is a process of identifying a user based on their credentials(means user id and password).
Authorization is process of determining whether an authenticated user is allowed to access a specific resource or not.
141. What Is The Purpose Of Enumerable Class In .net?
It contains various extension methods like Where(), OrderBy() etc. for the IList classes.
Inorder to get access for those methods, simply we have to include the System.Linq namespace.
142. In The Page Load Event I Assigned Dropdownlist’s Datasource Property To A Valid List. On The Submit Button Click.. The Same Datasource Property Is Coming As Null. Why?
As ViewState is not storing the DataSource property.
We have to use Items property of DropDownList to get the items back.
143. What Is Data Adapter?
Data adapter are objects that connect one or more command objects to a dataset object. They provide logic that gets the data from the data store and populates the tables in the dataset, or pushes the changes in the dataset back into the data store.
144. What Is Replication?
Replication is way of keeping data synchronized in multiple databases. SQL server replication has two important aspects publisher and subscriber.
Publisher: Database server that makes data available for replication is called as publisher.
Subscriber: Database servers that get data from the publishers is called as subscribers.
145. What Are The Different Types Of Remote Object Creation Mode In .net?
There are two types of remote object creation mode. They are,
- SAO(server activated objects)
- CAO(client activated objects)
146. What Is Application Domain?
In application domains multiple application can run in the same process with out influencing each othere. If one of the application domains throws error it does not affect the other application domains.
147. What Is Thread.sleep()?
Thread’s execution can be paused by calling the thread.sleep method. This method takes an integer value that determines how long the thread should sleep.
Eg: Thread.CurrentThread.Sleep(2000)
148. What Is Addressof Operator?
Addressof operator creates a delegate object to a method.
example:
Dim pthread1 as new thread(AddressOf thread1)
Here thread1 is a method. pthread1 is a delegate object.
149. What Is Multi-threading?
Multi-threading forms subset of multi-tasking instead of having to switch between programs this feature switches between different parts of the same program. For example, we can write in word and at the same time word is doing a spell check in background.
150. What Is Dcom?
DCOM is a distributed extension of COM. It differs from COM in that it allows for creating objects distributed across a network, a protocol for invoking that object’s methods, and secure to the object. DCOM provides a wrapper around COM, hence it is a backward compatible extension.
151. How To Install Or Uninstall A Windows Service?
For Install:-
1)Go to visual Studio command prompt
(Start => All programs => Microsoft Visual Studio 2005 => Visual Studio Tools => Visual Studio 2005 Command Prompt)
2)installutil (e.g installutil C:\MyService.exe)
For UN Install:-
3)Go to visual Studio command prompt
(Start => All programs => Microsoft Visual Studio 2005 => Visual Studio Tools => Visual Studio 2005 Command Prompt)
4)installutil -U (e.g installutil -U C:\MyService.exe)
152. What Is Jit? What Are The Different Types Of Jit?
JIT stands for Just-in-time compiler.It is a part of the runtime execution environment. It compiles the intermediate language and execute them. There are three types of JIT. They are,
- Pre-JIT : compiles complete source code into native code in a single compilation cycle. This is done by at the time of deployment of the application.
- Econo-JIT : compiles only those methods that they are called at runtime. However, These compiled methods are removed when they are not required.
- Normal-JIT : compiles only those methods that they 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.
153. What Is Delay Signing?
During development process we have to sign strong name with our application. But it is not good practice in the security point of view. For that, we can sign it later. It is called delay signing.
154. What Is Strong Name?
Strong name helps GAC(Global assembly cache) to differentiate between two versions.It is only needed when we deploy the assembly with GAC. It uses public key cryptocrophy to ensure that no one spoof it.
155. What Is Code Verification?
Code verification ensure that proper code execution and type safety while the code runs. It does not allow to perform illegal operation such as invalid memory location.
156. What Is Code Access Security?
Code access security grant rights to the program depends on security configuration of the machine. For example, Program can have access to create or edit a file but security configuration of the machine does not allow to delete a file.
157. What Is Il?
IL stands for Intermediate language. All .Net code is converted into IL. Then IL is converted into native code at run time by JIT(just in time) compiler and executed by them.
158. What Is Class Library In .net
class library is a collection of prewritten, ready-made software routines that act as templates for programmers to use in writing object-oriented application programs
159. How To Block A Class From Being Inherited Further?
Use sealed keyword.
Eg: public sealed class TheClass
{
}
160. How To Find The Current Application File Path While Runtime?
System.Reflection.Assembly.GetExecutingAssembly().Location
161. What Is The Base Class Of All Classes In C#?
It is object (Sytem.Object)
162. You Are Designing A User Control. You Created New Property Called Backgroundimage Which Is Of Type Image. You Wanted To Disable Storing This Property In The User’s Form. How To Achieve This?
Use the attribute:
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
163. You Are Creating A Custom Usercontrol, Some Of The Newly Created Properties Are Shown In The Properties Window. How You Can Hide A New Property Named Theme From The Properties Window?
Use the attribute [Browsable(false)] along with the property
[Browsable(false)]
public string Theme
{
get;
set;
}
164. How To Sort An Int Array In C#?
Array class is having method to sort any arrays.
Example:
int[] array = new int[] { 10, 9, 8 };
Array.Sort(array);
Additional:
Sort is overloaded method with IComparer as argument too.
165. How To Prevent The Error While Updating Ui Control From Another Thread?
Control.CheckForIllegalCrossThreadCalls = false;
166. You Are Designing A Single Person Shooter Game Application. The Player Can Choose Between Multiple Guns. 1) Pistol With 5 Bullets 2) Shotgun With 100 Bullets 3) Grenade Launcher With 20 Grenades Each Gun Will Have Different Sound Effects And Graphics.pressing Ctrl+space Should Rotate Between Guns.which Design Pattern Should You Employ For This?
Use Strategy Pattern.
Explanation: Each gun having different performance and graphics.
So this can be accomodated in the algorithm.
Strategy pattern is best suited for shifting the guns/algorithms There will be a IGun interface implemented by 3 classes
Pistol :IGun
Shotgun :IGun
GrenadeLauncher :IGun
167. How To Find Whether The Application Is Run From Inside Ide Or Not?
Use System.Diagnostics.Debugger.IsAttached property.If it is true that means a debugger is attached to the application else not
Useful: While creating applications we can check this property and skip the login page/form and directly launch the page/form we are debugging.
168. What Is The Difference Between Var And Dynamic Types In C# 4.0?
var gets processed in the compile time itself and shows any error during compile time itself.
dynamic gets processed in the runtime only and in case of errors it is hidden until runtime.
dynamic was introduced as part of the DLR (Dynamic Language Runtime)in .Net.
Example:
dynamic d = new MyClass();
d.InexistingMethod();
Eventhough the method “InexistingMethod” is not there – it will get compiled and thrown exception in runtime.
169. How Can You Access A Private Method Of A Class?
Use .Net Reflection. Using reflection we can invoke private methods too.
Example:
Car car = new Car();
Type type = car.GetType();
MethodInfo methodInfo = type.GetMethod(“ShiftGearUp”, BindingFlags.NonPublic | BindingFlags.Instance);
methodInfo.Invoke(car, null);
Pre: Create a class Car with private method “ShiftGearUp”
170. Why Linq Is Having Select Clause At The End?
Due to IntelliSense of Visual Studio.
If the select clause was in the first of LINQ, then the IDE cannot populate the properties inside the object.
Eg:from f in db.Forum where f.Id > 0 select f.Name;
If the select was in front – the “select f.” could not populate any autocomplete properties or methods.
171. Name The Method Of Servicebase Class?
The following are the methods of ServiceBase class.
• OnStart
• OnStop
• OnPause
• OnContinue
• OnShutdown
• OnPowerEvent
• OnCustomCommand
172. Name The Two Classes Are Required For Implementing A Windows Service?
The following two classes are required for implementing a Windows Service:
- System.ServiceProcess.ServiceBase
- System.Configuration.Install.Installer
173. What Are The Benefits Of Using Windows Services:
The following are the benefits of using Windows Services:
- Network connection management
- Disk access monitoring
- Security control of application
- Log messages related to the application’s requirements
174. What Are Windows Services?
Windows services are long running executable applications that typically do not possess any user interface, are controlled by the Service Control Manager (SCM) and can even be configured to start automatically after the system boots. They typically execute in their own windows sessions. They can execute even if the user has not logged in to the system. They can even be started, paused, re-started manually. These applications are somewhat similar to the daemon processes of UNIX in the sense that they remain dormant most of the time and execute in the background as and when needed.
175. By Default Security Setting In .net?
anonymous access
176. Can Namespace Contain The Private Class?
no, having a single private class does not mean anything , it is applicable only in case of nested class.
177. Wcf And What Is Difference Between Wcf And Web Services?
WCF is windows communication foundation same as webservices. actually WCF =webservices + remoting
178. Is Exe Is Machine Dependent?
yes
179. What Is Difference Between Il And Dll ?
DLL contains the IL and other details (metadata) inside.
180. How Will You Deploy The Dll File In Gac?
first create the strong name for dll and add this sn name key into the application then use gacutil command to register the dll in GAC.
181. If Dll And Exe Files Are Same It Means You Can Deploy Both The Files In Gac?
No, deploying a exe file does not mean anything because classes and method are exposed in dll only and exe file is pure executable, any application can not call the function of exe file.
182. What Is The Task Perform By Clr?
It have the task like
- running the garbage collector
- Code verification
- code access security
- executing IL
183. Suppose Two Interfaces Have Same Method, So How Will You Implement These Methods In Derive Class?
by using interface name
184. What Is Using Keyword?
using keyword can be used in two format
1.include the namespace in file
2.handle the idisposable objects inside using block.
iFace obj = new myclass()
Myclass obj1 = new myclass()
Obj.hey();
Obj1.hey();
185. How To Get The Number After Decimal Point In .net?if The No Is 2.36. Result Should Be 36?
string result=number.Substring(number.inderOf(‘.’)+1);
It will first get the index of ‘.’ and then add 1 to get the index of next charater then with the help of substring method we will get the no after the decimal point to the last
186. Wht Executescaler Method Is Used?
Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.
187. What Is Literal Control
A Literal Web Server control doesn’t have any visual appearance on a Web Form but is used to insert literal text into a Web Form. This control makes it possible to add HTML code directly in the code designer window without switching to design view and clicking the HTML button to edit the HTML.
188. How Many Languages .net Is Supporting Now?
When .NET was introduced it came with several languages.
- VB.NET,
- C#,
- COBOL
and - Perl, etc.
189. How Asp .net Different From Asp?
Scripting is separated from the HTML, Code is compiled as a DLL, these DLLs can be executed on the server.
190. What Is Smart Navigation In .net?
The cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed.
191. What Is View State In .net?
The web is stateless. But in ASP.NET, the state of a page is maintained in the in the page itself automatically. The values are encrypted and saved in hidden controls. this is done automatically by the ASP.NET. This can be switched off / on for a single control.
192. How Do You Validate The Controls In An Asp .net Page?
Using special validation controls that are meant for validation of any controle.We have Range Validator, Email Validator in .NET to validate any control.
193. How To Manage Pagination In A Page Using .net?
Using pagination option in DataGrid control is available in .NET. We have to set the number of records for a page, then it takes care of pagination by itself automatically.
194. Observations Between Vb.net And Vc#.net?
Choosing a programming language depends on your language experience and the scope of the application you are building. While small applications are often created using only one language, it is not uncommon to develop large applications using multiple languages.For example, if you are extending an application with existing XML Web services, you might use a scripting language with little or no programming effort. For client-server applications, you would probably choose the single language you are most comfortable with for the entire application. For new enterprise applications, where large teams of developers create components and services for deployment across multiple remote sites, the best choice might be to use several languages depending on developer skills and long-term maintenance expectations.The .NET Platform programming languages – including Visual Basic .NET, Visual C#, and Visual C++ with managed extensions, and many other programming languages from various vendors – use .NET Framework services and features through a common set of unified classes. The .NET unified classes provide a consistent method of accessing the platform’s functionality. If you learn to use the class library, you will find that all tasks follow the same uniform architecture. You no longer need to learn and master different API architectures to write your applications.
195. Advantages Of Migrating To Vb.net?
Visual Basic .NET has many new and improved language features — such as inheritance, interfaces, and overloading that make it a powerful object-oriented programming language. As a Visual Basic developer, you can now create multithreaded, scalable applications using explicit multithreading. Other new language features in Visual Basic .NET include structured exception handling, custom attributes, and common language specification (CLS) compliance. The CLS is a set of rules that standardizes such things as data types and how objects are exposed and interoperate. Visual Basic .NET adds several features that take advantage of the CLS. Any CLS-compliant language can use the classes, objects, and components you create in Visual Basic .NET. And you, as a Visual Basic user, can access classes, components, and objects from other CLS-compliant programming languages without worrying about language-specific differences such as data types.CLS features used by Visual Basic .NET programs include assemblies, namespaces, and attributes.
196. Advantages Of Vb.net?
- First of all, VB.NET provides managed code execution that runs under the Common Language Runtime (CLR), resulting in robust, stable and secure applications. All features of the .NET framework are readily available in VB.NET.
- VB.NET is totally object oriented. This is a major addition that VB6 and other earlier releases didn’t have.
- The .NET framework comes with ADO.NET, which follows the disconnected paradigm, i.e. once the required records are fetched the connection no longer exists. It also retrieves the records that are expected to be accessed in the immediate future. This enhances Scalability of the application to a great extent.
- VB.NET uses XML to transfer data between the various layers in the DNA Architecture i.e. data are passed as simple text strings.
- Error handling has changed in VB.NET. A new Try-Catch-Finally block has been introduced to handle errors and exceptions as a unit, allowing appropriate action to be taken at the place the error occurred thus discouraging the use of ON ERROR GOTO statement. This again credits to the maintainability of the code.
197. Using Activex Control In .net?
ActiveX control is a special type of COM component that supports a User Interface. Using ActiveX Control in your .Net Project is even easier than using COM component. They are bundled usually in .ocx files. Again a proxy assembly is made by .Net utility AxImp.exe (which we will see shortly) which your application (or client) uses as if it is a .Net control or assembly. Making Proxy Assembly For ActiveX Control: First, a proxy assembly is made using AxImp.exe (acronym for ActiveX Import) by writing following command on Command Prompt: C:> AxImp C:MyProjectsMyControl.ocx This command will make two dlls, e.g., in case of above command MyControl.dll AxMyControl.dll The first file MyControl.dll is a .Net assembly proxy, which allows you to reference the ActiveX as if it were non-graphical object. The second file AxMyControl.dll is the Windows Control, which allows u to use the graphical aspects of activex control and use it in the Windows Form Project.
198. What Is Machine.config In .net?
Machine configuration file: The machine.config file contains settings that apply to the entire computer. This file is located in the %runtime install path%Config directory. There is only one machine.config file on a computer. The Machine.Config file found in the “CONFIG” subfolder of your .NET Framework install directory (c:WINNT Microsoft.NETFramework{Version Number}CONFIG on Windows 2000 installations). The machine. config,which can be found in the directory $WINDIR $Microsoft.NETFrameworkv 1.0.3705CONFIG,is an XML-formatted configuration file that specifies configuration options for the machine. This file contains, among many other XML elements, a browserCaps element. Inside this element are a number of other elements that specify parse rules for the various User-Agents, and what properties each of these parsings supports.
For example, to determine what platform is used, a filter element is used that specifies how to set the platform property based on what platform name is found in the User-Agent string. Specifically, the machine.config file contains:
- platform=Win95
- platform=Win98
- platform=WinNT
199. What Is Web.config In .net?
In classic ASP all Web site related information was stored in the metadata of IIS. This had the disadvantage that remote Web developers couldn’t easily make Web-site configuration changes. For example, if you want to add a custom 404 error page, a setting needs to be made through the IIS admin tool, and you’re Web host will likely charge you a flat fee to do this for you. With ASP.NET, however, these settings are moved into an XML-formatted text file (Web.config) that resides in the Web site’s root directory. Through Web.config you can specify settings like custom 404 error pages, authentication and authorization settings for the Web sitempilation options for the ASP.NET Web pages, if tracing should be enabled, etc. The Web.config file is an XML-formatted file. At the root level is the tag. Inside this tag you can add a number of other tags, the most common and useful one being the system.web tag, where you will specify most of the Web site configuration parameters. However, to specify application-wide settings you use the tag.
For example, if we wanted to add a database connection string parameter we could have a Web.config file like so.
200. What Is The Difference Between Ado And Ado.net?
ADO uses Recordsets and cursors to access and modify data. Because of its inherent design, Recordset can impact performance on the server side by tying up valuable resources. In addition, COM marshalling – an expensive data conversion process – is needed to transmit a Recordset. ADO.NET addresses three important needs that ADO doesn’t address:
- Providing a comprehensive disconnected data-access model, which is crucial to the Web environment
- Providing tight integration with XML, and
- Providing seamless integration with the .NET Framework (e.g., compatibility with the base class library’s type system). From an ADO.NET implementation perspective, the Recordset object in ADO is eliminated in the .NET architecture. In its place, ADO.NET has several dedicated objects led by the DataSet object and including the DataAdapter, and DataReader objects to perform specific tasks. In addition, ADO.NET DataSets operate in disconnected state whereas the ADO RecordSet objects operated in a fully connected state.
In ADO, the in-memory representation of data is the recordset. In ADO.NET, it is the dataset. A recordset looks like a single table. If a recordset is to contain data from multiple database tables, it must use a JOIN query, which assembles the data from the various database tables into a single result table. In contrast, a dataset is a collection of one or more tables.
. NET Interview Questions Pdf :-
201. What Is The Difference Between Vb And Vb.net?
Now VB.NET is object-oriented language. The following are some of the differences:
Data Type Changes
The .NET platform provides Common Type System to all the supported languages. This means that all the languages must support the same data types as enforced by common language runtime. This eliminates data type incompatibilities between various languages. For example on the 32-bit Windows platform, the integer data type takes 4 bytes in languages like C++ whereas in VB it takes 2 bytes. Following are the main changes related to data types in VB.NET:
- Under .NET the integer data type in VB.NET is also 4 bytes in size.
- VB.NET has no currency data type. Instead it provides decimal as a replacement.
- VB.NET introduces a new data type called Char. The char data type takes 2 bytes and can store Unicode characters.
- VB.NET do not have Variant data type. To achieve a result similar to variant type you can use Object data type. (Since every thing in .NET including primitive data types is an object, a variable of object type can point to any data type).
- In VB.NET there is no concept of fixed length strings.
- In VB6 we used the Type keyword to declare our user-defined structures. VB.NET introduces the structure keyword for the same purpose.
- Declaring Variables
Consider this simple example in VB6:
Dim x,y as integer
202. What Is A Strong Name In .net?
A strong name consists of the assembly’s identity its simple text name, version number, and culture information (if provided) plus a public key and a digital signature. It is generated from an assembly file (the file that contains the assembly manifest, which in turn contains the names and hashes of all the files that make up the assembly), using the corresponding private key. Assemblies with the same strong name are expected to be identical.
Strong names guarantee name uniqueness by relying on unique key pairs. No one can generate the same assembly name that you can, because an assembly generated with one private key has a different name than an assembly generated with another private key.
When you reference a strong-named assembly, you expect to get certain benefits, such as versioning and naming protection. If the strong-named assembly then references an assembly with a simple name, which does not have these benefits, you lose the benefits you would derive from using a strong-named assembly and revert to DLL conflicts. Therefore, strong-named assemblies can only reference other strong-named assemblies.
There are two ways to sign an assembly with a strong name:
- Using the Assembly Linker (Al.exe) provided by the .NET Framework SDK.
- Using assembly attributes to insert the strong name information in your code. You can use either the AssemblyKeyFileAttribute or the AssemblyKeyNameAttribute, depending
203. What Is A Manifest In .net?
An assembly manifest contains all the metadata needed to specify the assembly’s version requirements and security identity, and all metadata needed to define the scope of the assembly and resolve references to resources and classes. The assembly manifest can be stored in either a PE (Portable Executable) file (an .exe or .dll) with Microsoft intermediate language (MSIL) code or in a standalone PE (Portable Executable) file that contains only assembly manifest information.
The following table shows the information contained in the assembly manifest. The first four items the assembly name, version number, culture, and strong name information make up the assembly’s identity.
Assembly name: A text string specifying the assembly’s name.
Version number: A major and minor version number, and a revision and build number. The common language runtime uses these numbers to enforce version policy.
Culture: Information on the culture or language the assembly supports. This information should be used only to designate an assembly as a satellite assembly containing culture- or language-specific information. (An assembly with culture information is automatically assumed to be a satellite assembly.) Strong name information: The public key from the publisher if the assembly has been given a strong name.
204. Creating A Key Pair In .net?
You can create a key pair using the Strong Name tool (Sn.exe). Key pair files usually have an .snk extension. To create a key pair At the command prompt, type the following command:
In this command, file name is the name of the output file containing the key pair. The following example creates a key pair called sgKey.snk
205. What Is The Difference Between “using System.data;” And Directly Adding The Reference From “add References Dialog Box”?
When u compile a program using command line, u add the references using /r switch. When you compile a program using Visual Studio, it adds those references to our assembly, which are added using “Add Reference” dialog box. While “using” statement facilitates us to use classes without using their fully qualified names.
For example: if u have added a reference to “System. Data. SqlClient” using “Add Reference” dialog box then u can use SqlConnection class like this:
System.Data.SqlClient.SqlConnection
But if u add a “using System. Data. SqlClient” statement at the start of ur code then u can directly use Sql Connection class.On the other hand if u add a reference using “using System.Data.SqlClient” statement, but don’t add it using “Add Reference” dialog box, Visual Studio will give error message while we compile the program
206. What Is Gac In .net?
The global assembly cache stores assemblies specifically designated to be shared by several applications on the computer. You should share assemblies by installing them into the global assembly cache only when you need to. Assemblies deployed in the global assembly cache must have a strong name. When an assembly is added to the global assembly cache, integrity checks are performed on all files that make up the assembly. The cache performs these integrity checks to ensure that an assembly has not been tampered with, for example, when a file has changed but the manifest does not reflect the change. Use a developer tool called the Global Assembly Cache tool (Gacutil.exe), provided by the .NET Framework SDK or Use Windows Explorer to drag assemblies into the cache. To install a strong-named assembly into the global assembly cache At the command prompt, type the following command:
gacutil I
In this command, assembly name is the name of the assembly to install in the global assembly cache.
207. What Is A Metadata In .net?
Metadata is information about a PE. In COM, metadata is communicated through non-standardized type libraries.
In .NET, this data is contained in the header portion of a COFF-compliant PE and follows certain guidelines; it contains information such as the assembly’s name, version, language (spoken, not computera.k.a., culture), what external types are referenced, what internal types are exposed, methods, properties, classes, and much more.
The CLR uses metadata for a number of specific purposes. Security is managed through a public key in the PE’s header.
Information about classes, modules, and so forth allows the CLR to know in advance what structures are necessary. The class loader component of the CLR uses metadata to locate specific classes within assemblies, either locally or across networks.
Just-in-time (JIT) compilers use the metadata to turn IL into executable code.
Other programs take advantage of metadata as well.
A common example is placing a Microsoft Word document on a Windows 2000 desktop. If the document file has completed comments, author, title, or other Properties metadata, the text is displayed as a tool tip when a user hovers the mouse over the document on the desktop. You can use the Ildasm.exe utility to view the metadata in a PE. Literally, this tool is an IL disassembler.
208. What Is Managed Code And Managed Data In .net?
Managed code is code that is written to target the services of the Common Language Runtime.
In order to target these services, the code must provide a minimum level of information (metadata) to the runtime.All C#, Visual Basic .NET, and JScript .NET code is managed by default. Visual Studio .NET C++ code is not managed by default, but the compiler can produce managed code by specifying a command-line switch (/CLR).Closely related to managed code is managed data–data that is allocated and de-allocated by the Common Language Runtime’s garbage collector. C#, Visual Basic, and JScript .NET data is managed by default.C# data can, however, be marked as unmanaged through the use of special keywords.Visual Studio .NET C++ data is unmanaged by default (even when using the /CLR switch), but when using Managed Extensions for C++, a class can be marked as managed using the __gc keyword. As the name suggests, this means that the memory for instances of the class is managed by the garbage collector.
In addition, the class becomes a full participating member of the .NET Framework community, with the benefits and restrictions that it brings. An example of a benefit is proper interoperability with classes written in other languages (for example, a managed C++ class can inherit from a Visual Basic class).An example of a restriction is that a managed class can only inherit from one base class.
209. What Is .net And .net Framework?
It is a Framework in which Windows applications may be developed and run. The Microsoft .NET Framework is a platform for building, deploying, and running Web Services and applications. It provides a highly productive, standards-based, multi-language environment for integrating existing investments with next-generation applications and services as well as the agility to solve the challenges of deployment and operation of Internet-scale applications. The .NET Framework consists of three main parts: the common language runtime, a hierarchical set of unified class libraries, and a componentized version of Active Server Pages called ASP.NET. The .NET Framework provides a new programming model and rich set of classes designed to simplify application development for Windows, the Web, and mobile devices. It provides full support for XML Web services, contains robust security features, and delivers new levels of programming power. The .NET Framework is used by all Microsoft languages including Visual C#, Visual J#, and Visual C++.
210. What’s A Windows Process?
It’s an application that’s running and had been allocated memory
211. What’s Typical About A Windows Process In Regards To Memory Allocation?
Each process is allocated its own block of available RAM space, no process can access another process code or data. If the process crashes, it dies alone without taking the entire OS or a bunch of other applications down.
212. Why Do You Call It A Process? What’s Different Between Process And Application In .net, Not Common Computer Usage, Terminology?
A process is an instance of a running application. An application is an executable on the hard drive or network. There can be numerous processes launched of the same application (5 copies of Word running), but 1 process can run just 1 application.
213. What Distributed Process Frameworks Outside .net Do You Know?
Distributed Computing Environment/Remote Procedure Calls (DEC/RPC), Microsoft Distributed Component Object Model (DCOM), Common Object Request Broker Architecture (CORBA), and Java Remote Method Invocation (RMI).
214. What Are Possible Implementations Of Distributed Applications In .net?
.NET Remoting and ASP.NET Web Services. If we talk about the Framework Class Library, noteworthy classes are in System.Runtime.Remoting and System.Web.Services.
215. When Would You Use .net Remoting And When Web Services?
Use remoting for more efficient exchange of information when you control both ends of the application. Use Web services for open-protocol-based information exchange when you are just a client or a server with the other end belonging to someone else.
216. What’s A Proxy Of The Server Object In .net Remoting?
It’s a fake copy of the server object that resides on the client side and behaves as if it was the server. It handles the communication between real server object and the client object. This process is also known as marshaling.
217. 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.
218. What Are Channels In .net Remoting?
Channels represent the objects that transfer the other serialized objects from one application domain to another and from one computer to another, as well as one process to another on the same box. A channel must exist before an object can be transferred.
219. What Security Measures Exist For .net Remoting In System.runtime.remoting?
None. Security should be taken care of at the application level. Cryptography and other security techniques can be applied at application or server level.
220. What Is A Formatter?
A formatter is an object that is responsible for encoding and serializing data into messages on one end, and deserializing and decoding messages into data on the other end.
221. Choosing Between Http And Tcp For Protocols And Binary And Soap For Formatters, What Are The Trade-offs?
Binary over TCP is the most effiecient, SOAP over HTTP is the most interoperable.
222. What’s Singlecall Activation Mode Used For?
If the server object is instantiated for responding to just one single request, the request should be made in SingleCall mode.
223. What’s Singleton Activation Mode?
A single object is instantiated regardless of the number of clients accessing it. Lifetime of this object is determined by lifetime lease.
224. How Do You Define The Lease Of The Object?
By implementing ILease interface when writing the class code.
225. Can You Configure A .net Remoting Object Via Xml File?
Yes, via machine.config and application level .config file (or web.config in ASP.NET). Application-level XML settings take precedence over machine.config.
226. How Can You Automatically Generate Interface For The Remotable Object In .net With Microsoft Tools?
Use the Soapsuds tool.
227. What Are The Consideration In Deciding To Use .net Remoting Or Asp.net Web Services?
Remoting is a more efficient communication exchange when you can control both ends of the application involved in the communication process. Web Services provide an open-protocol-based exchange of informaion. Web Services are best when you need to communicate with an external organization or another (non-.NET) technology.
228. What’s Singlecall Activation Mode Used For?
If the server object is instantiated for responding to just one single request, the request should be made in SingleCall mode.
229. What Do You Mean By A Windows Process In Regards To Memory Allocation?
Each process is allocated its own address space typically 4GB in which it can run. No other process can interfere in that address space.
If the process crashes, it dies alone without taking the entire OS or a bunch of other applications down.
230. What Is The Relationship Between A Process, Application Domain, And Application?
A process is an instance of a running application. An application is an executable in the computer. There can be numerous processes launched of the same application (5 copies of Word running), but 1 process can run just 1 application. Hence, Process is a running instance of the application.
231. How To Decide Which To Use .net Remoting Or Asp.net Web Services?
Remoting is a more efficient communication exchange when you can control both ends of the application involved in the communication process. Remoting is excellent in case of intranet applicaton becuase of the speed.
Web Services provide an open-protocol-based exchange of informaion. Web Services are best when you need to ommunicate with an external organization or another (non-.NET) technology applications.
232. What Is The Proxy Of The Server Object In .net Remoting?
Proxy is copy of the server object( a thin layer) that resides on the client side and behaves as if it was the server. It delegate calls to the real server object. This process is also known as marshaling.
233. What Do Mean By Remotable Objects In .net Remoting?
Remotable objects 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.
234. Which Class Does The Remote Object Has To Inherit?
All remote objects should inherit from System.MarshalbyRefObject.
235. What Are Two Different Types Of Remote Object Creation Mode In .net?
There are two different ways in which object can be created using Remoting:
-SAO (Server Activated Objects) also called as Well-Known call mode.
-CAO (Client Activated Objects).
SAO has two modes “Single Call” and “Singleton”. With Single Call object the object is created with every method call thus making the object stateless. With Singleton the object is created only once and the object is shared with all clients.
CAO are stateful as compared to SAO. In CAO the creation request is sent from client side. Client holds a proxy to the server object created on server.
236. What Are The Situations You Will Use Singleton Architecture In Remoting ?
If all remoting clients have to share the same data singleton architecture will be used.
237. What Is Fundamental Of Published Or Precreated Objects In Remoting?
In scenarios of singleton or single call the objects are created dynamically. But in situations where you want to precreate object and publish it you will use published object scenarios.
Dim obj as new objRemote
obj.Initvalue = 100
RemotingServices.Marshal(obj,”RemoteObject”)
As shown in above sample following changes will be needed on server side.
Remoting Configuration.Register WellKnown ServiceType is replaced by Remoting Services .Marshal (obj,”Remote Object”) where “obj” is the precreated objected on the server whose value is initialized to 100.
238. What Are The Ways In Which Client Can Create Object On Server In Cao Model?
There are two ways by which you can create Client objects on remoting server:
Activator.CreateInstance()
By Keyword “New”.
239. Are Cao Stateful In Nature?
Yes. In CAO remoting model client creates a instance on server and instance variable set by client on server can be retrieved again with correct value.
240. Is It A Good Design Practice To Distribute The Implementation To Remoting Client?
It’s never advisable to distribute complete implementation at client, due to following reasons:
-Any one can use ILDASM or similar utility and get access to your code.
-It’s a bad architecture move to have full implementation as client side as any changes in implementation on server side you have to redistribute it again.
So the best way is to have a interface or SOAPSUDS generated meta-data DLL at client side rather than having full implementation.
241. Which Config File Has All The Supported Channels/protocol?
Machine.config file has all the supported channels and formatter supported by .NET remoting.Machine.config file can be found at “C:\WINDOWS\Microsoft.NET\Framework\vXXXXX\CONFIG” path. Find element in the Machine. config file which has the channels and the formatters. Below is a figure shown which can give a clear idea of how the file looks like.
242. Can Non-default Constructors Be Used With Single Call Sao?
Non-Default constructors can not be used with single call objects as object is created with every method call, there is no way to define Non-default constructors in method calls. It’s possible to use Non-Default constructor with Client activated objects as both methods “NEW” keyword and “Activator.CreateInstance” provide a way to specify Non-Default constructors.
243. How Can We Call Methods In Remoting Asynchronously?
We can make Asynchronous method calls by using delegates.
244. What Is Asynchronous One-way Calls?
One-way calls are a different from asynchronous calls from execution angle that the .NET Framework does not guarantee their execution. In addition, the methods used in this kind of call cannot have return values or out parameters. One-way calls are defined by using [OneWay()] attribute in class.
245. What Is Marshalling And What Are Different Kinds Of Marshalling?
Marshaling is used when an object is converted so that it can be sent across the network or across application domains. Unmarshaling creates an object from the marshaled data. There are two ways to do marshalling:
-Marshal-by-value (MBV): In this the object is serialized into the channel, and a copy of the object is created on the other side of the network. The object to marshal is stored into a stream, and the stream is used to build a copy of the object on the other side with the unmarshalling sequence.
-Marshaling-by-reference (MBR): Here it creates a proxy on the client that is used to communicate with the remote object. The marshaling sequence of a remote object creates an ObjRef instance that itself can be serialized across the network.
246. What Is Objref Object In Remoting?
All Marshal() methods return ObjRef object.The ObjRef is serializable because it implements the interface ISerializable, and can be marshaled by value. The ObjRef knows about location of the remote object, host name, port number and object name.
247. What Is A Web Service?
Web Services are business logic components which provide functionality via the Internet using standard protocols such as HTTP. Web Services uses Simple Object Access Protocol (SOAP) in order to expose the business functionality.SOAP defines a standardized format in XML which can be exchanged between two entities over standard protocols such as HTTP. SOAP is platform independent so the consumer of a Web Service is therefore completely shielded from any implementation details about the platform exposing the Web Service. For the consumer it is simply a black box of send and receive XML over HTTP. So any web service hosted on Windows can also be consumed by UNIX and LINUX platform.
248. What Is Uddi?
Full form of UDDI is Universal Description, Discovery and Integration. It is a directory that can be used to publish and discover public Web Services.
249. What Is Disco?
DISCO is the abbreviated form of Discovery. It is basically used to club or group common services together on a server and provides links to the schema documents of the services it describes may require.
250. What Is Wsdl?
Web Service Description Language (WSDL)is a W3C specification which defines XML grammar for describing Web Services.XML grammar describes details such as where we can find the Web Service (its URI), what are the methods and properties that service supports, data type support and supported protocols.
Clients can consume this WSDL and build proxy objects that clients use to communicate with the Web Services.
251. What The Different Phase/steps Of Acquiring A Proxy Object In Webservice?
Following are the different steps needed to get a proxy object of a webservice at the client side:
- Client communicates to UDDI node for webservice either through browser or UDDI’s public web service.
- UDDI node responds with a list of webservices.
- Every service listed by webservice has a URI pointing to DISCO or WSDL document.
- After parsing the DISCO document, we follow the URI for the WSDL document related to the webservice which we need.
- Client then parses the WSDL document and builds a proxy object which can communicate with Webservice.
252. What Is File Extension Of Webservices?
.ASMX is extension for Webservices.
253. Which Attribute Is Used In Order That The Method Can Be Used As Webservice?
WebMethod attribute has to be specified in order that the method and property can be treated as WebService.
254. What Are The Steps To Create A Webservice And Consume It?
In Visual Studio you can create a new project using “Asp.NET Web Service” template or just create asmx-file using any text editor. After webservice is implemented, you need either add a webreference to it in Visual Studio, or to create a proxy for the client manually using wsdl.exe utility and build a client program using created proxy class, so that using it client can consume the webservice.
255. Why Do You Call It A Process? What’s Different Between Process And Application In .net, Not Common Computer Usage, Terminology?
A process is an instance of a running application. An application is an executable on the hard drive or network. There can be numerous processes launched of the same application (5 copies of Word running), but 1 process can run just 1 application.
256. What’s Singlecall Activation Mode Used For?
If the server object is instantiated for responding to just one single request, the request should be made in SingleCall mode.
257. What Is The Relation Between Classes And Objects?
Class is a group of items, attributes of some entity. Object is any specific item that may or may not be a part of the class.When a class is created, objects for those classes are created.
258. Explain Different Properties Of Object Oriented Systems.
An object oriented system revolves around a Class and objects. A class is used to describe characteristics of any entity of the real world. An object is a pattern of the class. An actual object created at runtime is called as an instance. A class, apart from characteristics has some functions to perform called as methods. For.e.g A class named “Food” has attributes like ‘price’, ‘quantity’. “Food” class has methods like Serve_food(), bill_food().
Objects in Object Oriented Systems interact through messages.
- Inheritance:- The main class or the root class is called as a Base Class. Any class which is expected to have ALL properties of the base class along with its own is called as a Derived class. The process of deriving such a class is Derived class. For the “Food” class, a Derived class can be “Class Chinesefood”.
- Abstraction:- Abstraction is creating models or classes of some broad concept. Abstraction can be achieved through Inheritance or even Composition.
- Encapsulation:- Encapsulation is a collection of functions of a class and object. The “Food” class is an encapsulated form. It is achieved by specifying which class can use which members (private, public, protected) of an object.
- Polymorphism:- Polymorphism means existing in different forms. Inheritance is an example of Polymorphism. A base class exists in different forms as derived classes. Operator overloading is an example of Polymorphism in which an operator can be applied in different situations.
259. What Is Difference Between Association, Aggregation And Inheritance Relationships?
Association:
An association describes a group of links with common structure and common semantics.
Example:
A person works for a company. It is often appear verb in the problem statement. It is implemented as a pointer or reference to an object
Aggregation:
An aggregation is the “a part of” relationship in which objects represents the components in same assembly. Aggregation may be the special form of Association.
Example :
A Paragraph consists of many sentences. Here Paragraph contains sentences.
Inheritance:
Inheritance is a relationship between a class and one or more redefined version of it. It is sometimes called “is a relationship.
260. Explain The Features Of An Abstract Class In Net.
An Abstract class is only used for inheritance. This means it acts as a base class for its derived classes. One cannot use it to create objects. When a class is declared as “Abstract”, it can only be inherited and not instantiated. MustInherit Keyword can be used to declare a class as abstract. Abstract classes can also specify abstract members.
261. Difference Between Abstract Classes And Interfaces
Abstract classes:
- An abstract class can implement methods.
- An abstract class can inherit from a class and one or more interfaces.
- An abstract class can contain fields.
- An abstract class can implement a property.
- An abstract class can contain constructors or destructors.
- An abstract class cannot be inherited from by structures.
- An abstract class cannot support multiple inheritance.
interfaces:
- An Interface cannot implement methods.
- An Interface can only inherit from another Interface.
- An Interface cannot contain fields.
- An Interface can contain property definitions.
- An Interface cannot contain constructors or destructors.
- An Interface can be inherited from by structures.
- An Interface can support multiple inheritance.
262. Similarities And Difference Between Class And Structure In .net
Similarities:
- Both Class and Structures can have methods, variables and objects.
- Both can have constructor.
- Both are user defined types.
Differences:
- Structure being value type, the variables cannot be assigned to NULL. On the other hand, classes being reference type, a class variable can be assigned to NULL.
- Structure is allocated on a stack when instantiated, while Class is allocated on a heap.
- When a method is passed to a class, pass by reference is used. Pass by value is used for struts.
- A class can have a destructor.
263. Features Of Static/shared Classes.
Static classes are used when any change made to an object should not affect the data and functions of the class. They can be used to create data and functions without the need of an instance.
Following are features of Static/Shared classes:-
- They can not be instantiated. By default a object is created on the first method call to that object.
- Static/Shared classes can not be inherited.
- Static/Shared classes can have only static members.
- Static/Shared classes can have only static constructor.
264. What Is Operator Overloading In .net?
Operator overloading is the most evident example of Polymorphism. In operator overloading, an operator is ‘overloaded’ or made to perform additional functions in addition to what it actually does. For e.g. we can overload the “+” operator to add two complex numbers or two imaginary numbers.
X= a + b //+ is overloaded to add two integers, float etc
Few operators like :: cannot be overloaded.
265. What Is Finalize Method In .net?
Object.Finalize method in .NET is typically used to clean and release unmanaged resources like OS files, window etc. Even though Garbage collector in .NET has the ability to determine the life time of such objects, however, with no knowledge how to clean them. The Finalize method allows an object to clean up such unmanaged resources when the garbage collector wishes to reclaim the memory. However, Finalize method should be avoided until necessary as it affects the performance because reclaiming the memory used by objects with Finalize methods requires at least two garbage collections.
266. What Are The Concepts Of Dispose Method?
Dispose method belongs to IDisposable interface. It is used to free unmanaged resources like files, network connection etc.
267. Concurrency With Aop?
Concurrency is the system’s ability to act with several requests simultaneously, such a way that threads don’t corrupt the state of objects when they gain access at the same time.
268. Transparent Caching With Aop ?
To get better results in terms of speed and resources used, it’s suggested to use a cache. We can store in it the results corresponding to the methods invocations as key-value pairs: method and arguments as key and return object as value.
269. Security With Aop?
Security is one of the most important elements of an application. The word “security” covers two concepts: Authentication is the verifi cation’s process of a principal’s identity; a principal is typically a user. A principal in order to be authenticated provides a credential that is the password. Authorization, on the other hand, is the process of granting authorities, which are usually roles, to an authenticated user.
270. Aspect-oriented Programming?
Aspect Oriented Programming or AOP is an interesting concept that can be applied to many of the programming problems we solve everyday. In our Visual Studio team system code we have a lot of web-services and remoting code that essentially does the following
public void MyMethod(int parameter)
{
Trace.EnteredMethod(“MyMethod”, parameter);
SecurityCheck();
// Bunch of processing
Trace.ExitMethod(“MyMethod”);
}
271. What Is Manifest In .net?
Manifest is nothing but a simple text file used to store metadata information of different .NET assemblies. Manifest file can be saved as a stand alone file of type PE. It can also be stored as an exe or as a dll file containing intermediate language code.
272. What Is Garbage Collection? How To Force Garbage Collector To Run?
Garbage collection helps in releasing memory occupied by objects. CLR automatically releases these unused objects.
273. Explain Boxing And Unboxing In .net.
Boxing permits any value type to be implicitly converted to type object or to any interface type Implemented by value
274. What Is Native Image Generator (ngen.exe)?
Ngen.exe helps in improving performance of managed applications by creating native images and storing them on the.
275. Explain Clr In Brief.
CLR stands for Common Language Runtime.
The CLR is a development platform. It provides a runtime, defines functionality in some libraries, and supports a set of programming languages. The CLR provides a runtime so that the softwares can utilize its services. The CLR Base Class Library allows interaction with the runtime. The CLR supports various programming languages, several standards and is itself been submitted as an open standard.
276. Describe How A .net Application Is Compiled And Executed.
From the source code, the compiler generates Microsoft Intermediate Language (MSIL) which is further used for the creation of an EXE or DLL. The CLR processes these at runtime. Thus, compiling is the process of generating this MSIL.
- The way you do it in .Net is as follows:
- Right-click and select Build / Ctrl-Shift-B / Build menu, Build command
- F5 – compile and run the application.
- Ctrl+F5 – compile and run the application without debugging.
Compilation can be done with Debug or Release configuration. The difference between these two is that in the debug configuration, only an assembly is generated without optimization. However, in release complete optimization is performed without debug symbols.
277. Describe The Parts Of Assembly.
An assembly is a partially compiled code library. In .NET, an assembly is a portable executable and can be an EXE (process assembly) or a DLL (library assembly). An assembly can consist of one or more files or modules in various languages. It is used in deployment, versioning and security.
278. Overview Of Clr Integration.
The CLR (Common Language Runtime) integration is hosted in the Microsoft SQL Server 2005. With CLR integration, stored procedures, triggers, user- defined functions, user-defined types, and user-defined aggregates in managed code, etc can be written.
As managed code compiles to native code before executing, significant performance can be achieved.
The SQL Server acts as an operating system for the CLR when it is hosted inside SQL Server.
Following are the steps to build a CLR stored procedure in SQL Server 2005
- Enable CLR integration in SQL Server 2005
- Create a CLR stored procedure Assembly
- Deploy the Assembly in SQL Server 2005
- Create and execute the CLR stored procedure in SQL Server 2005
279. Clr Triggers?
A CLR trigger could be a Date Definition or Date Manipulation Language trigger or could be an AFTER or INSTEAD OF trigger.
Methods written in managed codes that are members of an assembly need to be executed provided the assembly is deployed in SQL 2005 using the CREATE assembly statement.
The Microsoft.SqlServer.Server Namespace contains the required classes and enumerations for this objective.
280. Steps For Creating Clr Trigger?
Follow these steps to create a CLR trigger of DML (after) type to perform an insert action:
• Create a .NET class of triggering action
• Make an assembly (.DLL) from that Class
• Enable CLR environment in that database.
• Register the assembly in SQL Server
• Create CLR Trigger using that assembly
281. What Is A Clr (common Language Runtime)?
Common Language Runtime – It is the implementation of CLI. The core runtime engine in the Microsoft .NET Framework for executing applications. The common language runtime supplies managed code with services such as cross-language integration, code access security, object lifetime management, resouce management, type safety, pre-emptive threading, metadata services (type reflection), and debugging and profiling support. The ASP.NET Framework and Internet Explorer are examples of hosting CLR.
The CLR is a multi-language execution environment. There are currently over 15 compilers being built by Microsoft and other companies that produce code that will execute in the CLR.
The CLR is described as the “execution engine” of .NET. It’s this CLR that manages the execution of programs. It provides the environment within which the programs run. The software version of .NET is actually the CLR version.
When the .NET program is compiled, the output of the compiler is not an executable file but a file that contains a special type of code called the Microsoft Intermediate Language (MSIL, now called CIL, Common Intermediate Language). This MSIL defines a set of portable instructions that are independent of any specific CPU. It’s the job of the CLR to translate this Intermediate code into a executable code when the program is executed making the program to run in any environment for which the CLR is implemented. And that’s how the .NET Framework achieves Portability. This MSIL is turned into executable code using a JIT (Just In Time) complier. The process goes like this, when .NET programs are executed, the CLR activates the JIT complier. The JIT complier converts MSIL into native code on a demand basis as each part of the program is needed. Thus the program executes as a native code even though it is compiled into MSIL making the program to run as fast as it would if it is compiled to native code but achieves the portability benefits of MSIL.
282. Explain The Concepts Of Cts And Cls(common Language Specification).
CTS
When different languages are integrated and want to communicate, it is certain that the languages have their own data types and different declaration styles. CTS define how these different variables are declared and used in run time. E.g. VB offers an Integer data type while C++ offers long data type. Using CTS, these data types are converted to System32 which itself a data type of CLS.
CLS
Any language(s) that intend to use the Common Language Infrastructure needs to communicate with other CLS-Compliant language. This communication is based on set of rules laid by CLS. These rules define a subset of CTS.
283. .net Framework
This includes introduction of .Net framework, .Net framework architecture, role of assembly and GAC.
284. How Do We Access Crystal Reports In .net?
When crystal reports are integrated with .NET, data can be accessed using ODBC drivers, ADO drivers, database files like excel, xml etc
285. What Are The Various Components In Crystal Reports?
When .NET application uses crystal reports, the following components are required: Report files: .rpt or report files needs to be distributed which can either be compiled into the application (Embedded) or independently (non embedded) from the application.
286. What Basic Steps Are Needed To Display A Simple Report In Crystal?
Crystal reports offer a report designer. First, select specific rows and columns from a table. Using the designer, the data on the report can be rearranged and formatted.
287. Asp.net 2.0 Themes
One of the neat features of ASP.NET 2.0 is themes, which enable you to define the appearance of a set of controls once and apply the appearance to your entire web application.
288. Should User Input Data Validation Occur Server-side Or Client-side? Why?
All user input data validation should occur on the server at a minimum. Additionally, client-side validation can be performed where deemed appropriate and feasable to provide a richer, more responsive experience for the user.
289. What’s 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 eventhandlers, allowing the main DataGrid event handler to take care of its constituents.
290. What Is A Satellite Assembly?
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.
291. .net Code Security
This includes explanation of code security, Principal object, declarative and imperative security, role-based security, code access security and code group.
292. .net Assembly
This article explains .Net assembly, private and shared assembly, satellite assemblies, resource-only assembly, ResourceManager class, strong name, global assembly cache.
293. .net Debug & Trace
Here you can learn about break mode, options to step through code in .Net, Debug Vs Trace in .Net, trace class, listeners collection of Trace and Debug objects and Trace Switches.
294. Who Benefits From Ajax?
AJAX is employed to improve the user’s experience. A request is made for the initial page rendering. After that, asynchronous requests to the server are made. An asynchronous request is a background request to send or receive data in an entirely nonvisual manner.
295. What Is Asp.net Ajax?
ASP.NET AJAX, mostly called AJAX, is a set of extensions of ASP.NET. It is developed by Microsoft to implement AJAX functionalities in Web applications. ASP.NET AJAX provides a set of components that enable the developers to develop applications that can update only a specified portion of data without refreshing the entire page. The ASP.NET AJAX works with the AJAX Library that uses object-oriented programming (OOP) to develop rich Web applications that communicate with the server using asynchronous postback.
296. What Is .net?
.NET is a general-purpose software development platform, similar to Java. At its core is a virtual machine that turns intermediate language (IL) into machine code. High-level language compilers for C#, VB.NET and C++ are provided to turn source code into IL. C# is a new programming language, very similar to Java. An extensive class library is included, featuring all the functionality one might expect from a contempory development platform – windows GUI development (Windows Forms), database access (ADO.NET), web development (ASP.NET), web services, XML etc
297. What Versions Of .net Are There?
The final versions of the 1.0 SDK and runtime were made publicly available around &6pm PST on15-Jan-2002. At the same time, the final version of Visual Studio.NET was made available to MSDN subscribers.
.NET 1.1 was released in April 2003, and was mostly bug fixes for 1.0.
.NET 2.0 was released to MSDN subscribers in late October 2005, and was officially launched in early November
298. What Operating Systems Does The .net Framework Run On?
The runtime supports Windows Server 2003, Windows XP, Windows 2000, NT4 SP6a and Windows ME/98. Windows 95 is not supported. Some parts of the framework do not work on all platforms – for example, ASP.NET is only supported on XP and Windows 2000/2003. Windows 98/ME cannot be used for development
IIS is not supported on Windows XP Home Edition, and so cannot be used to host ASP.NET. However, the ASP.NET Web Matrix web server does run on XP Home.
The .NET Compact Framework is a version of the .NET Framework for mobile devices, running Windows CE or Windows Mobile. The Mono project has a version of the .NET Framework that runs on Linux.
299. What Tools Can I Use To Develop .net Applications?
There are a number of tools, described here in ascending order of cost:
- The .NET Framework SDK is free and includes command-line compilers for C++, C#, and VB.NET and various other utilities to aid development.
- SharpDevelop is a free IDE for C# and VB.NET.
- Microsoft Visual Studio Express editions are cut-down versions of Visual Studio, for hobbyist or novice developers.There are different versions for C#, VB, web development etc. Originally the plan was to charge $49, but MS has decided to offer them as free downloads instead, at least until November 2006.
- Microsoft Visual Studio Standard 2005 is around $300, or $200 for the upgrade.
- Microsoft VIsual Studio Professional 2005 is around $800, or $550 for the upgrade
- At the top end of the price range are the Microsoft Visual Studio Team Edition for Software Developers 2005 with MSDN Premium and Team Suite editions.
You can see the differences between the various Visual Studio versions here.
300. Why Did They Call It .net?
I don’t know what they were thinking. They certainly weren’t thinking of people using search tools. It’s meaningless marketing nonsense.
301. What Is The Cli? Is It The Same As The Clr?
The CLI (Common Language Infrastructure) is the definiton of the fundamentals of the .NET framework – the Common Type System (CTS), metadata, the Virtual Execution Environment (VES) and its use of intermediate language (IL), and the support of multiple programming languages via the Common Language Specification (CLS). The CLI is documented through ECMA –
The CLR (Common Language Runtime) is Microsoft’s primary implementation of the CLI. Microsoft also have a shared source implementation known as ROTOR, for educational purposes, as well as the .NET Compact Framework for mobile devices. Non-Microsoft CLI implementations includeMono and DotGNU Portable.NET.
302. What Is C#?
C# is a new language designed by Microsoft to work with the .NET framework. In their “Introduction to C#” whitepaper, Microsoft describe C# as follows:
“C# is a simple, modern, object oriented, and type-safe programming language derived from C and C++. C# (pronounced “C sharp”) is firmly planted in the C and C++ family tree of languages, and will immediately be familiar to C and C++ programmers. C# aims to combine the high productivity of Visual Basic and the raw power of C++.”
Substitute ‘Java’ for ‘C#’ in the quote above, and you’ll see that the statement still works pretty well.
303. What Is The Difference Between A Private Assembly And A Shared Assembly?
The terms ‘private’ and ‘shared’ refer to how an assembly is deployed, not any intrinsic attributes of the assembly.
A private assembly is normally used by a single application, and is stored in the application’s directory, or a sub-directory beneath. A shared assembly is intended to be used by multiple applications, and is normally stored in the global assembly cache (GAC), which is a central repository for assemblies. (A shared assembly can also be stored outside the GAC, in which case each application must be pointed to its location via a codebase entry in the application’s configuration file.) The main advantage of deploying assemblies to the GAC is that the GAC can support multiple versions of the same assembly side-by-side.
Assemblies deployed to the GAC must be strong-named. Outside the GAC, strong-naming is optional.
304. How Can I Develop An Application That Automatically Updates Itself From The Web?
For .NET 1.x, use the Updater Application Block. For .NET 2.x, use ClickOnce.
305. Can I Write My Own .net Host?
Yes. For an example of how to do this, take a look at the source for the dm.net moniker developed by Jason Whittington and Don Box. There is also a code sample in the .NET SDK called CorHost.
306. Is It True That Objects Don’t Always Get Destroyed Immediately When The Last Reference Goes Away?
Yes. The garbage collector offers no guarantees about the time when an object will be destroyed and its memory reclaimed.& There was an interesting thread on the DOTNET list, started by Chris Sells, about the implications of non-deterministic destruction of objects in C#. In October 2000, Microsoft’s Brian Harry posted a lengthy analysis of the problem. Chris Sells’ response to Brian’s posting is here.
307. Should I Implement Finalize On My Class? Should I Implement Idisposable?
This issue is a little more complex than it first appears. There are really two categories of class that require deterministic destruction – the first category manipulate unmanaged types directly, whereas the second category manipulate managed types that require deterministic destruction. An example of the first category is a class with an IntPtr member representing an OS file handle. An example of the second category is a class with a System.IO.FileStream member.
For the first category, it makes sense to implement IDisposable and override Finalize. This allows the object user to ‘do the right thing’ by calling Dispose, but also provides a fallback of freeing the unmanaged resource in the Finalizer, should the calling code fail in its duty. However this logic does not apply to the second category of class, with only managed resources. In this case implementing Finalize is pointless, as managed member objects cannot be accessed in the Finalizer. This is because there is no guarantee about the ordering of Finalizer execution. So only the Dispose method should be implemented. (If you think about it, it doesn’t really make sense to call Dispose on member objects from a Finalizer anyway, as the member object’s Finalizer will do the required cleanup.)
For classes that need to implement IDisposable and override Finalize, see Microsoft’s documented pattern.
Note that some developers argue that implementing a Finalizer is always a bad idea, as it hides a bug in your code (i.e. the lack of a Dispose call). A less radical approach is to implement Finalize but include a Debug.Assert at the start, thus signalling the problem in developer builds but allowing the cleanup to occur in release builds.
308. Do I Have Any Control Over The Garbage Collection Algorithm?
A little. For example the System.GC class exposes a Collect method, which forces the garbage collector to collect all unreferenced objects immediately.
Also there is a gcConcurrent setting that can be specified via the application configuration file. This specifies whether or not the garbage collector performs some of its collection activities on a separate thread. The setting only applies on multi-processor machines, and defaults to true.
309. How Can I Find Out What The Garbage Collector Is Doing?
Lots of interesting statistics are exported from the .NET runtime via the ‘.NET CLR xxx’ performance counters. Use Performance Monitor to view them.
310. What Is The Lapsed Listener Problem?
The lapsed listener problem is one of the primary causes of leaks in .NET applications. It occurs when a subscriber (or ‘listener’) signs up for a publisher’s event, but fails to unsubscribe. The failure to unsubscribe means that the publisher maintains a reference to the subscriber as long as the publisher is alive. For some publishers, this may be the duration of the application.
This situation causes two problems. The obvious problem is the leakage of the subscriber object. The other problem is the performance degredation due to the publisher sending redundant notifications to ‘zombie’ subscribers.
There are at least a couple of solutions to the problem. The simplest is to make sure the subscriber is unsubscribed from the publisher, typically by adding an Unsubscribe() method to the subscriber. Another solution, documented here by Shawn Van Ness, is to change the publisher to use weak references in its subscriber list.
311. I Want To Serialize Instances Of My Class. Should I Use Xmlserializer, Soapformatter Or Binaryformatter?
It depends. XmlSerializer has severe limitations such as the requirement that the target class has a parameterless constructor, and only public read/write properties and fields can be serialized. However, on the plus side, XmlSerializer has good support for customising the XML document that is produced or consumed. XmlSerializer’s features mean that it is most suitable for cross-platform work, or for constructing objects from existing XML documents.
SoapFormatter and BinaryFormatter have fewer limitations than XmlSerializer. They can serialize private fields, for example. However they both require that the target class be marked with the [Serializable] attribute, so like XmlSerializer the class needs to be written with serialization in mind. Also there are some quirks to watch out for – for example on deserialization the constructor of the new object is not invoked.
The choice between SoapFormatter and BinaryFormatter depends on the application.
BinaryFormatter makes sense where both serialization and deserialization will be performed on the .NET platform and where performance is important. SoapFormatter generally makes more sense in all other cases, for ease of debugging if nothing else.
312. Xmlserializer Is Throwing A Generic “there Was An Error Reflecting Myclass” Error. How Do I Find Out What The Problem Is?
Look at the InnerException property of the exception that is thrown to get a more specific error message.
313. What Is Code Access Security (cas)?
CAS is the part of the .NET security model that determines whether or not code is allowed to run, and what resources it can use when it is running. For example, it is CAS that will prevent a .NET web applet from formatting your hard disk.
314. 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.
For example, using the default security policy, a control downloaded from a web site belongs to the ‘Zone – Internet’ code group, which adheres to the permissions defined by the ‘Internet’ named permission set. (Naturally the ‘Internet’ named permission set represents a very restrictive range of permissions.)
315. I’m Having Some Trouble With Cas. How Can I Troubleshoot The Problem?
Caspol has a couple of options that might help. First, you can ask caspol to tell you what code group an assembly belongs to, using caspol -rsg. Similarly, you can ask what permissions are being applied to a particular assembly using caspol -rsp
316. I Can’t Be Bothered With Cas. Can I Turn It Off?
Yes, as long as you are an administrator. Just run:
caspol -s off
317. Can I Look At The Il For An Assembly?
Yes. MS supply a tool called Ildasm that can be used to view the metadata and IL for an assembly.
318. Can Source Code Be Reverse-engineered From Il?
Yes, it is often relatively straightforward to regenerate high-level source from IL. Lutz Roeder’sReflector does a very good job of turning IL into C# or VB.NET.
319. How Can I Stop My Code Being Reverse-engineered From Il?
You can buy an IL obfuscation tool. These tools work by ‘optimising’ the IL in such a way that reverse-engineering becomes much more difficult
Of course if you are writing web services then reverse-engineering is not a problem as clients do not have access to your IL.
320. Can I Do Things In Il That I Can’t Do In C#?
Yes. A couple of simple examples are that you can throw exceptions that are not derived from System.Exception, and you can have non-zero-based arrays.
321. Does .net Replace Com?
.NET has its own mechanisms for type interaction, and they don’t use COM. No IUnknown, no IDL, no typelibs, no registry-based activation. This is mostly good, as a lot of COM was ugly. Generally speaking, .NET allows you to package and use components in a similar way to COM, but makes the whole thing a bit easier.
322. Is Dcom Dead?
Pretty much, for .NET developers. The .NET Framework has a new remoting model which is not based on DCOM. DCOM was pretty much dead anyway, once firewalls became widespread and Microsoft got SOAP fever. Of course DCOM will still be used in interop scenarios.
323. Is Com+ Dead?
Not immediately. The approach for .NET 1.0 was to provide access to the existing COM+ services (through an interop layer) rather than replace the services with native .NET ones. Various tools and attributes were provided to make this as painless as possible. Over time it is expected that interop will become more seamless – this may mean that some services become a core part of the CLR, and/or it may mean that some services will be rewritten as managed code which runs on top of the CLR.
324. Can I Use Com Components From .net Programs?
Yes. COM components are accessed from the .NET runtime via a Runtime Callable Wrapper (RCW). This wrapper turns the COM interfaces exposed by the COM component into .NET-compatible interfaces. For oleautomation interfaces, the RCW can be generated automatically from a type library. For non-oleautomation interfaces, it may be necessary to develop a custom RCW which manually maps the types exposed by the COM interface to .NET-compatible types.
325. Can I Use .net Components From Com Programs?
Yes. .NET components are accessed from COM via a COM Callable Wrapper (CCW). This is similar to a RCW (see previous question), but works in the opposite direction. Again, if the wrapper cannot be automatically generated by the .NET development tools, or if the automatic behaviour is not desirable, a custom CCW can be developed. Also, for COM to ‘see’ the .NET component, the .NET component must be registered in the registry.
326. Is Atl Redundant In The .net World?
Yes. ATL will continue to be valuable for writing COM components for some time, but it has no place in the .NET world.
327. How Do I Stop A Thread?
There are several options. First, you can use your own communication mechanism to tell the ThreadStart method to finish. Alternatively the Thread class has in-built support for instructing the thread to stop. The two principle methods are Thread.Interrupt() and Thread.Abort(). The former will cause a Thread Interrupted Exception to be thrown on the thread when it next goes into a WaitJoinSleep state. In other words, Thread.Interrupt is a polite way of asking the thread to stop when it is no longer doing any useful work. In contrast, Thread.Abort() throws a ThreadAbortException regardless of what the thread is doing. Furthermore, the ThreadAbortException cannot normally be caught (though the ThreadStart’s finally method will be executed). Thread.Abort() is a heavy-handed mechanism which should not normally be required.
328. How Do I Know When My Thread Pool Work Item Has Completed?
There is no way to query the thread pool for this information. You must put code into the WaitCallback method to signal that it has completed. Events are useful for this.
329. Should I Use Readerwriterlock Instead Of Monitor.enter/exit?
Maybe, but be careful. ReaderWriterLock is used to allow multiple threads to read from a data source, while still granting exclusive access to a single writer thread. This makes sense for data access that is mostly read-only, but there are some caveats. First, ReaderWriterLock is relatively poor performing compared to Monitor. Enter/Exit, which offsets some of the benefits. Second, you need to be very sure that the data structures you are accessing fully support multithreaded read access. Finally, there is apparently a bug in the v1.1 Reader Writer Lock that can cause starvation for writers when there are a large number of readers. Ian Griffiths has some interesting discussion on Reader Writer Lock here and here.
330. Tracing . Is There Built-in Support For Tracing/logging?
Yes, in the System.Diagnostics namespace. There are two main classes that deal with tracing – Debug and Trace. They both work in a similar way – the difference is that tracing from the Debug class only works in builds that have the DEBUG symbol defined, whereas tracing from the Trace class only works in builds that have the TRACE symbol defined. Typically this means that you should use System.Diagnostics.Trace.WriteLine for tracing that you want to work in debug and release builds, and System. Diagnostics. Debug. WriteLine for tracing that you want to work only in debug builds.
331. Can I Redirect Tracing To A File?
Yes. The Debug and Trace classes both have a Listeners property, which is a collection of sinks that receive the tracing that you send via Debug.WriteLine and Trace.WriteLine respectively. By default the Listeners collection contains a single sink, which is an instance of the DefaultTraceListener class. This sends output to the Win32 OutputDebugString() function and also the System.Diagnostics.Debugger.Log() method. This is useful when debugging, but if you’re trying to trace a problem at a customer site, redirecting the output to a file is more appropriate. Fortunately, the TextWriterTraceListener class is provided for this purpose.Here’s how to use the Text Writer Trace Listener class to redirect Trace output to a file:
Trace.Listeners.Clear();
FileStream fs = new FileStream( @”c:\log.txt”, FileMode. Create, FileAccess.Write);
Trace.Listeners.Add( new TextWriterTraceListener( fs ));
Trace.WriteLine( @”This will be writen to c:\log.txt!” );
Trace.Flush();
Note the use of Trace.Listeners.Clear() to remove the default listener. If you don’t do this, the output will go to the file and OutputDebugString(). Typically this is not what you want, because OutputDebugString() imposes a big performance hit.
332. Are There Any Third Party Logging Components Available?
Log4net is a port of the established log4j Java logging component.
333. Miscellaneous. How Does .net Remoting Work?
.NET remoting involves sending messages along channels. Two of the standard channels are HTTP and TCP. TCP is intended for LANs only-HTTP can be used for LANs or WANs (internet). Support is provided for multiple message serializarion formats. Examples are SOAP (XML-based) and binary. By default, the HTTP channel uses SOAP (via the .NET runtime Serialization SOAP Formatter), and the TCP channel uses binary (via the .NET runtime Serialization Binary Formatter). But either channel can use either serialization format.
There are a number of styles of remote access:
•SingleCall. Each incoming request from a client is serviced by a new object. The object is thrown away when the request has finished.
•Singleton. All incoming requests from clients are processed by a single server object.
•Client-activated object. This is the old stateful (D)COM model whereby the client receives a reference to the remote object and holds that reference (thus keeping the remote object alive) until it is finished with it.
Distributed garbage collection of objects is managed by a system called ‘leased based lifetime’. Each object has a lease time, and when that time expires the object is disconnected from the .NET runtime remoting infrastructure. Objects have a default renew time – the lease is renewed when a successful call is made from the client to the object. The client can also explicitly renew the lease.If you’re interested in using XML-RPC as an alternative to SOAP, take a look at Charles Cook’s XML-RPC.Net.
334. When Should You Call The Garbage Collector In .net?
As a good rule, you should not call the garbage collector. However, you could call the garbage collector when you are done using a large object (or set of objects) to force the garbage collector to dispose of those very large objects from memory. However, this is usually not a good practice.
335. What Is The Difference Between An Event And A Delegate?
An event is just a wrapper for a multicast delegate. Adding a public event to a class is almost the same as adding a public multicast delegate field. In both cases, subscriber objects can register for notifications, and in both cases the publisher object can send notifications to the subscribers. However, a public multicast delegate has the undesirable property that external objects can invoke the delegate, something we’d normally want to restrict to the publisher. Hence events – an event adds public methods to the containing class to add and remove receivers, but does not make the invocation mechanism public. See this post by Julien Couvreur for more discussion.
336. What Size Is A .net Object?
Each instance of a reference type has two fields maintained by the runtime – a method table pointer and a sync block. These are 4 bytes each on a 32-bit system, making a total of 8 bytes per object overhead. Obviously the instance data for the type must be added to this to get the overall size of the object. So, for example, instances of the following class are 12 bytes each:
class MyInt
{
…
private int x;
}
However, note that with the current implementation of the CLR there seems to be a minimum object size of 12 bytes, even for classes with no data (e.g. System.Object). Values types have no equivalent overhead.
337. Will My .net App Run On 64-bit Windows?
64-bit (x64) versions of Windows support both 32-bit and 64-bit processes, and corresponding 32-bit and 64-bit versions of .NET 2.0. (.NET 1.1 is 32-bit only)..NET 1.x apps automatically run as 32-bit processes on 64-bit Windows..NET 2.0 apps can either run as 32-bit processes or as 64-bit processes. The OS decides which to use based on the PE header of the executable. The flags in the PE header are controlled via the compiler /platform switch, which allows the target of the app to be specified as ‘x86’, ‘x64’ or ‘any cpu’. Normally you specify ‘any cpu’, and your app will run as 32-bit on 32-bit Windows and 64-bit on 64-bit Windows. However if you have some 32-bit native code in your app (loaded via COM interop, for example), you will need to specify ‘x86’, which will force 64-bit Windows to load your app in a 32-bit process. You can also tweak the 32-bit flag in the PE header using the SDK corflags utility.
338. .net 2.0 What Are The New Features Of .net 2.0?
Generics, anonymous methods, partial classes, iterators, property visibility (separate visibility for get and set) and static classes.
339. What’s New In The .net 2.0 Class Library?
Here is a selection of new features in the .NET 2.0 class library:
- Generic collections in the System.Collections.Generic namespace.
- The System.Nullable type. (Note that C# has special syntax for this type, e.g. int? is equivalent to Nullable)
- The GZipStream and DeflateStream classes in the System.IO.Compression namespace.
- The Semaphore class in the System.Threading namespace.
- Wrappers for DPAPI in the form of the ProtectedData and Protected Memory classes in the System. Security. Cryptography namespace.
- The IPC remoting channel in the System. Runtime. Remoting. Channels.Ipc namespace, for optimised intra-machine communication.
340. What Is Ajax?
Ajax stands for Asynchronous Javascript & XML. It is a web technology through which a postback from a client (browser) to the server goes partially, which means that instead of a complete postback, a partial postback is triggered by the Javascript XmlHttpRequest object. In such a scenario, web-application users won’t be able to view the complete postback progress bar shown by the browser. In an AJAX environment, it is Javascript that starts the communication with the web server.
Ajax technology in a website may be implemented by using plain Javascript and XML. Code in such a scenario may tend to look little complex, for which the AJAX Framework in .NET can be embedded in ASP.NET web applications.In addition to XML & Javascript, AJAX is also based on DOM-the Document Object Model technology of browsers through which objects of the browser can be accessed through the memory heap using their address. JSON-Javascript Object Notation is also one of the formats used in AJAX, besides XML.
So basically, in an AJAX-based web application, the complete page does not need to reload, and only the objects in context of ajaxification are reloaded. Ajax technology avoids the browser flickering
341. Can Ajax Be Implemented In Browsers That Do Not Support The Xmlhttprequest Object?
Yes. This is possible using remote scripts.
342. Can Ajax Technology Work On Web Servers Other Than Iis?
Yes, AJAX is a technology independent of web server the web application is hosted on. Ajax is a client (browser) technology.
343. Which Browsers Support The Xmlhttprequest Object?
Internet Explorer 5.0+, Safari 1.2, Mozilla 1.0/Firefox, Opera 8.0 +, Netscape 7
344. What Are Ajax Extensions?
The ASP.NET Ajax Extensions are set of Ajax-based controls that work in ASP.NET 2 (or above) based applications.
Ofcourse,they also need the Ajax runtime which is actually the Ajax Framework 1.0.
ASP.NET Ajax Extensions 1.0 have to be downloaded to run with ASP.NET 2.0
The new ASP.NET 3.5 Framework comes with the Ajax Library 3.5 (containing the Ajax Extensions 3.5). So in order to use the latest Ajax, simply download .NET 3.5 Framework.
Summary:
ASP.NET Ajax Extensions 1.0 -> For ASP.NET 2.0
ASP.NET Ajax Extensions 3.5 -> For ASP.NET 3.5
345. What Is Dojo?
Dojo is a third-party javascript toolkit for creating rich featured applications. Dojo is an Open Source DHTML toolkit written in JavaScript. It builds on several contributed code bases (nWidgets, Burstlib, f(m)), which is why we refer to it sometimes as a “unified” toolkit. Dojo aims to solve some long-standing historical problems with DHTML which prevented mass adoption of dynamic web application development.
346. How To Handle Multiple Or Concurrent Requests In Ajax?
For concurrent requests, declare separate XmlHttpRequest objects for each request. For example, for request to get data from an SQL table1, use something like this…
xmlHttpObject1.Onreadystatechange = functionfromTable1();
and to get data from another table (say table2) at the same time, use
xmlHttpObject2.Onreadystatechange = functionfromTable2();
Ofcourse, the XmlHttpObject needs to be opened & parameters passed too, like as shown below…
xmlHTTPObject1.open(“GET”,”http://”localhost// ” + “Website1/ Default1.aspx” true);
Note that the last parameter “true” used above means that processing shall carry on without waiting for any response from the web server. If it is false, the function shall wait for a response.
347. What Is The Role Of Scriptmanager In Ajax?
ScriptManager class is the heart of ASP.NET Ajax. Before elaborating more on ScriptManager, note that ScriptManager is class and a control (both) in Ajax.
The ScriptManager class in ASP.NET manages Ajax Script Libraries, partial page rendering functionality and client proxy class generation for web applications and services. By saying client proxy class, this means an instance of the Ajax runtime is created on the browser.
This class is defined in the System.Web.Extensions.dll. You will find this DLL in your system’s Global Assembly Cache at C:\Windows\Assembly (For XP)
The ScriptManager control (that we may drag on a web form) is actually an instance of the ScriptManager class that we put on a web page. The ScriptManager manages all the ASP.NET Ajax controls on a web page. Following tasks are taken care by the ScriptManager class:
1 – Managing all resources (all objects/controls) on a web page
2 – Managing partial page updates
3 – Download Ajax Script Library to the client (means to the browser). This needs to happen so that Ajax engine is accessible to the browsers javascript code.
4 – Interacting with UpdatePanel Control, UpdateProgress Control.
5 – Register script (using RegisterClientScriptBlock)
6 – Information whether Release OR Debug script is sent to the browser
7 – Providing access to Web service methods from the script by registering Web services with the ScriptManager control
8 – Providing access to ASP.NET authentication, role, and profile application services from client script after registering these services with the ScriptManager control
9 – Enable culture specific display of clientside script.
10 – Register server controls that implement IExtenderControl and IScriptControl interfaces.
ScriptManager class’ EnablePartialRendering property is true by default.
348. Can We Override The Enablepartialrendering Property Of The Scriptmanager Class?
Yes. But this has to be done before the init event of the page (or during runtime after the page has already loaded). Otherwise an InvalidOperationException will be thrown.
349. How To Use Multiple Scriptmanager Controls In A Web Page?
No. It is not possible to use multiple ScriptManager control in a web page. In fact, any such requirement never comes in because a single ScriptManager control is enough to handle the objects of a web page.
350. Whats The Difference Between Registerclientscriptblock, Registerclientscriptinclude And Registerclientscriptresource?
For all three, a script element is rendered after the opening form tag. Following are the differences:
1-RegisterClientScriptBlock – The script is specified as a string parameter.
2-RegisterClientScriptInclude – The script content is specified by setting the src attribute to a URL that points to a script file.
3-RegisterClientScriptResource – The script content is specified with a resource name in an assembly. The src attribute is automatically populated with a URL by a call to an HTTP handler that retrieves the named script from the assembly.
. NET Interview Questions and Answers :-
351. What Are Type/key Pairs In Client Script Registration? Can There Be 2 Scripts With The Same Type/key Pair Name?
When a script is registered by the ScriptManager class, a type/key pair is created to uniquely identify the script.
For identification purposes, the type/key pair name is always unique for dentifying a script. Hence, there may be no duplication in type/key pair names.
352. What Are The Modes Of Updation In An Updatepanel? What Are Triggers Of An Updatepanel?
An UpdatePanel has a property called UpdateMode. There are two possible values for this property:
1)Always
2)Conditional
If the UpdateMode property is set to “Always”, the UpdatePanel control’s content is updated on each postback that starts from anywhere on the webpage. This also includes asynchronous postbacks from controls that are inside other UpdatePanel controls, and postbacks from controls which are not inside UpdatePanel controls.
If the UpdateMode property is set to Conditional, the UpdatePanel control’s content is updated when one of the following is true:
1-When the postback is caused by a trigger for that UpdatePanel control.
2-When you explicitly call the UpdatePanel control’s Update() method.
3-When the UpdatePanel control is nested inside another UpdatePanel control and the parent panel is updated.
When the ChildrenAsTriggers property is set to true and any child control of the UpdatePanel control causes a postback. Child controls of nested UpdatePanel controls do not cause an update to the outer UpdatePanel control unless they are explicitly defined as triggers for the parent panel.
Controls defined inside a node have the capability to update the contents of an UpdatePanel.
If the ChildrenAsTriggers property is set to false and the UpdateMode property is set to Always, an exception is thrown. The ChildrenAsTriggers property is intended to be used only when the UpdateMode property is set to Conditional.
353. How To Control How Long An Ajax Request May Last?
Use the ScriptManager’s AsyncPostBackTimeout Property.
For example, if you want to debug a web page but you get an error that the page request has timed out, you may set </asp: script manager>
where the value specified is in seconds.
354. What Is Asp.net Futures?
ASP.NET AJAX Futures
The new release includes support for managing browser history (Back button support), selecting elements by CSS selectors or classes, and information on accessing “Astoria” Web data services. The Futures (July 2007) release adds:
History support for the Safari browser, inclusion of “titles”, encoding and encrypting of server-side history state and the ability to handle history in the client without a server requirement.
CSS Selectors APIs have been modified to be applicable to W3C recommendations.
A script resource extraction tool that allows you to create script files on disk that originate from embedded resources in assemblies. Important: this version of the browser history feature is now outdated and should not be used. Instead, please download the ASP.NET 3.5 Extensions Preview, which contains the new version.
355. What Are Limitations Of Ajax?
1)An Ajax Web Application tends to confused end users if the network bandwidth is slow, because there is no full postback running. However, this confusion may be eliminated by using an UpdateProgress control in tandem.
2)Distributed applications running Ajax will need a central mechanism for communicating with each other.
356. How To Trigger A Postback On An Updatepanel From Javascript?
Call the __doPostBack function. ASP.NET runtime always creates a javascript function named __doPostBack(eventTarget, eventArgument) when the web page is rendered. A control ID may be passed here to specifically invoke updation of the UpdatePanel.
357. Which Request Is Better With Ajax, Get Or Post?
AJAX requests should use an HTTP GET request while retrieving data where the data does not change for a given URL requested. An HTTP POST should be used when state is updated on the server. This is in line with HTTP idempotency recommendations and is highly recommended for a consistent web application architecture.
358. What Is The Asp.net Ajax Framework? What Versions Have Been Released So Far?
ASP.NET AJAX is a free framework to implement Ajax in asp.net web applications, for quickly creating efficient and interactive Web applications that work across all popular browsers.
The Ajax Framework is powered with
- Reusable Ajax Controls
- Support for all modern browsers
- Access remote services and data from the browser without tons of complicated script.
Versions of Ajax release
1-ASP.NET Ajax Framework 1.0 (earlier release to this was called the Atlas)
2-ASP.NET Ajax Framework 1.0 was available as a separate download for ASP.NET 2.0
359. What Is The Asp.net Control Toolkit?
Besides the Ajax Framework (which is the Ajax engine) and Ajax Extensions (which contain the default Ajax controls), there is a toolkit called the Ajax Control Toolkit available for use & download (for free). This is a collection of rich featured, highly interactive controls, created as a joint venture between Microsoft & the Developer Community.
360. How To Create An Ajax Website Using Visual Studio?
Using Visual Studio Web Developer Express 2005 & versions above it, Ajax based applications may easily be created. Note that the Ajax Framework & Ajax Extensions should be installed (In case of VS 2005). If using Visual Studio 2008 Web Developer Express or above, Ajax comes along with it (so no need of a separate installation).
361. How To Make Sure That Contents Of An Updatepanel Update Only When A Partial Postback Takes Place (and Not On A Full Postback)?
Make use of ScriptManager.IsInAsyncPostBack property (returns a boolean value)
362. What Are The Requirements To Run Asp.net Ajax Applications On A Server?
You would need to install ‘ASP.NET AJAX Extensions’ on your server. If you are using the ASP.NET AJAX Control toolkit, then you would also need to add the AjaxControlToolkit.dll in the /Bin folder.
363. Explain The Updatepanel?
The UpdatePanel enables you to add AJAX functionality to existing ASP.NET applications. It can be used to update content in a page by using Partial-page rendering. By using Partial-page rendering, you can refresh only a selected part of the page instead of refreshing the whole page with a postback.
364. Can I Use Asp.net Ajax With Any Other Technology Apart From Asp.net?
To answer this question, check out this example of using ASP.NET AJAX with PHP, to demonstrate running ASP.NET AJAX outside of ASP.NET. Client-Side ASP.NET AJAX framework can be used with PHP and Coldfusion.
365. Difference Between Server-side Ajax Framework And Client-side Ajax Framework?
ASP.NET AJAX contains both a server-side Ajax framework and a client-side Ajax framework. The server-side framework provides developers with an easy way to implement Ajax functionality, without having to possess much knowledge of JavaScript. The framework includes server controls and components and the drag and drop functionality. This framework is usually preferred when you need to quickly ajaxify an asp.net application. The disadvantage is that you still need a round trip to the server to perform a client-side action.
The Client-Side Framework allows you to build web applications with rich user-interactivity as that of a desktop application. It contains a set of JavaScript libraries, which is independent from ASP.NET. The library is getting rich in functionality with every new build released.
366. How Can You Debug Asp.net Ajax Applications?
Explain about two tools useful for debugging: Fiddler for IE and Firebug for Mozilla.
367. Can We Call Server-side Code (c# Or Vb.net Code) From Javascript?
Yes. You can do so using PageMethods in ASP.NET AJAX or using webservices.
368. Can You Nest Updatepanel Within Each Other?
Yes, you can do that. You would want to nest update panels to basically have more control over the Page Refresh.
369. How Can You To Add Javascript To A Page When Performing An Asynchronous Postback?
Use the ScriptManager class. This class contains several methods like the RegisterStartupScript(), Register Client ScriptBlock(), Register Client Script Include(), Register Array Declaration(), Register Client Script Resource(), Register Expand oAttribute(), Register On SubmitStatement() which helps to add javascript while performing an asynchronous postback.
370. Explain Differences Between The Page Execution Lifecycle Of An Asp.net Page And An Asp.net Ajax Page?
In an asynchronous model, all the server side events occur, as they do in a synchronous model. The Microsoft AJAX Library also raises client side events. However when the page is rendered, asynchronous postback renders only the contents of the update panel, where as in a synchronous postback, the entire page is recreated and sent back to the browser.
371. Is The Asp.net Ajax Control Toolkit(ajaxcontroltoolkit.dll) Installed In The Global Assembly Cache?
No. You must copy the AjaxControlToolkit.dll assembly to the /Bin folder in your application.
372. What Role “#&&” Plays In A Querysting?
# works as a fragment delimeter in a querysting. With which you can delimit history state.
While && preceeds, state information in query string.
373. Is There Any Property Names “isnavigating”?
Yes, it is available when you are managing browser history. With this property of “IsNavigating”, you can determine if postback is occurred for navigation purpose or for some other. Its set to true if its navigation call.
374. Tell Name Of All The Control Of Ajax?
There are 5 controls.
- ScriptManager
- UpdatePanel
- UpdateProgress
- Timer
- ScriptManageProxy
375. If There Are Multiple Update Panels On The Page Say Upd1 And Upd2. There Is A Button Placed In Upd1. How Can You Stop Upd2 To Update When Button Placed In Upd1 Is Clicked?
There is a property called UpdateMode which takes two values
1.Always : Default value of this property.
2.Conditional
When set to conditional, then that updatepanel’s content only gets updated when control placed in that update panel does a postback. Control placed in other update panel will not affect this updatepanel.
376. How Many Types Of Triggers Are There In Update Panel?
There are 2 types of triggers.
- PostBackTrigger :It does a full postback. This is useful when any such control which placed within updatePanel but it cannot work asynchronously. Like File Upload Control.
- AsyncPostBackTrigger : It does partial post back asynchronously.
377. What Is The Displayafter Property In Updateprogress Control?
Displayafter property specifies after how many seconds the loading image needs to be displayed in ajax postback. It takes values in seconds.
378. Is It Compulsory To Have Script Manager On The Page When You Are Using Any Control Of Ajax Control Tool Kit?
Yes. Page needs to have a script manager for ajax control tool kit controls to work.
379. Which Property Needs To Be Set For Script Manager Control To Extend The Time Before Throwing Time Out Expection If No Response Is Received From The Server?
AsyncPost BackTimeout Property needs to set which gets or sets a value that indicates the time, in seconds, before asynchronous postback time out if no response is received from the server.
< /asp :script manager >
The default value of this property is 90 second. We can also set the user defined error message using asyncpostbackerrormessage property (as shown in above code) for time out.
380. To Create Browser History Point Using Client Script, We Make Call Method…..
Sys.Application.addHistoryPoint. This method is used while adding history point to browser stack.
381. Default Value Of Enablehistory Attribute In Scriptmanager Is,
False
382. What Is A Design Pattern?
Design Pattern is a re-usable, high quality solution to a given requirement, task or recurring problem. Further, it does not comprise of a complete solution that may be instantly converted to a code component, rather it provides a framework for how to solve a problem.
In 1994, the release of the book Design Patterns, Elements of Reusable Object Oriented Software made design patterns popular.
Because design patterns consist of proven reusable architectural concepts, they are reliable and they speed up software development process.
Design Patterns are in a continious phase of evolution, which means that they keep on getting better & better as they are tested against time, reliability and subjected to continious improvements. Further, design patterns have evolved towards targeting specific domains. For example, windows-based banking applications are usually based on singleton patterns, e-commerce web applications are based on the MVC (Model-View-Controller) pattern.
Design Patterns are categorized into 3 types:
- Creational Patterns
- Structural Patterns
- Behavioral Patterns
383. What Are Creational Design Patterns?
The Creational Design Patterns focus on how objects are created and utilized in an application. They tackle the aspects of when and how objects are created, keeping in mind whats the best way these objects should be created.
Listed below are some of the commonly known Creational Design Patterns:
>>>Abstract Factory Pattern
>>>Factory Pattern
>>>Builder Pattern
>>>Lazy Pattern
>>>Prototype Pattern
>>>Singleton Pattern
384. Whats The Difference Between Abstract Factory Pattern And Factory Pattern?
In an abstract factory design, a framework is provided for creating sub-components that inherit from a common component. In .NET, this is achieved by creating classes that implement a common interface or a set of interfaces, where the interface comprises of the generic method declarations that are passed on to the sub-components. TNote that not just interfaces, but even abstract classes can provide the platform of creating an application based on the abstract factory pattern.
Example, say a class called CentralGovernmentRules is the abstract factory class, comprised of methods like Should Have Police() and Should Have Courts(). There may be several sub-classes like State1Rules, State2Rules etc. created that inheriting the class CentralGovernmentRules, and thus deriving its methods as well.
Note that the term “Factory” refers to the location in the code where the code is created.
A Factory Pattern is again an Object creation pattern. Here objects are created without knowing the class of the object. Sounds strange? Well, actually this means that the object is created by a method of the class, and not by the class’s constructor. So basically the Factory Pattern is used wherever sub classes are given the priviledge of instantiating a method that can create an object.
385. Describe The Builder Design Pattern
In a builder design pattern, an object creation process is separated from the object design construct. This is useful becuase the same method that deals with construction of the object, can be used to construct different design constructs.
386. What Is The Lazy Design Pattern?
The approach of the Lazy Design Pattern is not to create objects until a specific requirement matches, and when it matches, object creation is triggered. A simple example of this pattern is a Job Portal application. Say you register yourself in that site thus filling up the registration table, only when the registration table is filled, the other objects are created and invoked, that prompt you to fill in other details too, which will be saved in other tables.
387. What Is The Prototype Design Pattern?
A prototype design pattern relies on creation of clones rather than objects. Here, we avoid using the keyword ‘new’ to prevent overheads.
388. What Is The Singleton Design Pattern?
The Singleton design pattern is based on the concept of restricting the instantiation of a class to one object. Say one object needs to perform the role of a coordinator between various instances of the application that depend on a common object, we may design an application using a Singleton. Usage of Singleton patterns is common in Banking, Financial and Travel based applications where the singleton object consists of the network related information.
A singleton class may be used to instantiate an object of it, only if that object does not already exist. In case the object exists, a reference to the existing object is given. A singleton object has one global point of access to it.
An ASP.NET Web Farm is also based on the Singleton pattern. In a Web Farm, the web application resides on several web servers. The session state is handled by a Singleton object in the form of the aspnet_state.exe, that interacts with the ASP.NET worker process running on each web server. Note that the worker process is the aspnet_wp.exe process. Imagine one of the web servers shutting down, the singleton object aspnet_state.exe still maintains the session state information across all web servers in the web farm.
In .NET, in order to create a singleton, a class is created with a private constructor, and a “static readonly” variable as the member that behaves as the instance.
389. What Are Structural Design Patterns?
A structural design pattern establishes a relationship between entities. Thus making it easier for different components of an application to interact with each other. Following are some of the commonly known structural patterns:
>>> Adapter Pattern-Interfaces of classes vary depending on the requirement.
>>> Bridge Pattern-Class level abstraction is separated from its implementation.
>>> Composite Pattern-Individual objects & a group of objects are treated similarly in this approach.
>>> Decorator Pattern-Functionality is assigned to an object.
>>> Facade Pattern-A common interface is created for a group of interfaces sharing a similarity.
>>> Flyweight Pattern-The concept of sharing a group of small sized objects.
>>> Proxy Pattern-When an object is complex and needs to be shared, its copies are made. These copies are called the proxy objects.
390. What Are The Different Types Of Proxy Patterns?
1-Remote Proxy – A reference is given to a different object in a different memory location. This may be on a different or a same machine.
2-Virtual Proxy – This kind of object is created only & only when really required because of its memory usage.
3-Cache Proxy – An object that behaves as a temporary storage so that multiple applications may use it. For example, in ASP.NET when a page or a user control contains the OutputCache directive, that page/control is cached for some time on the ASP.NET web server.
391. What Is A Behavioral Design Pattern?
Behaviorial design patterns focus on improving the communication between different objects. Following are different types of behavioral patterns:
>>> Chain Or Responsibilities Pattern-In this pattern, objects communicate with each other depending on logical decisions made by a class.
>>> Command Pattern-In this pattern, objects encapsulate methods and the parameters passed to them.
>>> Observer Pattern-Objects are created depending on an events results, for which there are event handlers created.
392. What Is The Mvc Pattern (model View Controller Pattern)?
The MVC Pattern (Model View Controller Pattern) is based on the concept of designing an application by dividing its functionalities into 3 layers. Its like a triad of components. The Model component contains the business logic, or the other set of re-usable classes like classes pertaining to data access, custom control classes, application configuration classes etc. The Controller component interacts with the Model whenever required. The control contains events and methods inside it, which are raised from the UI which is the View component.
Consider an ASP.NET web application. Here, all aspx, ascx, master pages represent the View.
he code behind files (like aspx.cs, master.cs, ascx.cs) represent the Controller.
The classes contained in the App_Code folder, or rather any other class project being referenced from this application represent the Model component.
Advantages:
*Business logic can be easily modified, without affecting or any need to make changes in the UI.
*Any cosmetic change in the UI does not affect any other component.
393. What Is The Gang Of Four Design Pattern?
The history of all design patterns used in modern day applications derive from the Gang of Four (GoF) Pattern. Gang of Four patterns are categorized into 3 types:
1-Creational
2-Structural
3-Behavioral
The term “Gang of Four”(or “GoF” in acronym) is used to refer to the four authors of the book Design Patterns: Elements of Reusable Object-Oriented Software. The authors are Erich Gamma, Ralph Johnson, Richard Helm and John Vlissides.
394. When Should Design Patterns Be Used?
While developing software applications, sound knowledge of industry proven design patterns make the development journey easy and successful. Whenever a requirement is recurring, a suitable design pattern should be identified. Usage of optimal design patterns enhance performance of the application. Though there are some caveats. Make sure that there are no overheads imposed on a simple requirement, which means that design patterns should not be unnecessarily be used.
395. How Many Design Patterns Can Be Created In .net?
As many as one can think. Design patterns are not technology specific, rather their foundation relies on the concept of reusability, object creation and communication. Design patterns can be created in any language.
396. Describe The Ajax Design Pattern.
In an Ajax Design Pattern, partial postbacks are triggered asyncronously to a web server for getting live data. A web application would not flicker here, and the web site user would not even come to know that a request is being sent to the web server for live data.
Such a design pattern is used in applications like Stock Market Websites to get live quotes, News Websites for live news, Sports websites for live scores etc.
397. Explain The .net Framework.
.NET framework is a foundation calss on which you can build robust applications .This framework comprises of web forms,window forms andconsole applications..NET framework is basically a collection of services and classes.This exists as a layer between .NET applications and underlying operating systems.
.NET Framework is an Integrity of Windows Component which is used to develop Web Applications, Windows, Console Application and Webservices.
398. Describe The .net Framework Architecture.
.Net framework has two components:
1. .Net framework class library
2. Common language runtime.
399. What Are The Components Of The .net Framework.
.NET Framework provides enormous advantages to software developers in comparison to the advantages provided by other platforms. Microsoft has united various modern as well as existing technologies of software development in .NET Framework. These technologies are used by developers to develop highly efficient applications for modern as well as future business needs. The following are the key components of .NET Framework:
* .NET Framework Class Library
* Common Language Runtime
* Dynamic Language Runtimes (DLR)
* Application Domains
* Runtime Host
* Common Type System
* Metadata and Self-Describing Components
* Cross-Language Interoperability
* .NET Framework Security
* Profiling
* Side-by-Side Execution
400. Explain The Role Of Assembly In The .net Framework.
.Net Framework keeps executable code or DLL in the form of assembly. .Net Framework maintains multiple versions of the application in the system through assembly. The assemblies have MSIL code and manifest that contains metadata. The metadata contains version information of the assembly.
. NET Interview Questions & Answers Pdf Download :-
401. Describe The Gac In The .net Framework.
.Net Framework provides Global Assembly cache, a machine-wide cache. It stores shared assemblies that can be accessed by multiple languages.
402. What Is The Advantage Of Packaging Over Xcopy In .net?
Define connected and disconnected data access in ADO.NET| Describe CommandType property of a SQL Command in ADO.NET.|Define Dataview component of ADO.NET.|What are the ways to create connection in ADO.NET?|Access database at runtime using ADO.NET
403. .net Code Security Interview Questions With Answers
What is code security? What are the types? | Define Principal object. | Define declarative and imperative security. | Define role-based security. | Explain code access security. | What is Code group? | Define the use of Caspol.exe.
404. .net Debug & Trace Interview Questions With Answers
What is break mode? What are the options to step through code? | Debug Vs Trace. | Define trace class. Define Listeners collection of Trace and Debug objects. | Define Trace Switches.
405. What Is Asp.net 2.0 Ajax?
ASP.NET 2.0 AJAX is an AJAX-oriented .NET library that runs on .NET 2.0. Though ASP.NET 2.0 AJAX is an AJAX library and can be used to perform AJAX operations, it is really much more. ASP.NET 2.0 AJAX offers many of the same types of features of the server-side ASP.NET.
406. The Components In The Asp.net 2.0 Ajax Packaging?
The packaging of ASP.NET 2.0 AJAX can be fairly confusing. The basics of the packaging are.
ASP.NET 2.0 AJAX Extensions 1.0—The ASP.NET 2.0 AJAX Extensions 1.0, also referred to as the RTM/Core code, is an independent download. This contains the functionality that will receive support from Microsoft in the initial release of the product. The source code is available.
ASP.NET AJAX Futures Community Technology Preview (CTP) — The ASP.NET 2.0 AJAX framework contains a set of functionality that is experimental in nature. This functionality will eventually become integrated with the RTM/Core code. During the initial release, the Futures CTP functionality will be a separate download from the RTM/Core bits. This will not receive specific support from Microsoft beyond community-based support. The CTP bits require that the RTM/Core bits already be installed for the CTP bits to be installed. The CTP is also referred to as Value-Added Bits.
Microsoft AJAX Library—The Microsoft AJAX Library is a set of JavaScript client libraries that make up the standard download to a web browser and provide much of the support for AJAX in the client. These libraries will work with a non-IIS server and are available as a separate download. This library is included in the ASP.NET 2.0 AJAX Extensions 1.0 download as well as being available as a separate download.
ASP.NET AJAX Control Toolkit — The AJAX Control Toolkit is a separate download that provides a set of client-side GUI widgets that integrate with the ASP.NET 2.0 AJAX framework. The toolkit is licensed separately from the framework and includes the source code for developers who would like to review the source.
407. What Are The Benefits Of Ajax?
Ajax stands for “Asynchronous JavaScript and XML.” It is a term used to refer to several related Web development tools. Ajax is one of several technologies comprising Web 2.0 and is designed to create efficient, interactive Web content and dynamic online user interfaces without requiring a separate desktop download. For both users, designers and businesses, Ajax provides a number of benefits over traditional Web design systems.
408. What’s The .net Collection Class That Allows An Element To Be Accessed Using A Unique Key?
HashTable.
409. Balancing Client And Server Programming With Asp.net Ajax
Without the advanced use of JavaScript running in the browser, web applications have their logic running on the server. This means a lot of page refreshes for potentially small updates to the user’s view. With AJAX, much of the logic surrounding user interactions can be moved to the client. This presents its own set of challenges. Some examples of AJAX use include streaming large datasets to the browser that are managed entirely in JavaScript. While JavaScript is a powerful language, the debugging facilities and options for error handling are very limited. Putting complex application logic on the client can take a lot of time, effort, and patience. ASP.NET AJAX allows you to naturally migrate some parts of the application processing to the client while leveraging partial page rendering to let the server control some aspects of the page view.
410. Asp.net 2.0 Features?
ASP.NET 2.0 was designed to make web development easier and quicker.
Design goals for ASP.NET 2.0:
- Increase productivity by removing 70% of the code
- Use the same controls for all types of devices
- Provide a faster and better web server platform
- Simplify compilation and installation
- Simplify the administration of web applications
411. What Is The Smallest Unit Of Execution In .net?
An Assembly.
412. Will The Finally Block Get Executed If An Exception Has Not Occurred?
Yes.
413. Asp.net Application Life Cycle
This topic describes the application life cycle for ASP.NET applications that are running in IIS 7.0 in Integrated mode and with the .NET Framework 3.0
414. What’s Difference Between “optimistic” And “pessimistic” Locking?
In pessimistic locking when user wants to update data it locks the record and till then no one can update data. Other user’s can only view the data when there is pessimistic locking.
In optimistic locking multiple users can open the same record for updating, thus increase maximum concurrency. Record is only locked when updating the record. This is the most preferred way of locking practically. Now a days in browser based application it is very common and having pessimistic locking is not a practical solution.
415. Differences Between “dataset” And “datareader”.
Dataset:
- DataSet object can contain multiple rowsets from the same data source as well as from the relationships between them.
- Dataset is a disconnected architecture
- Dataset can persist data.
- A DataSet is well suited for data that needs to be retrieved from multiple tables.
- Due to overhead DatsSet is slower than DataReader.
Datareader
- DataReader provides forward-only and read-only access to data.
- Datareader is connected architecture. It has live connection while reading data
- Datareader can not persist data.
- Speed performance is better in DataReader.
416. What Are The Steps Involved To Fill A Dataset?
a. Create a connection object.
b. Create an adapter by passing the string query and the connection object as parameters.
c. Create a new object of dataset.
d. Call the Fill method of the adapter and pass the dataset object.
Example:
VB.NET Code:-
Dim strSQL as String
strSQL = “SELECT * from tbl”
Dim sqlCmd As New SqlCommand(strSQL, sqlConn)
Dim sda As New SqlDataAdapter(sqlCmd)
Dim ds As New DataSet
sda.Fill(ds)
417. Describe The .net Base Class Library.
The .NET Framework class library escribe is a library of classes, interfaces, and value types.
This library system functionalities and is the foundation of .NET Framework applications, components, and controls.
418. What Is The Difference Between Value Types And Reference Types?
Value types:
* Value types can be created at compile time.
* Stored in stack memory.
* Garbage collector can’t access the stack
* value types holds the data directly
* No default values will be stored in value types
* Examples for value types: Predefined datatypes,structures,enums
Reference types:
* Reference types can be created at run time.
* Stored in heap memory
* Garbage collector can access heap
* Reference types holds the data indiredtly
* Reference types holds default value
* Examples for reference types: Classes,objects,Arrays,Indexers,Interfaces
419. Can You Store Multiple Data Types In System.array?
No.
420. Explain An Object, Class And Method.
An object is an entity that keeps together state and behaviors. For instance, a car encapsulates state such as red color, 900 cc etc and behaviors as ‘Start’, ‘Stop’ etc., so does an object.
An object is an instance of a class. If you consider “Dog” as a class, it will contain all possible dog traits, while object “German Shepherd” contains characteristics of specific type of dog.
A class represents description of objects that share same attributes and actions. It defines the characteristics of the objects such as attributes and actions or behaviors. It is the blue print that describes objects.
Method is an object’s behavior. If you consider “Dog” as an object then its behaviors are bark, walk, run etc.
421. What Is The Difference Between Localization And Globalization?
Globalization is process of identifying how many resources needs to be localized to adopt a multiple culture support, while Localization is actual process of translating resource to a specific culture. So Localization is the part of Globalization.
422. What Is Unicode?
Unicode (UCS-2 ISO 10646) is a 16-bit character encoding that contains all of the characters (216 = 65,536 different characters total) in common use in the world’s major languages, including Vietnamese. The Universal Character Set provides an unambiguous representation of text across a range of scripts, languages and platforms. It provides a unique number, called a code point (or scalar value), for every character, no matter what the platform, no matter what the program, no matter what the language. The Unicode standard is modeled on the ASCII character set. Since ASCII’s 7-bit character size is inadequate to handle multilingual text, the Unicode Consortium adopted a 16-bit architecture which extends the benefits of ASCII to multilingual text.
Unicode characters are consistently 16 bits wide, regardless of language, so no escape sequence or control code is required to specify any character in any language. Unicode character encoding treats symbols, alphabetic characters, and ideographic characters identically, so that they can be used simultaneously and with equal facility. Computer programs that use Unicode character encoding to represent characters but do not display or print text can (for the most part) remain unaltered when new scripts or characters are introduced.
The Unicode Standard has been adopted by such industry leaders as Apple, HP, IBM, Microsoft, Oracle, SAP, Sun, Sybase, Unisys, and many others. Unicode is required by modern standards such as XML, Java, .NET, ECMAScript (JavaScript), LDAP, CORBA 3.0, WML, etc., and is the official way to implement ISO/IEC 10646. It is supported in many operating systems, all modern browsers, and many other products. The emergence of the Unicode Standard, and the availability of tools supporting it, offers significant cost savings over the use of legacy character sets. It allows data to be transported through many different systems without corruption.
423. What Are Resource File And How Do We Generate Resource File?
Resource files are used to separate the implementation of the application from its User Interface. Thus, it eliminates the need to change a various sections of code to add a different language.
424. Describe How To Implement Globalization And Localization In The Use Interface In .net.
Globalization is the process of making an application that supports multiple cultures without mixing up the business logic and the culture related information of that application.
Localization involves adapting a global application and applying culture specific alterations to it.
The classes and the interfaces provided by the System.Resources allow storing culture specific resources.
The ResourceManager class performs:
A look up for culture-specific resources
Provision of resource fallback when a localized resource does not exist
Supports for resource serialization
425. Explain How To Prepare Culture-specific Formatting In .net.
The CutureInfo class can be used for this purpose. It represents information about a specific culture including the culture names, the writing system, and the calendar. It also provides an access to objects that provide information for common operations like date formatting and string sorting.
426. Explain The Use Of Resource Manager Class In .net.
The ResourceManager class performs:
- A look up for culture-specific resources
- Provision of resource fallback when a localized resource does not exist
- Supports for resource serialization
427. Asp.net Globalization-localization
Here you have description of globalization, localization and their approaches in ASP.NET. It also describes resource files and satellite assemblies.
428. Asp.net Overview
This article includes brief about ASP.NET, advantages of ASP.NET, navigation sequence of ASP.NET web form, web Form components, .NET framework, event handlers in ASP.NET, web form events, server control events in ASP.NET, and server controls vs. HTML controls, validation controls, navigation, and steps to store cookies, ways to authenticate and authorize users in ASP.NET etc.
429. What’s The Top .net Class That Everything Is Derived From?
System.Object.
430. What Kinds Of Fonts Are Supported With Silverlight?
Beyond standard and western fonts, Silverlight also supports East Asian characters, double-byte characters, and can work with any East Asian font or Middle Eastern font by using the glyphs element and a supporting TrueType font file that supports the requested glyph.
431. How Much Is The Pay-for-use Service If I Chose Not To Use Microsoft-sponsored Advertising?
We’re not prepared to discuss the final pricing of the nonadvertising-based product at this time except to say that it will be extremely cost competitive. The advertising-based product will continue to be free in perpetuity.
432. What Is The Difference Between Silverlighttm Streaming And Other Video Sharing Services?
SilverlightTM Streaming is focused on developers who want to build their own media-rich applications or Web sites. Unlike other video sharing services, there are no third-party branding requirements for the use of SilverlightTM Streaming, and the developer is in full control over their rich media experience within the context of their Web site.
433. Why Is This Service Branded With Windows Livetm?
This service is part of the Windows LiveTM Platform.
434. It’s Free-what’s The Catch?
There is no catch. This is a new offering designed to accelerate the development of the next generation of media rich applications.
435. Can I Tap Into Other Windows Livetm Services?
Yes, customers are able to use Windows Live IDTM and other Windows Live APIs today and in the future. Silverlight provides a great platform to consume these services.
436. Do You Support Digital Rights Management To Protect My Videos?
In the future, SilverlightTM Streaming will provide support for DRM-encoded video as an optional paid turnkey offering.
437. How Does The Service Stream Content?
Content is streamed progressively using a progressive download mechanism today. Active streaming support using Windows Media Services is being considered based on customer feedback in the future.
438. Can I Stream Live Content/events?
No, the service only supports on-demand content today. Customers requiring additional capabilities are encouraged to contact a Windows Media Streaming Hosting Provider.
439. Do I Need To Have The Latest Version Of Windows Media Player Installed?
No. Silverlight is completely independent and when installed is less than 2 MB in size.
440. What Audio Or Video Formats Are Supported In Silverlight?
Silverlight supports Windows Media Audio and Video (WMA, WMV7–9) and VC-1, as well as MP3 audio. Additional formats may be available by the final release based on customer feedback.
441. Will Silverlight Support All The Codecs Windows Media Player Supports?
Since Silverlight is a lightweight cross-platform technology, it only carries the most common codecs that are needed for Web playback. However, we are gathering information from customers about the needed codecs and can update Silverlight when necessary.
442. Will Silverlight Support Live Streaming Events As Well As Downloading Media?
Yes, in the final release. The February CTP is optimized for progressive “download and play” scenarios to test the platform.
443. Does Silverlight Support Mpeg4 And H.264 Video, Or Advanced Audio Coding (aac) Audio, Or Flash Video?
No. However, content from many of these formats can be transcoded into formats that are supported by Silverlight, such as by an automated server function (many available third-party solutions support this workflow), and then incorporated into a Silverlight-based application.
444. Explain Silverlight Architecture.
Silver light is a plug-in used for different platforms and browsers. It is designed for offering media experiences based on .net platform.
445. Difference Between Wpf And Silverlight
In terms of features and functionality, Silver light is a sub set of Windows Presentation Foundation.
446. What Are The Limitations Of Using External Fonts In Silverlight?
One of the major challenges is to use a downloader and some of the SetFontSource methods on a TextBlock to perform it.
447. Describe How To Perform Event Handling In Silver Light
Event handling is performed in two event cases – Input events and Non-input events.
448. Explain How To Add The Reference Of A Class Library Project In Silverlight Application Project
The following is the process for adding the reference library project: After defining business object classes in another project.
449. What Is Silverlight.js File? Explain With An Example.
Silverlight.js file is a Java Script helper file. It supports for adding a Silverlight application to a web page through Java Script. It has a number of methods defined to help with, most importantly the create Object and createObjectEx. The following are certain notable functions and event handlers :
-getSilverlight, isBrowserRestartRequired, isInstalled, onGetSilverlight, onSilverlightInstalled, WaitForInstallCompletion.
The Silverlight.js file is installed along with Silverlight 2 SDK.
Using Visual Studio 2008, one can create a quick sample project by selecting File->New Project and selecting Silverlight Application. After clicking OK, select “Automatically generate a test page to host Silverlight at build time”. Click on OK. Right click on the new project and add an HTML page.
450. What Is A .xap File? Explain With An Example.
A .xap file is an application package based on Silverlight which will be generated when the Silverlight project is built. This file helpful in creating heavily client based Silverlight applications.
451. Explain How Can Silverlight Use Asx Files.
An ASX file is an XML file in which media files are specified in the playlist. Using ASX files in silver is pretty simple. Assign the ‘source’ property of a MediaElement object to the ASX file name.
452. Explain Silverlight Application Life-cycle
The entry point of Silverlight applications is Silverlight Application class. It provides various services which is commonly needed by Silverlight application.
453. What Is The Role Of Silverlight Plugin In The Silverlight Application Life-cycle?
The Silverlight plug-in loads the core services of Silverlight followed by Silverlight Common Language Runtime. CLR creates domains for applications.
454. Explain The Purpose Of Storyboard.targetproperty.
Using Storyboard.TargetProperty, the properties of an object can be assigned with values. The objects are referred by Storyboard. TargetName attribute. The following snippet illustrates the change of width and color of a rectangle object.
455. Why Is Xap Important?
Using XAP, Silverlight applications which are heavily client based can be created by managing code. The managed code, benefits of using the tools such as Visual Studio 2008 with Silverlight Tools Beta version 2 , are utilized by using XAP.
456. How Does Xap Work?
The .xap file is used for transferring and containing the assemblies and resources of an application with managed code. This code must be written within the Silverlight browser plugin.
Once the .xap file is created, the Silverlight 2 plug-in will download the file and executes in a separate work space
457. Explain The Use Of Clientbin Folder In Silverlight.
The ClientBin folder is used for placing .xap file of a Silverlight application. This folder can be kept anywhere in the web application.
458. What Is Clipping In Silverlight?
Clipping is a modification to a given image / object based on the geometry type–like a line, rectangle, ellipse or even a group geometry objects.
459. What Is The Parent Xaml Tag Of Silverlight Page? Explain Its Purposes.
The’UserConrol’ is the parent xaml tag of a Silverlight page. All other tags are authored under UserControl tag. Developers are given a facility to implement new custom controls and create re-usable user controls.
460. Explain With Example How To Change The Default Page Of The Silverlight Application.
The RootVisual property of Application_Startup event in App.xaml file needs to be set to change the default Silverlight application page. The following code snippet sets the property.
461. How Many Xaml Files Are Created When You Create A New Project In Silverlight Through Visual Studio And What Are The Uses Of Those Files?
There are two xaml files are created when a new project in Silverlight is created through Visual Studio.
462. What Are The Programming Language That Can Be Used To Write The Backend Of The Silverlight Application?
Visual Basic or Visual C# can be used for authoring code for the backend of the Silverlight application.
463. Explain How To Set Silverlight Contents Width As 100%.
Usually the UserConrol will be spread full screen. The contents width and height can also be set by using width and height attributes.
464. Can You Provide A List Of Layout Management Panels And When You Will Use Them?
The following are the list of Layout Management Panels: 1. Canvas Panel: Simple layouts use canvas panel and when there is no requirement of resizing the panel. The controls will overlap each other at the time of resizing the panel.
465. Explain How To Apply Style Elements In A Silverlight Project?
Application resources utilize the style elements for supporting the forms. The App.xaml file could be used to contain an application resource XML construct. Each style’s target type is set to the control that needs the style.
466. What Are The Main Features And Benefits Of Silverlight?
The following are the features of SilverLight: 1. Built in CLR engine is available for delivering a super high performance execution environment for the browser.
467. When Would One Use Silverlight Instead Of Asp.net Ajax?
Silverlight media experiences and Rich Internet Applications can be enhanced by the existing ASP.NET AJAX applications. Web applications and ASP.NET AJAX technologies are integrated in Silverlight.
468. True Or False: A Web Service Can Only Be Written In .net?
False
469. Does Silverlight Have A System.console Class? Why?
Yes. Silverlight have System.Console class. It is cocooned in the SecurityCritical attribute. It is so for using for internal uses and making it useless for remote usage.
470. What Are The Properties That Have To Be Initialized For Creating A Silverlight Control Using Createsilverlight()?
The properties ‘source’ and ‘elementID’ are to be initialized. The ‘source’ attribute can be a ‘.xaml’ file or an ‘.aspx’ file.
471. Explain The Path Instructions In Xaml
The instruction of XAML allows to draw and fill a path. Various points in the path represents are represented by the Data attribute. The attribute includes M which means to move to command, moves to a coordinate and C represents the absolute path. The H represents line to command.
The following is the code snippet to draw a path:
472. Explain The Resemblance Between Css And Silverlight, Regarding Overlapping Objects.
Silverlight content is hosted on the tag. CSS of DIV can be changed as it is for other HTML documents. The changes can be for absolute positioning, z-indexing, top and left properties etc.
473. What Kind Of Brushed Does Silverlight Support?
Silverlight brush objects supports for painting with solid colors, linear gradients, radical gradients and images.
SolidColorBrush is used to paint a closed object such as rectangle
LinearGradientBrush – used to paint a linear gradient like glass, water and other smooth surfaces.
RadialGradientBrush – used to paint a radial gradient which is a blend together along an axis.
474. Explain The Mouse Events That Silverlight Currently Supports.
The mouse events that supports silverlight are
LostMouseCapture – occurs when an UI element lost mouse capture
MouseMove – occurs when the mouse position changes
MouseEnter – occurs when the mouse pointer enters into the bounding area of an object
MouseLeave – occurs when the mouse pointer leaves the bounding area of an object
MouseLeftButtonDown – occurs when the left mouse button is down
MouseLeftButtonU – occurs when the left mouse button is up followed by MouseLeftButtonDown
475. Difference Between Mouseleftbuttondown And Mouseleftbuttonup In Silverlight.
The difference is the action of the button. Once mouse button is pressed MouseLeftButtonDown event is invoked and MouseLeftButtonUp event is invoked after pressing left mouse button down and release it.
476. What Is The Function Used For Removing An Event Listener?
The method removeEventListener() is used for deleting an event listener. The parameters for this method are eventName and listener.
477. How Would You Implement Drag-and-drop In Silverlight?
Drag and drop in Silverlight can be implemented by using Drag Drop Manager by using DragSource and DropTarget controls. DragSource makes any control to be draggable and DropTarget defines a location in the application to drop the DragSources.
478. What Are The Properties Of The Eventargs Argument When Capturing Keyboard Events?
The properties of eventArgs are types of keys like shift, ctrl and mouse actions, mouse pointer coordinates, x coordinate value, y coordinate value.
479. What Is The Function Used To Get A Reference To An Object Inside The Silverlight Control?
The method findName() is used to refer an object inside the Silverlight control. The container reference is made in the Container.xaml and the corresponding Java Script file is called as Container.js. Now to access the object use the following function:
Container[1].Element.findName(“MyImageControl”).Source = “myPersonalImage.jpg”
480. What Objects Support Tranformations? What Are The Transformations That Silverlight Supports For The Elements?
The objects Ellipse and Rectangle are supported for transformations. The transformations that Silverlight supports for elements are rotations, scales, skews, and translations.
481. Explain The Steps Needed To Be Performed In Order To Create An Animation In Xaml
Animation is performed by using Storyboard.TargetName property. For example, to animate an object, the following are the steps:
– Write tag.
– Embed tag
– Write along with begin time and Storyboard.TargetName, Storyboard.TargetProperty attributes.
– Use tag along with KeyTime and value attributes
– Close all the corresponding tags.
The following is the snippet of XAML file to animate an object
482. What Are The Animation Types Supported By Silverlight?
Silverlight supports 2 types of animations:
From/To/By animation:
Used for animating between a starting and ending value:
– From is used to set the starting value
– To is used to set the ending value
– By is used for setting ending value relative to the starting value of the animation
Key-frame animation
Key frame objects animates between a series of values. They are powerful than From/To/By animations, as there is flexibility to specify any number of target values and even interpolation method can also be controlled.
483. Explain The Concept Of Keyframe. What Is The Difference Between Silverlight And Flash Regarding Animations?
The value of the target property is animated by a key-frame animation. A transition among its target values over its duration is created. However the targeted values can by any number.
The differences are:
Flash:
– Has no notion of animation other than matrices transformation.
– Binary shape records are used to store the shapes.
– Supports multiple video formats.
– Works in IE, Firefox, Safari and Chrome
Silverlight:
– Supports the WPF animation model.
– Uses XAML to output a simple XML object.
– Implements industry standard VC-1 codec for video and supports for WMV and WMA.
– Works after installing silverlight plug-in in IE
– Works after plug-in with warnings about the execution, was installed and works
– Not supported by Safari
– The animated box will be shown but will not animate.
484. How Many Classes Can A Single .net Dll Contain?
It can contain many classes.
485. How Could You Determine The Media Position When Playing A Video In Silverlight?
The elements mePlayer.width and mePlayer.height retrieves the positions of the media in silver light. The source of the media player is set by mePlayer.Source , using the uri resource.
486. Name Two Properties Common In Every Validation Control?
ControlToValidate property and Text property.
487. What Is The Global.asax Used For?
The Global.asax (including the Global.asax.cs file) is used to implement application and session level events.
488. How Could You Modify Xaml Content From Javascript?
Place xaml in Java Script using createFromXaml function. Use
– object.SetFontSource(downloader) for adding the font files in the downloaded content.
– object.SetSource(downloader, part) for setting the value of an Image object
– object.SetValue(propertyName, value) for setting the value .
489. What Are The Necessary Step That Need To Be Performed In Order To Download Content From Within Silverlight?
A collection independent files that contain XAML content, media assets, and other application information can be downloaded from within Silverlight.
To download the content, the System.net.WebClient class is used.
– Request the content. The WebClient class empowers you to request the content.
– Specify how to load the content.
To download string element content use DownloadStringAsync method. This method starts downloading the process which runs asynchronously. Requesting Binary Content
To download binary element content, use OpenReadAsync method. The contents includes compressed files, application modules and media files.
490. What Asp.net Control Can Embed Xaml Into Asp.net Pages?
The asp:Silverlight is used to embed XAML into ASP.Net pages.The following code snippet illustrates this:
491. Does Silverlight Supports Database Connectivity? Explain
Silverlight supports database connectivity. It is done through LINQ to SQL classes.
– Add a new Web to the solution for hosting the control” radio button is checked. And click on OK.
– Add a new LINQ to SQL class in App_Code folder
– Use server explorer and drag and drop the required table in DataClass
– Add a new Silverlight-enabled WCF Service in Web Project.
– Write code on Service.cs to retrieve data from tables.
– Use DataClassesDataContetxt class to create objects.
– Use a variable to store the data from a table
492. What Is The Codec Silverlight Supports For Hd Streaming?
The following formats are supported for Video streaming:
– WMV1: Windows Media Video 7
– WMV2: Windows Media Video 8
– WMV3: Windows Media Video 9
– WMVA: Windows Media Video Advanced Profile, non-VC-1
– WMVC1: Windows Media Video Advanced Profile, VC-1
The following formats are supported for Audio streaming:
– WMA 7: Windows Media Audio 7
– WMA 8: Windows Media Audio 8
– WMA 9: Windows Media Audio 9
– MP3: ISO/MPEG Layer-3
493. How Can Iis Improve Silverlight Streaming?
IIS smooth streaming enables for delivering HD streams smoothly on any device. IIS smooth streaming is an extension of IIS7 Media Services 3.0. It enables adaptive live streaming through HTTProtocols.
494. Whats An Assembly?
Assemblies are the building blocks of the .NET framework. Overview of assemblies from MSDN
495. What Is Smpte Vc-1?
VC-1 is an industry-standard video format, recognized by the Society of Motion Picture and Television Engineers (SMPTE), and most notably ships in all HD-DVD and Blu-ray Disc?certified electronics, hardware, and tools. Windows Media Video 9 (WMV-9) is the Microsoft implementation of the SMPTE VC-1 standard video codec. Microsoft initiated development of the standard with the release of WMV-9 to SMPTE.
496. What Is Xaml? Are Xaml File Compiled Or Built On Runtime?
XAML stands for Extensible Application Markup Language. It is an XML based markup language. XAML is the language for visual presentation of the application development in MS-Expression Blend. Expression Blend application creation is writing XAML code in design view of Expression Blend.
Usually XAML files are compiled and also support parsing during runtime. At runtime XAML file is not seen. When the XAML based project is build, a “g.cs” file will be created in obi\Debug folder.
497. What Are Dependency Properties In Silverlight?
Dependency properties are exposed as CLR properties. Dependency properties purpose is to provide a way of computing the value of a property that is based on the value of other inputs.
498. Will Silverlight Support Digital Rights Management?
For content providers, Silverlight will support digital rights management (DRM) built on the recently announced Microsoft PlayReady content access technology on Windows-based computers and Macintosh computers
499. Explain The Relationship Between Silverlight And Windows Media Technologies?
Silverlight is built on top of Windows Media enabling developers and designers to collaborate in building media experiences and RIAs. Silverlight is released by the Server and Tools Division at Microsoft as a part of the .NET Framework.
500. What Is The Relationship Between Silverlight And Windows Media Player?
The Silverlight browser plug-in is a separate component, independent of Windows Media Player. Silverlight is designed for delivery of cross-platform, cross-browser media experiences and rich interactive applications (RIAs) inside a Web browser combining audio, video, animation, overlays, and more. Windows Media Player delivers a breadth of local playback and user focused experiences, while also offering support for application and Web page embedding.
501. Will Silverlight-based Applications And Content Run On Any Web Server? What Are The Benefits To Running It On Servers Running Windows?
Silverlight works with any web server just like HTML. Video and audio content can also be downloaded and played back from any Web server platform.The main advantages of Windows server-based distribution of Silverlight applications include Windows Media Services with Fast Stream and Fast reconnect technologies, lower distribution costs and tap into the full Windows server ecosystem of platform components and partner solutions.
502. What Features Are Missing From Silverlight Presentation Markup That Will Be Supported In Windows Presentation Foundation?
High-end Windows specific features of WPF, such as real 3D, hardware-based video acceleration, and full document support, will not be supported in Silverlight. This is by design in order to serve Silverlight’s cross-browser, cross-platform reach scenario that demands a light weight plug-in.
503. Is Silverlight Supported On Various Locales?
Silverlight installs on localized versions of Macintosh computers and Windows. At this time, the installation is available in an international English format. Final releases will render international text (using double-byte characters) and support the full 64K Unicode character set. Silverlight uses simple input mechanism that treats all the languages in the same way.
504. What Are The Different Ways To Display Text With Silverlight?
Silverlight supports displaying static preformatted text that is comprised out of glyph elements and also dynamic text that uses TextBlock. With glyphs, one needs to position the characters individually while TextBlock supports simple layout.
505. What Is Xaml ?
Extensible Application Markup Language (XAML,pronounced zammel) is a declarative XML-based language created by Microsoft which is used to initialize structured values and objects.
506. What Is The Difference Between Wpf And Silverlight?
Silverlight uses a particular implementation of a XAML parser, with that parser being part of the Silverlight core install. In some cases, the parsing behavior differs from the parsing behavior in Windows Presentation Foundation (WPF), which also has a particular implementation.
507. Can You Name Built-in Layout Panels You Have Been Using With Silverlight?
You are looking for Canvas, StackPanel and Grid.
508. How Can I Switch To Expression Blend From Visual Studio?
Expression blend provide great extensibility for XAML files.To switch to Expression Blend, right-click on the XAML file and select Open in Expression Blend.
509. How Can You Set Image Source Dynamically From C# Application To”test.png” File?
Surprisingly it is not as straight forward as it might sound, but anyone who seriously worked with Silverlight should be easily answer it. One of the ways is: img.Source = new BitmapImage(new Uri(“test.png”, UriKind. Relative));
510. How Can I Create Image Pieces/sub Image?
In straight way you create a subimage from an existing image. Here you just clip an image, Clipping is just different from Cropping. In clipping, first you have to dictate which part of the images to draw and later you have to remove all but the desired part of the image. Silverlight does not support cropping.
511. How Does Silverlight 2 Differ From Adobe Flash?
As I am from .Net background so in my views you can get C# / Vb.net compiled code but in Flash there is only action script.
512. Can You Elaborate How To Start A Silverlight Application With Visual Studio?
In the following step(s) I am giving the ideas all about:
1.Create a project:Here you just start your visual studio, Select your programming language [C#/VB], Choose Silverligh Template give the name and save it.
2. Adding SIlverlight COntrols:One thing is happened here, controls cannot dragged onto the designer, you can draw/drag the controls on XAML page.
(a) Naming to control:In this step just give the name to your silverligt control like for Button you can give name as:btnmy SilverligtButton
(b)Adding event handlers to Silverlight controls:Here you can give the event handlers like for click etc.
(c)Testing Silverlight applications in Visual Studio:Now just press F5 and test your application.
513. What Is Silverlight Tool Kit?
To create an application or game you need to design, code and give some extra feature to your output. To do the above, you need some controls, IDE etc.
Silverlight Tool kit is nothing but is a collection of Silverlight Tools, Components etc. It includes source code describing the all you need to develop an application.
514. What Happened When I Press F5 Within Visual Studio To Run Silverlight Application?
When you run the Silverlight application within Visual Studio, a new folder created in the web-site project for silverlight solution and it happened only first time. The folder name is ClientBin and having package with XAP extension which contains compiled project.
515. What Is Storyboard?
Storyboard is a Silverlight class with controls animations with a timeline, and provides object and property targeting information for its child animations.
516. Can I Add More Than One .xaml Pages In Silverlight Application?
Yes, you can have multiple .xaml files in a single project.In the App.xaml, in the method Application_Startup you can choose, which page you want to initially display.
517. What Is The Best Place To Start Silverlight Application?
There is no hard and fast rule to start Silverlight application. Every developer can start as per his/her experience. like as per my case I always prefer Visual Studio. SO, in my view Visual Studio is the best place to start with Silverlight2 applications.Microsoft provides templates for creating Silverlight applications and libraries in C# and Visual Basic.
518. Is Silverlight The Official Name For “wpf/e”?
Yes. Silverlight was formerly code-named “WPF/E.”
519. Does Silverlight Web Application Work With All Browsers ?
Yes,A web application developed by silverlight technology can work with any browser.
520. Is Silverlight A New Media Player?
No. Silverlight is a cross-browser, cross-platform plug-in for delivering media experiences and RIAs.It is not a desktop application or stand-alone media player.
521. How Is My Content Secured From Unauthorized Access?
You will have to be signed into the SilverlightTM Streaming service to manage your account and your Silverlight applications. Your SilverlightTM Streaming ID and secret key, associated to your Windows Live ID, will authenticate you as the unique and legitimate owner of the applications and content you upload to the service. You will also need this information to manage your Silverlight applications using the API. The SilverlightTM Streaming ID is public. However, the secret key should be kept confidential.
522. Explain Form Level Validation And Field Level Validation
Field-level validation provides immediate validation of the input given by the user. The events associated with field-level validation are KeyDown, KeyPress, textchange, etc.
In form-level validation the validation step is done after the filling up of the form is done. It’s usually when the user submits the forms.
523. Overview Of Ado.net Architecture.
Data Provider provides objects through which functionalities like opening and closing connection, retrieving and updating data can be availed.
It also provides access to data source like SQL Server, Access, and Oracle).
Some of the data provider objects are:
- Command object which is used to store procedures.
- Data Adapter which is a bridge between datastore and dataset.
- Datareader which reads data from data store in forward only mode.
- A dataset object is not in directly connected to any data store. It represents disconnected and cached data. The dataset communicates with Data adapter that fills up the dataset. Dataset can have one or more Datatable and relations.
- DataView object is used to sort and filter data in Datatable.
524. Asp.net State Management
This article describes state management in ASP.NET. It explains client-side state management and server-side state management.
525. Asp.net Caching
This includes caching mechanism in ASP.NET, its advantages and types.
526. Define Xslt.
XSLT is a language for transforming XML documents into XHTML documents or to other XML documents.
XPath is a language for navigating in XML documents.
527. What Is Xpath?
XPath is a language that is used to navigate through XML documents.
528. Define Xmlreader Class.
The XMLReader Class (Assembly: System.Xml.dll) represents a reader that provides fast, non-cached, forward-only access to XML data.
529. Define Xmlvalidatingreader Class.
The XMLValidatingReader class (Assembly: System.Xml.dll) represents a reader that provides:
– Document type definition (DTD),
– XML-Data Reduced (XDR) schema, and
– XML Schema definition language (XSD) validation
530. How Can You Sort The Elements Of The Array In Descending Order?
By calling Sort() and then Reverse() methods.
531. What’s The .net Collection Class That Allows An Element To Be Accessed Using A Unique Key?
HashTable.
532. Can You Prevent Your Class From Being Inherited By Another Class?
Yes. The keyword “sealed” will prevent the class from being inherited.
533. How Is Method Overriding Different From Method Overloading?
When overriding a method, you change the behavior of the method for the derived class. Overloading a method simply involves having another method with the same name within the class.
534. What Is A Satellite Assembly?
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.
535. What Are Advantages And Disadvantages Of Microsoft-provided Data Provider Classes In Ado.net?
SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix. OLE-DB.NET is a .NET layer on top of the OLE layer, so it’s not as fastest and efficient as SqlServer.NET.
536. What Is .net Framework?
The .NET Framework has two main components: the common language runtime and the .NET Framework class library.
You can think of the runtime as an agent that manages code at execution time,providing core services such as memory management, thread management, and remoting, while also enforcing strict type safety and other forms of code accuracy that ensure security and robustness.
The class library, is a comprehensive, object-oriented collection of reusable types that you can use to develop applications ranging from traditional command-line or graphical user interface (GUI) applications to applications based on the latest innovations provided by ASP.NET, such as Web Forms and XML Web services.
537. Is .net A Runtime Service Or A Development Platform?
It’s both and actually a lot more. Microsoft .NET includes a new way of delivering software and services to businesses and consumers. A part of Microsoft.NET is the .NET Frameworks. The .NET frameworks SDK consists of two parts: the .NET common language runtime and the .NET class library. In addition, the SDK also includes command-line compilers for C#, C++, JScript, and VB. You use these compilers to build applications and components. These components require the runtime to execute so this is a development platform.
538. What Are The New Features Of Framework 1.1 ?
1. Native Support for Developing Mobile Web Applications
2. Enable Execution of Windows Forms Assemblies Originating from the Internet Assemblies originating from the Internet zone for example, Microsoft Windows Forms controls embedded in an Internet-based Web page or Windows Forms assemblies hosted on an Internet Web server and loaded either through the Web browser or programmatically using the System.Reflection.Assembly.LoadFrom() method now receive sufficient permission to execute in a semi-trusted manner. Default security policy has been changed so that assemblies assigned by the common language runtime (CLR) to the Internet zone code group now receive the constrained permissions associated with the Internet permission set. In the .NET Framework 1.0 Service Pack 1 and Service Pack 2, such applications received the permissions associated with the Nothing permission set and could not execute.
3. Enable Code Access Security for ASP.NET Applications Systems administrators can now use code access security to further lock down the permissions granted to ASP.NET Web applications and Web services. Although the operating system account under which an application runs imposes security restrictions on the application, the code access security system of the CLR can enforce additional restrictions on selected application resources based on policies specified by systems administrators. You can use this feature in a shared server environment (such as an Internet service provider (ISP) hosting multiple Web applications on one server) to isolate separate applications from one another, as well as with stand-alone servers where you want applications to run with the minimum necessary privileges.
4. Native Support for Communicating with ODBC and Oracle Databases
5. Unified Programming Model for Smart Client Application Development The Microsoft .NET Compact Framework brings the CLR, Windows Forms controls, and other .NET Framework features to small devices. The .NET Compact Framework supports a large subset of the .NET Framework class library optimized for small devices.
6. Support for IPv6
The .NET Framework 1.1 supports the emerging update to the Internet Protocol, commonly referred to as IP version 6, or simply IPv6. This protocol is designed to significantly increase the address space used to identify communication endpoints in the Internet to accommodate its ongoing growth.
539. How Do I Define My Own Code Group?
Use caspol. For example, suppose you trust code from www.mydomain.com and you want it have full access to your system, but you want to keep the default restrictions for all other internet sites. To achieve this, you would add a new code group as a subgroup of the ‘Zone – Internet’ group, like this:
Now if you run caspol -lg you will see that the new group has been added as group
540. How Do I Change The Permission Set For A Code Group?
Use caspol. If you are the machine administrator, you can operate at the ‘machine’ level – which means not only that the changes you make become the default for the machine, but also that users cannot change the permissions to be more permissive. If you are a normal (non-admin) user you can still modify the permissions, but only to make them more restrictive. For example, to allow intranet code to do what it likes you might do this:
Note that because this is more permissive than the default policy (on a standard system), you should only do this at the machine level – doing it at the user level will have no effect.
541. Can I Create My Own Permission Set?
Yes. Use caspol -ap, specifying an XML file containing the permissions in the permission set. To save you some time, here is a sample file corresponding to the ‘Everything’ permission set – just edit to suit your needs. When you have edited the sample, add it to the range of available permission sets like this:
caspol -ap samplepermset.xml
Then, to apply the permission set to a code group, do something like this:
caspol -cg 1.3 SamplePermSet (By default, 1.3 is the ‘Internet’ code group)
542. I’m Having Some Trouble With Cas. How Can I Diagnose My Problem?
Caspol has a couple of options that might help. First, you can ask caspol to tell you what code group an assembly belongs to, using caspol -rsg. Similarly, you can ask what permissions are being applied to a particular assembly using caspol -rsp.
543. I Can’t Be Bothered With All This Cas Stuff. Can I Turn It Off?
Yes, as long as you are an administrator. Just run:
caspol -s off
544. What Is Msil, Il?
When compiling to managed code, the compiler translates your source code into Microsoft intermediate language (MSIL), which is a CPU-independent set of instructions that can be efficiently converted to native code. MSIL includes instructions for loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations. Microsoft intermediate language (MSIL) is a language used as the output of a number of compilers and as the input to a just-in-time (JIT) compiler. The common language runtime includes a JIT compiler for converting MSIL to native code.
545. Can I Write Il Programs Directly?
Yes. Peter Drayton posted this simple example to the DOTNET mailing list:
.assembly MyAssembly {}
.class MyApp {
.method static void Main() {
.entrypoint
ldstr “Hello, IL!”
call void System.Console::WriteLine(class System.Object)
ret
}
}
Just put this into a file called hello.il, and then run ilasm hello.il. An exe assembly will be generated.
546. What Is Jit (just In Time)? How It Works?
Before Microsoft intermediate language (MSIL) can be executed, it must be converted by a .NET Framework just-in-time (JIT) compiler to native code, which is CPU-specific code that runs on the same computer architecture as the JIT compiler.
Rather than using time and memory to convert all the MSIL in a portable executable (PE) file to native code, it converts the MSIL as it is needed during execution and stores the resulting native code so that it is accessible for subsequent calls.
The runtime supplies another mode of compilation called install-time code generation. The install-time code generation mode converts MSIL to native code just as the regular JIT compiler does, but it converts larger units of code at a time, storing the resulting native code for use when the assembly is subsequently loaded and executed.
As part of compiling MSIL to native code, code must pass a verification process unless an administrator has established a security policy that allows code to bypass verification. Verification examines MSIL and metadata to find out whether the code can be determined to be type safe, which means that it is known to access only the memory locations it is authorized to access.
547. Which Namespace Is The Base Class For .net Class Library?
system.object
548. What Is Event – Delegate? Clear Syntax For Writing A Event Delegate
The event keyword lets you specify a delegate that will be called upon the occurrence of some “event” in your code. The delegate can have one or more associated methods that will be called when your code indicates that the event has occurred. An event in one program can be made available to other programs that target the .NET Framework Common Language Runtime.
// keyword_delegate.cs
// delegate declaration
delegate void MyDelegate(int i);
class Program
{
public static void Main()
{
TakesADelegate(new MyDelegate(DelegateFunction));
}
public static void TakesADelegate(MyDelegate SomeFunction)
{
SomeFunction(21);
}
public static void DelegateFunction(int i)
{
System.Console.WriteLine(“Called by delegate with number: {0}.”, i);
}
}
549. What Are Object Pooling And Connection Pooling And Difference? Where Do We Set The Min And Max Pool Size For Connection Pooling?
Object pooling is a COM+ service that enables you to reduce the overhead of creating each object from scratch. When an object is activated, it is pulled from the pool. When the object is deactivated, it is placed back into the pool to await the next request. You can configure object pooling by applying the ObjectPoolingAttribute attribute to a class that derives from the System.EnterpriseServices.ServicedComponent class.
Object pooling lets you control the number of connections you use, as opposed to connection pooling, where you control the maximum number reached. Following are important differences between object pooling and connection pooling:
Creation. When using connection pooling, creation is on the same thread, so if there is nothing in the pool, a connection is created on your behalf. With object pooling, the pool might decide to create a new object. However, if you have already reached your maximum, it instead gives you the next available object. This is crucial behavior when it takes a long time to create an object, but you do not use it for very long.
Enforcement of minimums and maximums. This is not done in connection pooling. The maximum value in object pooling is very important when trying to scale your application. You might need to multiplex thousands of requests to just a few objects. (TPC/C benchmarks rely on this.)
COM+ object pooling is identical to what is used in .NET Framework managed SQL Client connection pooling. For example, creation is on a different thread and minimums and maximums are enforced.
550. Interop Services?
The common language runtime provides two mechanisms for interoperating with unmanaged code:
Platform invoke, which enables managed code to call functions exported from an unmanaged library.
COM interop, which enables managed code to interact with COM objects through interfaces.
Both platform invoke and COM interop use interop marshaling to accurately move method arguments between caller and callee and back, if required.
551. What Are Server Controls?
ASP.NET server controls are components that run on the server and encapsulate user-interface and other related functionality. They are used in ASP.NET pages and in ASP.NET code-behind classes.
552. What Is Exception Handling?
When an exception occurs, the system searches for the nearest catch clause that can handle the exception, as determined by the run-time type of the exception. First, the current method is searched for a lexically enclosing try statement, and the associated catch clauses of the try statement are considered in order. If that fails, the method that called the current method is searched for a lexically enclosing try statement that encloses the point of the call to the current method. This search continues until a catch clause is found that can handle the current exception, by naming an exception class that is of the same class, or a base class, of the run-time type of the exception being thrown. A catch clause that doesn’t name an exception class can handle any exception.
Once a matching catch clause is found, the system prepares to transfer control to the first statement of the catch clause. Before execution of the catch clause begins, the system first executes, in order, any finally clauses that were associated with try statements more nested that than the one that caught the exception.
Exceptions that occur during destructor execution are worth special mention. If an exception occurs during destructor execution, and that exception is not caught, then the execution of that destructor is terminated and the destructor of the base class (if any) is called. If there is no base class (as in the case of the object type) or if there is no base class destructor, then the exception is discarded.
553. What Are The Different Types Of Assemblies?
Private, Public/Shared, Satellite
554. What Are Satellite Assemblies? How You Will Create This? How Will You Get The Different Language Strings?
Satellite assemblies are often used to deploy language-specific resources for an application. These language-specific assemblies work in side-by-side execution because the application has a separate product ID for each language and installs satellite assemblies in a language-specific subdirectory for each language. When uninstalling, the application removes only the satellite assemblies associated with a given language and .NET Framework version. No core .NET Framework files are removed unless the last language for that .NET Framework version is being removed.
(For example, English and Japanese editions of the .NET Framework version 1.1 share the same core files. The Japanese .NET Framework version 1.1 adds satellite assemblies with localized resources in a \ja subdirectory. An application that supports the .NET Framework version 1.1, regardless of its language, always uses the same core runtime files.)
555. What Is Jagged Arrays?
A jagged array is an array whose elements are arrays. The elements of a jagged array can be of different dimensions and sizes. A jagged array is sometimes called an “array-of-arrays.”
556. What Is Assembly Manifest? What All Details The Assembly Manifest Will Contain?
Every assembly, whether static or dynamic, contains a collection of data that describes how the elements in the assembly relate to each other. The assembly manifest contains this assembly metadata. An assembly manifest contains all the metadata needed to specify the assembly’s version requirements and security identity, and all metadata needed to define the scope of the assembly and resolve references to resources and classes. The assembly manifest can be stored in either a PE file (an .exe or .dll) with Microsoft intermediate language (MSIL) code or in a standalone PE file that contains only assembly manifest information.
It contains Assembly name, Version number, Culture, Strong name information, List of all files in the assembly, Type reference information, Information on referenced assemblies.
557. Difference Between Assembly Manifest & Metadata?
assembly self-describing. The assembly manifest contains the assembly’s metadata. The manifest establishes the assembly identity, specifies the files that make up the assembly implementation, specifies the types and resources that make up the assembly, itemizes the compile-time dependencies on other assemblies, and specifies the set of permissions required for the assembly to run properly. This information is used at run time to resolve references, enforce version binding policy, and validate the integrity of loaded assemblies. The self-describing nature of assemblies also helps makes zero-impact install and XCOPY deployment feasible.
metadata – Information that describes every element managed by the common language runtime: an assembly, loadable file, type, method, and so on. This can include information required for debugging and garbage collection, as well as security attributes, marshaling data, extended class and member definitions, version binding, and other information required by the runtime.
558. What Is Global Assembly Cache (gac) And What Is The Purpose Of It? (how To Make An Assembly To Public? Steps) How More Than One Version Of An Assembly Can Keep In Same Place?
Each computer where the common language runtime is installed has a machine-wide code cache called the global assembly cache. The global assembly cache stores assemblies specifically designated to be shared by several applications on the computer. You should share assemblies by installing them into the global assembly cache only when you need to.
Steps
– Create a strong name using sn.exe tool
eg: sn -k keyPair.snk
– with in AssemblyInfo.cs add the generated file name
eg: [assembly: AssemblyKeyFile(“abc.snk”)]
– recompile project, then install it to GAC by either
drag & drop it to assembly folder (C:\WINDOWS\assembly OR
C:\WINNT\assembly) (shfusion.dll tool)
or
gacutil -i abc.dll
559. How Do I Know When My Thread Pool Work Item Has Completed?
There is no way to query the thread pool for this information. You must put code into the WaitCallback method to signal that it has completed. Events are useful for this.
560. How To Find Methods Of A Assembly File (not Using Ildasm)
Reflection
561. What Is Garbage Collection In .net? Garbage Collection Process?
The process of transitively tracing through all pointers to actively used objects in order to locate all objects that can be referenced, and then arranging to reuse any heap memory that was not found during this trace. The common language runtime garbage collector also compacts the memory that is in use to reduce the working space needed for the heap.
562. Readonly Vs. Const?
A const field can only be initialized at the declaration of the field. A readonly field can be initialized either at the declaration or in a constructor.Therefore,readonly fields can have different values depending on the constructor used. Also, while a const field is a compile-time constant, the readonly field can be used for runtime constants, as in the following example:
public static readonly uint l1 = (uint) DateTime.Now.Ticks;
563. What Is Reflection In .net? Namespace? How Will You Load An Assembly Which Is Not Referenced By Current Assembly?
All .NET compilers produce metadata about the types defined in the modules they produce. This metadata is packaged along with the module (modules in turn are packaged together in assemblies), and can be accessed by a mechanism called reflection. The System. Reflection namespace contains classes that can be used to interrogate the types for a module/assembly. Using reflection to access .NET metadata is very similar to using ITypeLib/ITypeInfo to access type library data in COM, and it is used for similar purposes – e.g. determining data type sizes for marshaling data across context/process/machine boundaries.
Reflection can also be used to dynamically invoke methods (see System.Type.InvokeMember), or even create types dynamically at run-time (see System.Reflection.Emit.TypeBuilder).
564. What Is Custom Attribute? How To Create? If I’m Having Custom Attribute In An Assembly, How To Say That Name In The Code?
The primary steps to properly design custom attribute classes are as follows:
Applying the AttributeUsageAttribute
([AttributeUsage(AttributeTargets.All,
Inherited = false, AllowMultiple = true)])
Declaring the attribute. (class public class MyAttribute : System.Attribute { // .
. . })
Declaring constructors (public MyAttribute(bool myvalue) { this.myvalue =
myvalue; })
Declaring properties
public bool MyProperty
{
get {return this.myvalue;}
set {this.myvalue = value;}
}
The following example demonstrates the basic way of using reflection to get access to custom attributes.
class MainClass
{
public static void Main()
{
System.Reflection.MemberInfo info = typeof(MyClass);
object[] attributes = info.GetCustomAttributes();
for (int i = 0; i < attributes.Length; i ++)
{
System.Console.WriteLine(attributes[i]);
}
}
}
565. What Is The Managed And Unmanaged Code In .net?
The .NET Framework provides a run-time environment called the Common Language Runtime, which manages the execution of code and provides services that make the development process easier. Compilers and tools expose the runtime’s functionality and enable you to write code that benefits from this managed execution environment. Code that you develop with a language compiler that targets the runtime is called managed code; it benefits from features such as cross-language integration, cross-language exception handling, enhanced security, versioning and deployment support, a simplified model for component interaction, and debugging and profiling services.
566. How Do You Create Threading In .net? What Is The Namespace For That?
**
System.Threading.Thread
567. Using Directive Vs Using Statement
You create an instance in a using statement to ensure that Dispose is called on the object when the using statement is exited. A using statement can be exited either when the end of the using statement is reached or if, for example, an exception is thrown and control leaves the statement block before the end of the statement.
The using directive has two uses:
Create an alias for a namespace (a using alias).
Permit the use of types in a namespace, such that, you do not have to qualify the use of a type in that namespace (a using directive).
568. Describe The Managed Execution Process?
The managed execution process includes the following steps:
Choosing a compiler.
To obtain the benefits provided by the common language runtime, you must use one or more language compilers that target the runtime.
Compiling your code to Microsoft intermediate language (MSIL).
Compiling translates your source code into MSIL and generates the required metadata.
Compiling MSIL to native code.
At execution time, a just-in-time (JIT) compiler translates the MSIL into native code. During this compilation, code must pass a verification process that examines the MSIL and metadata to find out whether the code can be determined to be type safe.
Executing your code.
The common language runtime provides the infrastructure that enables execution to take place as well as a variety of services that can be used during execution.
569. What Is Active Directory? What Is The Namespace Used To Access The Microsoft Active Directories? What Are Adsi Directories?
Active Directory Service Interfaces (ADSI) is a programmatic interface for Microsoft Windows Active Directory. It enables your applications to interact with diverse directories on a network, using a single interface. Visual Studio .NET and the .NET Framework make it easy to add ADSI functionality with the DirectoryEntry and DirectorySearcher components. Using ADSI, you can create applications that perform common administrative tasks, such as backing up databases, accessing printers, and administering user accounts. ADSI makes it possible for you to:
Log on once to work with diverse directories. The Directory Entry component class provides username and password properties that can be entered at runtime and communicated to the Active Directory object you are binding to. Use a single application programming interface (API) to perform tasks on multiple directory systems by offering the user a variety of protocols to use. The DirectoryServices namespace provides the classes to perform most administrative functions.
Perform “rich querying” on directory systems. ADSI technology allows for searching for an object by specifying two query dialects: SQL and LDAP. Access and use a single, hierarchical structure for administering and maintaining diverse and complicated network configurations by accessing an Active Directory tree.
Integrate directory information with databases such as SQL Server. The DirectoryEntry path may be used as an ADO.NET connection string provided that it is using the LDAP provider using System.DirectoryServices;
570. How Garbage Collector (gc) Works?
The methods in this class influence when an object is garbage collected and when resources allocated by an object are released. Properties in this class provide information about the total amount of memory available in the system and the age category, or generation, of memory allocated to an object. Periodically, the garbage collector performs garbage collection to reclaim memory allocated to objects for which there are no valid references. Garbage collection happens automatically when a request for memory cannot be satisfied using available free memory. Alternatively, an application can force garbage collection using the Collect method.
Garbage collection consists of the following steps:
The garbage collector searches for managed objects that are referenced in managed code.
The garbage collector attempts to finalize objects that are not referenced.
The garbage collector frees objects that are not referenced and reclaims their memory.
571. Why Do We Need To Call Cg.supressfinalize?
Requests that the system not call the finalizer method for the specified object.
public static void SuppressFinalize( object obj );
The method removes obj from the set of objects that require finalization.
The obj parameter is required to be the caller of this method.
Objects that implement the IDisposable interface can call this method from the IDisposable.Dispose method to prevent the garbage collector from calling Object.Finalize on an object that does not require it.
572. What Is Nmake Tool?
The Nmake tool (Nmake.exe) is a 32-bit tool that you use to build projects based on commands contained in a .mak file.
usage : nmake -a all
573. What Are Namespaces?
The namespace keyword is used to declare a scope. This namespace scope lets you organize code and gives you a way to create globally-unique types. Even if you do not explicitly declare one, a default namespace is created. This unnamed namespace, sometimes called the global namespace,is present in every file.Any identifier in the global namespace is available for use in a named namespace. Namespaces implicitly have public access and this is not modifiable.
574. What Is Rcw (runtime Callable Wrappers)?
The common language runtime exposes COM objects through a proxy called the runtime callable wrapper (RCW). Although the RCW appears to be an ordinary object to .NET clients, its primary function is to marshal calls between a .NET client and a COM object.
575. What Is Ccw (com Callable Wrapper)
A proxy object generated by the common language runtime so that existing COM applications can use managed classes, including .NET Framework classes, transparently.
576. How Will You Register Com+ Services?
The .NET Framework SDK provides the .NET Framework Services Installation Tool (Regsvcs.exe – a command-line tool) to manually register an assembly containing serviced components. You can also access these registration features programmatically with the System.EnterpriseServices RegistrationHelper class by creating an instance of class RegistrationHelper and using the method InstallAssembly.
577. What Is Use Of Contextutil Class?
ContextUtil is the preferred class to use for obtaining COM+ context information.
578. What Is Pinvoke?
Platform invoke is a service that enables managed code to call unmanaged functions implemented in dynamic-link libraries (DLLs), such as those in the Win32 API. It locates and invokes an exported function and marshals its arguments (integers, strings, arrays, structures, and so on) across the interoperation boundary as needed.
579. Is It True That Com Objects No Longer Need To Be Registered On The Server?
Yes and No. Legacy COM objects still need to be registered on the server before they can be used. COM developed using the new .NET Framework will not need to be registered. Developers will be able to autoregister these objects just by placing them in the ‘bin’ folder of the application.
580. Can .net Framework Components Use The Features Of Component Services?
Yes, you can use the features and functions of Component Services from a .NET Framework component.
581. What Are The Oops Concepts?
1) Encapsulation: It is the mechanism that binds together code and data in manipulates, and keeps both safe from outside interference and misuse. In short it isolates a particular code and data from all other codes and data. A well-defined interface controls the access to that particular code and data.
2) Inheritance: It is the process by which one object acquires the properties of another object. This supports the hierarchical classification. Without the use of hierarchies, each object would need to define all its characteristics explicitly. However, by use of inheritance, an object need only define those qualities that make it unique within its class. It can inherit its general attributes from its parent. A new sub-class inherits all of the attributes of all of its ancestors.
3) Polymorphism: It is a feature that allows one interface to be used for general class of actions. The specific action is determined by the exact nature of the situation. In general polymorphism means “one interface, multiple methods”, This means that it is possible to design a generic interface to a group of related activities. This helps reduce complexity by allowing the same interface to be used to specify a general class of action. It is the compiler’s job to select the specific action (that is, method) as it applies to each situation.
582. What Is The Difference Between A Struct And A Class?
The struct type is suitable for representing lightweight objects such as Point, Rectangle, and Color. Although it is possible to represent a point as a class, a struct is more efficient in some scenarios. For example, if you declare an array of 1000 Point objects, you will allocate additional memory for referencing each object. In this case, the struct is less expensive.
When you create a struct object using the new operator, it gets created and the appropriate constructor is called. Unlike classes, structs can be instantiated without using the new operator. If you do not use new, the fields will remain unassigned and the object cannot be used until all of the fields are initialized. It is an error to declare a default (parameterless) constructor for a struct. A default constructor is always provided to initialize the struct members to their default values.
It is an error to initialize an instance field in a struct.
There is no inheritance for structs as there is for classes. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Structs, however, inherit from the base class Object. A struct can implement interfaces, and it does that exactly as classes do.
A struct is a value type, while a class is a reference type.
583. What Is Method Overloading?
Method overloading occurs when a class contains two methods with the same name, but different signatures.
584. 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.
585. Can We Call A Base Class Method Without Creating Instance?
Its possible If its a static method.
Its possible by inheriting from that class also.
Its possible from derived classes using base keyword.
586. You Have One Base Class Virtual Function How Will Call That Function From Derived Class?
class a
{
public virtual int m()
{
return 1;
}
}
class b:a
{
public int j()
{
return m();
}
}
587. In Which Cases You Use Override And New Base?
Use the new modifier to explicitly hide a member inherited from a base class. To hide an inherited member, declare it in the derived class using the same name, and modify it with the new modifier.
588. What Are Sealed Classes In C#?
The sealed modifier is used to prevent derivation from a class. A compile-time error occurs if a sealed class is specified as the base class of another class. (A sealed class cannot also be an abstract class)
589. What Is Polymorphism? How Does Vb.net/c# Achieve Polymorphism?
class Token
{
public string Display()
{
//Implementation goes here
return “base”;
}
}
class IdentifierToken:Token
{
public new string Display() //What is the use of new keyword
{
//Implementation goes here
return “derive”;
}
}
static void Method(Token t)
{
Console.Write(t.Display());
}
public static void Main()
{
IdentifierToken Variable=new IdentifierToken();
Method(Variable); //Which Class Method is called here
Console.ReadLine();
}
For the above code What is the “new” keyword and Which Class Method is called here
A: it will call base class Display method
class Token
{
public virtual string Display()
{
//Implementation goes here
return “base”;
}
}
class IdentifierToken:Token
{
public override string Display() //What is the use of new keyword
{
//Implementation goes here
return “derive”;
}
}
static void Method(Token t)
{
Console.Write(t.Display());
}
public static void Main()
{
IdentifierToken Variable=new IdentifierToken();
Method(Variable); //Which Class Method is called here
Console.ReadLine();
}
A: Derive
590. Explain About Protected And Protected Internal, “internal” Accessspecifier?
protected – Access is limited to the containing class or types derived from the containing class.
internal – Access is limited to the current assembly.
protected internal – Access is limited to the current assembly or types derived from the containing class.
591. 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.
A static constructor is used to initialize a class. It is called automatically to initialize the class before the first instance is created or any static members are referenced.
592. What Is Private Constructor? And It’s Use? Can You Create Instance Of A Class Which Has Private Constructor?
When a class declares only private instance constructors, it is not possible for classes outside the program to derive from the class or to directly create instances of it. (Except Nested classes) Make a constructor private if:
– You want it to be available only to the class itself. For example, you might have a special constructor used only in the implementation of your class’ Clone method.
– You do not want instances of your component to be created. For example, you may have a class containing nothing but Shared utility functions, and no instance data. Creating instances of the class would waste memory.
593. I Have 3 Overloaded Constructors In My Class. In Order To Avoid Making Instance Of The Class Do I Need To Make All Constructors To Private?
Yes
594. Overloaded Constructor Will Call Default Constructor Internally?
NO
595. What Is The Difference Between Finalize And Dispose (garbage Collection)
Class instances often encapsulate control over resources that are not managed by the runtime, such as window handles (HWND), database connections, and so on. Therefore, you should provide both an explicit and an implicit way to free those resources. Provide implicit control by implementing the protected Finalize Method on an object (destructor syntax in C# and the Managed Extensions for C++). The garbage collector calls this method at some point after there are no longer any valid references to the object.
In some cases, you might want to provide programmers using an object with the ability to explicitly release these external resources before the garbage collector frees the object. If an external resource is scarce or expensive, better performance can be achieved if the programmer explicitly releases resources when they are no longer being used. To provide explicit control, implement the Dispose method provided by the IDisposable Interface. The consumer of the object should call this method when it is done using the object. Dispose can be called even if other references to the object are alive.
596. Is Goto Statement Supported In C#? How About Java?
Gotos are supported in C# to the fullest. In Java goto is a reserved keyword that provides absolutely no functionality.
597. What’s Different About Switch Statements In C#?
No fall-throughs allowed. Unlike the C++ switch statement, C# does not support an explicit fall through from one case label to another. If you want, you can use goto a switch-case, or goto default.
case 1:
cost += 25;
break;
case 2:
cost += 25;
goto case 1;
598. Advantage Of Ado.net?
ADO.NET Does Not Depend On Continuously Live Connections
Database Interactions Are Performed Using Data Commands
Data Can Be Cached in Datasets
Datasets Are Independent of Data Sources
Data Is Persisted as XML
Schemas Define Data Structures
599. How Would You Connect To Database Using .net?
SqlConnection nwindConn = new SqlConnection(“Data Source=localhost;
Integrated Security=SSPI;” +”Initial Catalog=northwind”);
nwindConn.Open();
600. Difference Between Oledb Provider And Sqlclient ?
SQLClient .NET classes are highly optimized for the .net / sqlserver combination and achieve optimal results. The SqlClient data provider is fast. It’s faster than the Oracle provider, and faster than accessing database via the OleDb layer. It’s faster because it accesses the native library (which automatically gives you better performance), and it was written with lots of help from the SQL Server team.
601. What Are The Different Namespaces Used In The Project To Connect The Database? What Data Providers Available In .net To Connect To Database?
System.Data.OleDb – classes that make up the .NET Framework Data Provider for OLE DB-compatible data sources. These classes allow you to connect to an OLE DB data source, execute commands against the source, and read the results.
System.Data.SqlClient – classes that make up the .NET Framework Data Provider for SQL Server, which allows you to connect to SQL Server 7.0, execute commands, and read results. The System.Data. SqlClient namespace is similar to the System.Data.OleDb namespace, but is optimized for access to SQL Server 7.0 and later.
System.Data.Odbc – classes that make up the .NET Framework Data Provider for ODBC. These classes allow you to access ODBC data source in the managed space.
System.Data.OracleClient – classes that make up the .NET Framework Data Provider for Oracle. These classes allow you to access an Oracle data source in the managed space.
602. Which Method Do You Invoke On The Dataadapter Control To Load Your Generated Dataset With Data?
Fill()
603. Explain Different Methods And Properties Of Datareader Which You Have Used In Your Project?
Read
GetString
GetInt32
while (myReader.Read())
Console.WriteLine(“\t{0}\t{1}”, myReader.GetInt32(0),
myReader.GetString(1));
myReader.Close();
604. What Happens When We Issue Dataset.readxml Command?
Reads XML schema and data into the DataSet.
605. In How Many Ways We Can Retrieve Table Records Count? How To Find The Count Of Records In A Dataset?
foreach(DataTable thisTable in myDataSet.Tables){
// For each row, print the values of each column.
foreach(DataRow myRow in thisTable.Rows){
606. How To Check If A Datareader Is Closed Or Opened?
IsClosed()
607. Differences Between Dataset.clone And Dataset.copy?
Clone – Copies the structure of the DataSet, including all DataTable schemas, relations, and constraints. Does not copy any data.
Copy – Copies both the structure and data for this DataSet.
608. What Is Method To Get Xml And Schema From Dataset?
getXML () and getSchema ()
609. Difference Between Application Events And Session Events
The ASP.NET page framework provides ways for you to work with events that can be raised when your application starts or stops or when an individual user’s session starts or stops:
Application Events are raised for all requests to an application. For example, Application_BeginRequest is raised when any Web Forms page or XML Web service in your application is requested. This event allows you to initialize resources that will be used for each request to the application. A corresponding event, Application_ EndRequest, provides you with an opportunity to close or otherwise dispose of resources used for the request.
Session Events are similar to application events (there is a Session_OnStart and a Session_OnEnd event), but are raised with each unique session within the application. A session begins when a user requests a page for the first time from your application and ends either when your application explicitly closes the session or when the session times out.
610. Difference Between Asp Session And Asp.net Session?
In Asp, the session is Process dependent, whereas in
Asp.Net the session is Process independent.
611. What Is Cookie Less Session? How It Works?
By default, ASP.NET will store the session state in the same process that processes the request, just as ASP does. If cookies are not available, a session can be tracked by adding a session identifier to the URL. This can be enabled by setting the following:
sessionstate cookieless=”true”
612. What Method Do You Use To Explicitly Kill A Users Session?
Abandon()
613. What Are The Different Ways You Would Consider Sending Data Across Pages In Asp (i.e Between 1.asp To 2.asp)?
Session
public properties
614. What Is State Management In .net And How Many Ways Are There To Maintain A State In .net? What Is View State?
Web pages are recreated each time the page is posted to the server. In traditional Web programming, this would ordinarily mean that all information associated with the page and the controls on the page would be lost with each round trip.
To overcome this inherent limitation of traditional Web programming, the ASP.NET page framework includes various options to help you preserve changes — that is, for managing state. The page framework includes a facility called view state that automatically preserves property values of the page and all the controls on it between round trips.
However, you will probably also have application-specific values that you want to preserve. To do so, you can use one of the state management options.
Client-Based State Management Options:
View State
Hidden Form Fields
Cookies
Query Strings
Server-Based State Management Options
Application State
Session State
Database Support
615. What Are The Disadvantages Of View State / What Are The Benefits?
Automatic view-state management is a feature of server controls that enables them to repopulate their property values on a round trip (without you having to write any code). This feature does impact performance, however, since a server control’s view state is passed to and from the server in a hidden form field. You should be aware of when view state helps you and when it hinders your page’s performance.
616. When Maintaining Session Through Sql Server, What Is The Impact Of Read And Write Operation On Session Objects?
Maintaining state using database technology is a common practice when storing user-specific information where the information store is large. Database storage is particularly useful for maintaining long-term state or state that must be preserved even if the server must be restarted.
617. Explain The Differences Between Server-side And Client-side Code?
Server side code will process at server side and it will send the result to client. Client side code (javascript) will execute only at client side.
618. Which Asp.net Configuration Options Are Supported In The Asp.net Implementation On The Shared Web Hosting Platform?
Many of the ASP.NET configuration options are not configurable at the site, application or subdirectory level on the shared hosting platform. Certain options can affect the security, performance and stability of the server and, therefore cannot be changed. The following settings are the only ones that can be changed in your site’s web.config file (s):
browserCaps
clientTarget
pages
customErrors
globalization
authorization
authentication
webControls
webServices
619. What Is Role-based Security?
A role is a named set of principals that have the same privileges with respect to security (such as a teller or a manager). A principal can be a member of one or more roles. Therefore, applications can use role membership to determine whether a principal is authorized to perform a requested action.
620. How Do You Specify Whether Your Data Should Be Passed As Query String And Forms (mainly About Post And Get)
Through Attribute tag of Form tag.
621. Which Two Properties Are There On Every Validation Control?
ControlToValidate, ErrorMessage
622. How Do You Use Css In Asp.net?
Within the section of an HTML document that will use these styles, add a link to this external CSS style sheet that follows this form:
MyStyles.css is the name of your external CSS style sheet.
623. How Do You Implement Postback With A Text Box?
Make AutoPostBack property to true
624. What Is Sql Injection?
An SQL injection attack “injects” or manipulates SQL code by adding unexpected SQL to a query. Many web pages take parameters from web user, and make SQL query to the database. Take for instance when a user login, web page that user name and password and make SQL query to the database to check if a user has valid name and password.
Username: ‘ or 1=1 —
Password: [Empty]
This would execute the following query against the users table:
select count(*) from users where userName=” or 1=1 –‘ and userPass=”
625. Asp.net – How To Find Last Error Which Occurred?
Server.GetLastError();
[C#]
Exception LastError;
String ErrMessage;
LastError = Server.GetLastError();
if (LastError != null)
ErrMessage = LastError.Message;
else
ErrMessage = “No Errors”;
Response.Write(“Last Error = ” + ErrMessage);
626. What Is The Use Of sessionstate Tag In The Web.config File?
Configuring session state: Session state features can be configured via the section in a web.config file. To double the default timeout of 20 minutes, you can add the following to the web.config file of an application:
627. What Are The Different Modes For The Sessionstates In The Web.config File?
- Off Indicates that session state is not enabled.
- Inproc Indicates that session state is stored locally.
- StateServer Indicates that session state is stored on a remote server.
- SQLServer Indicates that session state is stored on the SQL Server.
628. Is It Possible For Me To Change My .aspx File Extension To Some Other Name?
Yes.
Open IIS->Default Website -> Properties
Select HomeDirectory tab
Click on configuration button
Click on add. Enter aspnet_isapi details
(C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\aspnet_isapi.dll
GET,HEAD,POST,DEBUG)
Open
machine.config(C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\CONFIG)
& add new extension under tag
629. What Is A Webservice And What Is The Underlying Protocol Used In It?
Web Services are applications delivered as a service on the Web. Web services allow for programmatic access of business logic over the Web. Web services typically rely on XML- based protocols, messages, and interface descriptions for communication and access. Web services are designed to be used by other programs or applications rather than directly by end user. Programs invoking a Web service are called clients. SOAP over HTTP is the most commonly used protocol for invoking Web services.
630. In A Webservice, Need To Display 10 Rows From A Table. Which Is The Best Choice Among Datareader Or Dataset?
WebService will support only DataSet.
631. Are Web Services A Replacement For Other Distributed Computing Platforms?
No. Web Services is just a new way of looking at existing implementation platforms.
632. How To Generate Proxy Class Other Than .net App And Wsdl Tool?
To access an XML Web service from a client application, you first add a Web reference, which is a reference to an XML Web service. When you create a Web reference, Visual Studio creates an XML Web service proxy class automatically and adds it to your project. This proxy class exposes the methods of the XML Web service and handles the marshalling of appropriate arguments back and forth between the XML Web service and your application. Visual Studio uses the Web Services Description Language (WSDL) to create the proxy. To generate an XML Web service proxy class:
From a command prompt, use Wsdl.exe to create a proxy class, specifying (at a minimum) the URL to an XML Web service or a service description, or the path to a saved service description.
Wsdl /language:language /protocol:protocol
/namespace:myNameSpace /out:filename
/username:username /password:password /domain:domain
633. What Is A Proxy In Web Service? How Do I Use A Proxy Server When Invoking A Web Service?
If you are using the SOAP Toolkit, you need to set some connector properties to use a proxy server:
Dim soap As SoapClient Set soap=New SoapClient
soap.ConnectorProperty(“ProxyServer”) = ?proxyservername?
soap.ConnectorProperty(“ProxyPort”) = ?8080?
soap.ConnectorProperty(“UseProxy”) = True
While with .NET , you just need to create a System.Net.WebProxy object and use it to set the Proxy property Dim
webs As localhost.MyService() webs.Proxy=New
System.Net.WebProxy(?http://proxyserver:8080?)
634. How You Will Protect / Secure A Web Service?
For the most part, things that you do to secure a Web site can be used to secure a Web Service. If you need to encrypt the data exchange, you use Secure Sockets Layer (SSL) or a Virtual Private Network to keep the bits secure. For authentication, use HTTP Basic or Digest authentication with Microsoft® Windows® integration to figure out who the caller is. these items cannot:
Parse a SOAP request for valid values
Authenticate access at the Web Method level (they can authenticate at the Web Service level)
Stop reading a request as soon as it is recognized as invalid.
635. What Is Remoting?
The process of communication between different operating system processes, regardless of whether they are on the same computer. The .NET remoting system is an architecture designed to simplify communication between objects living in different application domains, whether on the same computer or not, and between different contexts, whether in the same application domain or not.
636. Cao And Sao.
Client Activated objects are those remote objects whose Lifetime is directly Controlled by the client. This is in direct contrast to SAO. Where the server, not the client has complete control over the lifetime of the objects.
Client activated objects are instantiated on the server as soon as the client request the object to be created. Unlike as SAO a CAO doesn’t delay the object creation until the first method is called on the object. (In SAO the object is instantiated when the client calls the method on the object)
637. Difference Between Singleton And Singlecall.
Singleton types never have more than one instance at any one time. If an instance exists, all client requests are serviced by that instance.
Single Call types always have one instance per client request. The next method invocation will be serviced by a different server instance, even if the previous instance has not yet been recycled by the system.
638. In Which Process Does Iis Runs (was Asking About The Exe File)
inetinfo.exe is the Microsoft IIS server running, handling ASP.NET requests among other things. When an ASP.NET request is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it by passing the request to the actual worker process aspnet_wp.exe.
639. Where Are The Iis Log Files Stored?
C:\WINDOWS\system32\Logfiles\W3SVC1
OR
c:\winnt\system32\LogFiles\W3SVC1
640. How Do I Send An Email Message From My Asp.net Page?
You can use the System.Web.Mail.MailMessage and the System.Web.Mail.SmtpMail class to send email in your ASPX pages. Below is a simple example of using this class to send mail in C# and VB.NET. In order to send mail through our mail server, you would want to make sure to set the static SmtpServer property of the SmtpMail class to mail-fwd.
C#
<%@ Import Namespace=”System” %>
<%@ Import Namespace=”System.Web” %>
<%@ Import Namespace=”System.Web.Mail” %>
641. What Is An Il?
Intermediate Language 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.
642. What Is Difference Between Namespace And Assembly?
Assembly is physical grouping of logical units, Namespace, logically groups classes.
Namespace can span multiple assembly.
643. What Is The Use Of Errorprovider Control In .net?
The ErrorProvider control is used to indicate invalid data on a data entry form. Using this control, you can attach error messages that display next to the control when the data is invalid, as seen in the following image. A red circle with an exclamation point blinks, and when the user mouses over the icon, the error message is displayed as a tooltip.
644. Can Any Object Be Stored In A Viewstate In .net?
An object that either is serializable or has a TypeConverter defined for it can be persisted in ViewState.
645. Difference Between Class And Interface In .net?
- Class is logical representation of object. It is collection of data and related sub procedures with definition.
- Interface is also a class containing methods which is not having any definitions.
- Class does not support multiple inheritance. But interface can support.
646. What Is Shadowing?
Shadowing is either through scope or through inheritance. Shadowing through inheritance is hiding a method of a base class and providing a new implementation for the same. This is the default when a derived class writes an implementation of a method of base class which is not declared as overridden in the base class. This also serves the purpose of protecting an implementation of a new method against subsequent addition of a method with the same name in the base class.’shadows’ keyword is recommended although not necessary since it is the default.
647. Differences Between Dll And Exe?
.exe
- These are outbound file.
- Only one .exe file exists per application.
- .Exe cannot be shared with other applications.
.dll
- These are inbound file .
- Many .dll files may exists in one application.
- .dll can be shared with other applications.
648. What Do You Mean By Authentication And Authorization?
Authentication is the process of validating a user on the credentials(username and password) and authorization performs after authentication. After Authentication a user will be verified for performing the various tasks, It access is limited it is known as authorization.
649. Where Do You Add An Event Handler?
It’s the Attributesproperty, the Add function inside that property. e.g.btnSubmit.Attributes.Add(“onMouseOver”,”someClientCode();”)
650. Differentiate Between Client-side And Server-side Validations In Web Pages?
Client-side validations take place at the client end with the help of JavaScript and VBScript before the Web page is sent to the server. On the other hand, server-side validations take place at the server end.
651. What Does The Orientation Property Do In A Menu Control?
Orientation property of the Menu control sets the horizontal or vertical display of a menu on a Web page. By default, the orientation is vertical.
652. Which Method Is Used To Force All The Validation Controls To Run?
The Page.Validate() method is used to force all the validation controls to run and to perform validation.
653. What Is Viewstate?
The ViewState is a feature used by ASP.NET Web page to store the value of a page and its controls just before posting the page. Once the page is posted, the first task by the page processing is to restore the ViewState to get the values of the controls.
654. Differentiate Globalization And Localization?
The globalization is a technique to identify the specific part of a Web application that is different for different languages and make separate that portion from the core of the Web application. The localization is a procedure of configuring a Web application to be supported for a specific language or locale.
655. How Can You Register A Custom Server Control To A Web Page?
You can register a custom server control to a Web page using the @Register directive.
656. What Is Iis? Why Is It Used?
Internet Information Services (IIS) is created by Microsoft to provide Internet-based services to ASP.NET Web applications. It makes your computer to work as a Web server and provides the functionality to develop and deploy Web applications on the server. IIS handles the request and response cycle on the Web server. It also offers the services of SMTP and FrontPage server extensions. The SMTP is used to send emails and use FrontPage server extensions to get the dynamic features of IIS, such as form handler.
657. Define A Multilingual Website?
A multilingual Website serves content in a number of languages. It contains multiple copies for its content and other resources, such as date and time, in different languages.
658. What Are The Advantages Of The Code-behind Feature?
- Makes code easy to understand and debug by separating application logic from HTML tags.
- Provides the isolation of effort between graphic designers and software engineers.
- Removes the problems of browser incompatibility by providing code files to exist on the Web server and
- supporting Web pages to be compiled on demand.
659. Which Is The Parent Class Of The Web Server Control?
The System.Web.Ul.Control class is the parent class for all Web server controls.
660. How Can We Identify That The Page Is Post Back?
Page object has an “IsPostBack” property, which can be checked to know that is the page posted back.
661. In Which Event Are The Controls Fully Loaded?
Page load event guarantees that all controls are fully loaded. Controls are also accessed in Page_Init events but you will see that view state is not fully loaded during this event
662. Which Properties Are Used To Bind A Datagridview Control?
The DataSource property and the DataMember property are used to bind a DataGridView control.
663. What Is Autopostback?
If you want a control to postback automatically when an event is raised, you need to set the AutoPostBack property of the control to True.
664. What Are The Parameters That Control Most Of Connection Pooling Behaviours?
- Connect Timeout
- Max Pool Size
- Min Pool Size
- Pooling
665. What Are Different Types Of Authentication Techniques That Are Used In Connection Strings To Connect .net Applications With Microsoft Sql Server?
- The Windows Authentication option.
- The SQL Server Authentication option.
666. Which Adapter Should You Use, If You Want To Get The Data From An Access Database?
OleDbDataAdapter is used to get the data from an Access database.
667. What Are The Pre-requisites For Connection Pooling?
There must be multiple processes to share the same connection describing the same parameters and security settings. The connection string must be identical.
668. Name The Method That Needs To Be Invoked On The Dataadapter Control To Fill The Generated Dataset With Data?
The Fill() method is used to fill the dataset with data.
669. Which Property Is Used To Check Whether A Datareader Is Closed Or Opened?
The IsClosed property is used to check whether a DataReader is closed or opened. This property returns a true value if a Data Reader is closed, otherwise a false value is returned.
670. What Is The Role Of The Dataset Object In Ado.net?
One of the major component of ADO.NET is the DataSet object, which always remains disconnected from the database and reduces the load on the database.
671. Which Architecture Does Datasets Follow?
Datasets follow the disconnected data architecture.
672. Mention The Namespace That Is Used To Include .net Data Provider For Sql Server In .net Code?
The System.Data.SqlClient namespace.
673. What Is The Meaning Of Object Pooling?
Object pooling is a concept of storing a pool (group) of objects in memory that can be reused later as needed. Whenever, a new object is required to create, an object from the pool can be allocated for this request; thereby, minimizing the object creation. A pool can also refer to a group of connections and threads. Pooling, therefore, helps in minimizing the use of system resources, improves system scalability, and performance.
674. What Are Tuples?
Tuple is a fixed-size collection that can have elements of either same or different data types. Similar to arrays, a user must have to specify the size of a tuple at the time of declaration. Tuples are allowed to hold up from 1 to 8 elements and if there are more than 8 elements, then the 8th element can be defined as another tuple. Tuples can be specified as parameter or return type of a method.
675. What Is The Difference Between Int And Int32?
There is no difference between int and int32. System.Int32 is a .NET Class and int is an alias name for System.Int32.
676. Which Method Do You Use To Enforce Garbage Collection In .net?
The System.GC.Collect() method.
677. What Is Managed Extensibility Framework?
Managed extensibility framework (MEF) is a new library that is introduced as a part of .NET 4.0 and Silverlight 4. It helps in extending your application by providing greater reuse of applications and components. MEF provides a way for host application to consume external extensions without any configuration requirement.
678. What Is Microsoft Intermediate Language (msil)?
The .NET Framework is shipped with compilers of all .NET programming languages to develop programs. There are separate compilers for the Visual Basic, C#, and Visual C++ programming languages in .NET Framework. Each .NET compiler produces an intermediate code after compiling the source code. The intermediate code is common for all languages and is understandable only to .NET environment. This intermediate code is known as MSIL.
679. Mention The Execution Process For Managed Code?
- Choosing a language compiler
- Compiling the code to MSIL
- Compiling MSIL to native code
- Executing the code.
680. 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 —.NET Framework provides a consistent object-oriented programming model across various languages. You on we this model to create programs for performing different tasks, such as connecting to and retrieving data from databases and reading from and writing to files.
Language interoperability —Language interoperability is a feature that enables a piece of code written in one language to be used in another language. This facilities the reuse of code and therefore improves the efficiency of the development process.
Automatic management of resources —Wink developing .NET. applications, you may use various resources, such as files, memory, and database connecters. With MET Framework, you do not need to manually free these resources when they are no longer required.
Ease of deployment- .NET framework makes the deployment of applications easier. To install an application that is not based on NET Framework you need to copy It and its components on target computers. However, with MET Framework, you can quickly Install or deploy the applications such that Installation of new applications or components does not affect the existing applications.
681. Mention The Core Components Of .net Framework?
The two core components of .NET Framework are:
Common Language Runtime
.NET Framework Class Library.[sociallocker]
682. Briefly Describe The Roles Of Clr In .net Framework?
CLR provides an environment to execute MET applications on target machines.
CLR-is also a common runtime environment for all MET code irrespective of their programming language, because the compilers of MET Framework convert every source code into a common language known as MSIL .
CLR also provides various services to execute processes, such as memory management service and security services..CLR performs various tasks to manage the execution process of MET applications.
The responsibilities of as are listed below:
Automatic memory management–CLR invokes venous built-in functions of MET Framework to allocate and de-allocate the memory of MET objects. Therefore, programmers need not write the code to explicitly allocate and de-allocate memory to programs.
Garbage Collection —Garbage collection Is the major role of CUR, with prevents memory leaks during execution of programs. The Garbage collector of CLR automatically determines the best time to free the memory, which is reserved by an object for execution.
Code Access Security —Code Access Security (CAS) model is used in MET Framework to impose restrictions and security during execution of programs. CLR uses security objects to manage access to code during execution of MET applications. as allows an executing code to perform only those tasks for which it has permission.
683. Why Is String Called Immutable Data Type?
A sting represents text and stores a sequential collection of characters in the memory. A string object is said to be immutable (read only), because a value once assigned to a string object cannot be changed after the acting object has been created. When the value In the string object is modified, a new string object is created with a new value assigned to the string object therefore, keeping the old string In memory for garbage collector to be disposed.
684. What Is Side-by-side Execution? Can Two Applications, One Using A Private Assembly And Other Using A Shared Assembly, Be Stated As Side-by-side Executables?
Side-by-side execution Is the ability to run multiple versions of an application or component on the same computer. You can have multiple versions of the CLR and multiple versions of applications and components Mat use a version of the runtime on the same computer at the same time. As versioning is only applied to shared assemblies and not to private assemblies, two applications, one using a private assembly and other using a shared assembly, cannot be stated as side-by-side executables.
685. Explain The Differences Between Managed And Unmanaged Code?
Managed code is the code that is executed chatty by the QR Instead of the operating system. Unmanaged code is the code that is executed directly by the operating system outside the OR environment. In managed code, since the execution of the code Is governed by CLR, the runtime provides different services such as garbage collection, type checking, exception handling, and safety and support These sat help provide uniformly in platform and language-Independent behavior of managed code applications. In unmanaged code, the allocation of memory, type safety, and security is required to be taken are of by the developer. If the unmanaged code is not Properly handles, may result In memory leak. Examples of unmanaged code are ActiveX components and Wm32 AM that execute beyond the scope of native CLR.
686. What Is The Maximum Number Of Classes That Can Be Contained In One Dll File?
There is no limit to the number of classes that can be curtained In a DLL file.
687. Can One Dll File Contains The Compiled Code Of More Than One .net Language?
No, a DLL file can contain the complied code of only one programming language.
688. Explain The Different Types Of Assemblies?
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.