32. using directive vs using statement
A. 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).
33. Describe the Managed Execution Process?
A. The managed execution process includes the following steps:
0. 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.
1. Compiling your code to Microsoft intermediate language (MSIL). Compiling translates your source code into MSIL and generates the required metadata.
2. 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.
3. 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.
34. What is Active Directory? What is the namespace used to access the Microsoft Active Directories? What are ADSI Directories?
A. 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 DirectoryEntry 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.
35. How Garbage Collector (GC) Works?
A. 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:
0. The garbage collector searches for managed objects that are referenced in managed code.
1. The garbage collector attempts to finalize objects that are not referenced.
2. The garbage collector frees objects that are not referenced and reclaims their memory.
36. Why do we need to call CG.SupressFinalize?
A. Requests that the system not call the finalizer method for the specified object. [C#]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.
37. What is nmake tool?
A. 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
38. What are Namespaces?
A. 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.
39. What is Jagged Arrays?
A. 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."
40. Interop Services?
A. 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.