| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
131. Can multiple catch blocks be executed? No, once the proper catch code fires off, the control is transferred to the finally block (if there are any), and then whatever follows the finally block.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
132. Why is it a bad idea to throw your own exceptions? Well, if at that point you know that an error has occurred, then why not write the proper code to handle that error instead of passing a new Exception object to the catch block? Throwing your own exceptions signifies some design flaws in the project.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
133. What's a delegate? A delegate object encapsulates a reference to a method. In C++ they were referred to as function pointers.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
134. What's a multicast delegate? It's a delegate that points to and eventually fires off several methods.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
135. How's the DLL Hell problem solved in .NET? Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
136. What are the ways to deploy an assembly? An MSI installer, a CAB archive, and XCOPY command.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
137. What's 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.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
138. What namespaces are necessary to create a localized application? System.Globalization, System.Resources.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
140. What does assert() 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.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
141. 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.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
142. Why are there five tracing levels in System.Diagnostics.TraceSwitcher? The tracing dumps can be quite verbose and for some applications that are constantly running you run the risk of overloading the machine and the hard drive there. Five levels range from None to Verbose, allowing to fine-tune the tracing activities.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
143. Where is the output of TextWriterTraceListener redirected? To the Console or a text file depending on the parameter passed to the constructor.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
144. What namespaces are necessary to create a localized application? System.Globalization, System.Resources.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
145. What are three test cases you should go through in unit testing? Positive test cases (correct data, correct output), negative test cases (broken or missing data, proper handling), exception test cases (exceptions are thrown and caught properly).
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
146. Can you change the value of a variable while debugging a C# application? Yes, if you are debugging via Visual Studio.NET, just go to Immediate window.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
147. What's the implicit name of the parameter that gets passed into the class' set method? Value, and it's datatype depends on whatever variable we're changing.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
148. How do you inherit from a class in C#? Place a colon and then the name of the base class. Notice that it's double colon in C++.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
149. Does C# support multiple inheritance? No, use interfaces instead.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
150. When you inherit a protected class-level variable, who is it available to? Derived Classes.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
151. What's the top .NET class that everything is derived from? System.Object.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
151. What's the top .NET class that everything is derived from? System.Object.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
152. How's method overriding different from overloading? When overriding, you change the method behavior for a derived class. Overloading simply involves having a method with the same name within the class.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
153. What does the keyword virtual mean in the method definition? The method can be over-ridden.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
154. 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.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
155. Can you override private virtual methods? No, moreover, you cannot access private methods in inherited classes, have to be protected in the base class to allow any sort of access.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
156. Can you prevent your class from being inherited and becoming a base class for some other classes? Yes, that's what keyword sealed in the class definition is for. The developer trying to derive from your class will get a message: cannot inherit from Sealed class WhateverBaseClassName. It's the same concept as final class in Java.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
157. Can you allow class to be inherited, but prevent the method from being over-ridden? Yes, just leave the class public and make the method sealed.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
158. Why can't you specify the accessibility modifier for methods inside the interface? They all must be public. Therefore, to prevent you from getting the false impression that you have any freedom of choice, you are not allowed to specify any accessibility, it's public by default.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
160. And if they have conflicting method names? It's up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you're okay.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
161. What's the difference between an interface and abstract class? In the interface all methods must be abstract, in the abstract class some methods can be concrete. In the interface no accessibility modifiers are allowed, which is ok in abstract classes.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
162. How can you overload a method? Different parameter data types, different number of parameters, different order of parameters.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
163. If a base class has a bunch of overloaded constructors, and an inherited class has another bunch of overloaded constructors, can you enforce a call from an inherited constructor to an arbitrary base constructor? Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
164. What's the difference between System.String and System.StringBuilder classes? System.String is immutable, System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
165. Does C# support multiple-inheritance? No, use interfaces instead.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
166. When you inherit a protected class-level variable, who is it available to? The derived class.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
167. Are private class-level variables inherited? Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
168. Describe the accessibility modifier "protected internal". It is available to derived classes and classes within the same Assembly (and naturally from the base class it's declared in).
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
169. What's the top .NET class that everything is derived from? System.Object.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
170. What's the advantage of using System.Text.StringBuilder over System.String? StringBuilder is more efficient in cases where there is a large amount of string manipulation. Strings are immutable, so each time it's being operated on, a new instance is created.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
171. Can you store multiple data types in System.Array? No.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
172. What's the .NET class that allows the retrieval of a data element using a unique key? HashTable.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
173. Will the finally block get executed if an exception has not occurred? Yes.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
174. What's an abstract class? A class that cannot be instantiated. An abstract class is a class that must be inherited and have the methods overridden. An abstract class is essentially a blueprint for a class without any implementation.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
175. When do you absolutely have to declare a class as abstract? 1. When at least one of the methods in the class is abstract. 2. When the class itself is inherited from an abstract class, but not all base abstract methods have been overridden.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
176. What's an interface? It's an abstract class with public abstract methods all of which must be implemented in the inherited classes.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
177. Why can't you specify the accessibility modifier for methods inside the interface? They all must be public. Therefore, to prevent you from getting the false impression that you have any freedom of choice, you are not allowed to specify any accessibility, it's public by default.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
177. Why can't you specify the accessibility modifier for methods inside the interface? They all must be public. Therefore, to prevent you from getting the false impression that you have any freedom of choice, you are not allowed to specify any accessibility, it's public by default.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
178. What's the difference between an interface and abstract class? In an interface class, all methods must be abstract. In an abstract class some methods can be concrete. In an interface class, no accessibility modifiers are allowed, which is ok in an abstract class.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
179. 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.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
180. Can you declare an override method to be static if the original method is non-static? No. The signature of the virtual method must remain the same, only the keyword virtual is changed to keyword override.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
181. Can you override private virtual methods? No. Private methods are not accessible outside the class.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
182. Can you write a class without specifying namespace? Which namespace does it belong to by default? Yes, you can, then the class belongs to global namespace which has no name. For commercial products, naturally, you wouldn't want global namespace.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
183. 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.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
184. Different b/w .NET & J2EE ? Differences between J2EE and the .NET Platform Vendor Neutrality The .NET platform is not vendor neutral, it is tied to the Microsoft operating systems. But neither are any of the J2EE implementations Many companies buy into J2EE believing that it will give them vendor neutrality. And, in fact, this is a stated goal of Sun's vision: A wide variety of J2EE product configurations and implementations, all of which meet the requirements of this specification, are possible. A portable J2EE application will function correctly when successfully deployed in any of these products. (ref : Java 2 Platform Enterprise Edition Specification, v1.3, page 2-7 available at http://java.sun.com/j2ee/) Overall Maturity Given that the .NET platform has a three year lead over J2EE, it should be no surprise to learn that the .NET platform is far more mature than the J2EE platform. Whereas we have high volume highly reliable web sites using .NET technologies (NASDAQ and Dell being among many examples) Interoperability and Web Services The .NET platform eCollaboration model is, as I have discussed at length, based on the UDDI and SOAP standards. These standards are widely supported by more than 100 companies. Microsoft, along with IBM and Ariba, are the leaders in this area. Sun is a member of the UDDI consortium and recognizes the importance of the UDDI standards. In a recent press release, Sun's George Paolini, Vice President for the Java Community Development, says: "Sun has always worked to help establish and support open, standards-based technologies that facilitate the growth of network-based applications, and we see UDDI as an important project to establish a registry framework for business-to-business e-commerce But while Sun publicly says it believes in the UDDI standards, in reality, Sun has done nothing whatsoever to incorporate any of the UDDI standards into J2EE. Scalability Typical Comparision w.r.t Systems and their costs J2EE Company System Total Sys. Cost Bull Escala T610 c/s 16,785 $1,980,179 IBM RS/6000 Enterprise Server F80 16,785 $2,026,681 Bull Escala EPC810 c/s 33,375 $3,037,499 IBM RS/6000 Enterprise Server M80 33,375 $3,097,055 Bull Escala EPC2450 110,403 $9,563,263 IBM IBM eServer pSeries 680 Model 7017-S85 110,403 $9,560,594
.NET platform systems Company System Total Sys. Cost Dell PowerEdge 4400 16,263 $273,487 Compaq ProLiant ML-570-6/700-3P 20,207 $201,717 Dell PowerEdge 6400 30,231 $334,626 IBM Netfinity 7600 c/s 32,377 $443,463 Compaq ProLiant 8500-X550-64P 161,720 $3,534,272 Compaq ProLiant 8500-X700-64P 179,658 $3,546,582 Compaq ProLiant 8500-X550-96P 229,914 $5,305,571 Compaq ProLiant 8500-X700-96P 262,244 $5,305,571 Compaq ProLiant 8500-700-192P 505,303 $10,003,826 Framework Support The .NET platform includes such an eCommerce framework called Commerce Server. At this point, there is no equivalent vendor-neutral framework in the J2EE space. With J2EE, you should assume that you will be building your new eCommerce solution from scratch Moreover, no matter what [J2EE] vendor you choose, if you expect a component framework that will allow you to quickly field complete e-business applications, you are in for a frustrating experience Language In the language arena, the choice is about as simple as it gets. J2EE supports Java, and only Java. It will not support any other language in the foreseeable future. The .NET platform supports every language except Java (although it does support a language that is syntactically and functionally equivalent to Java, C#). In fact, given the importance of the .NET platform as a language independent vehicle, it is likely that any language that comes out in the near future will include support for the .NET platform. Some companies are under the impression that J2EE supports other languages. Although both IBM's WebSphere and BEA's WebLogic support other languages, neither does it through their J2EE technology. There are only two official ways in the J2EE platform to access other languages, one through the Java Native Interface and the other through CORBA interoperability. Sun recommends the later approach. As Sun's Distinguished Scientist and Java Architect Rick Cattell said in a recent interview. Portability The reason that operating system portability is a possibility with J2EE is not so much because of any inherent portability of J2EE, as it is that most of the J2EE vendors support multiple operating systems. Therefore as long as one sticks with a given J2EE vendor and a given database vendor, moving from one operating system to another should be possible. This is probably the single most important benefit in favor of J2EE over the .NET platform, which is limited to the Windows operating system. It is worth noting, however, that Microsoft has submitted the specifications for C# and a subset of the .NET Framework (called the common language infrastructure) to ECMA, the group that standardizes JavaScript. J2EE offers an acceptable solution to ISVs when the product must be marketed to non-Windows customers, particularly when the J2EE platform itself can be bundled with the ISV's product as an integrated offering. If the primary customer base for the ISV is Windows customers, then the .NET platform should be chosen. It will provide much better performance at a much lower cost. Client device independence The major difference being that with Java, it is the presentation tier programmer that determines the ultimate HTML that will be delivered to the client, and with .NET, it is a Visual Studio.NET control. This Java approach has three problems. First, it requires a lot of code on the presentation tier, since every possible thin client system requires a different code path. Second, it is very difficult to test the code with every possible thin client system. Third, it is very difficult to add new thin clients to an existing application, since to do so involves searching through, and modifying a tremendous amount of presentation tier logic. The .NET Framework approach is to write device independent code that interacts with visual controls. It is the control, not the programmer, that is responsible for determining what HTML to deliver, based on the capabilities of the client device.. In the .NET Framework model, one can forget that such a thing as HTML even exists! Conclusion Sun's J2EE vision is based on a family of specifications that can be implemented by many vendors. It is open in the sense that any company can license and implement the technology, but closed in the sense that it is controlled by a single vendor, and a self contained architectural island with very limited ability to interact outside of itself. One of J2EE's major disadvantages is that the choice of the platform dictates the use of a single programming language, and a programming language that is not well suited for most businesses. One of J2EE's major advantages is that most of the J2EE vendors do offer operating system portability. Microsoft's .NET platform vision is a family of products rather than specifications, with specifications used primarily to define points of interoperability. The major disadvantage of this approach is that if is limited to the Windows platform, so applications written for the .NET platform can only be run on .NET platforms. Their are several important advantages to the .NET platform: * The cost of developing applications is much lower, since standard business languages can be used and device independent presentation tier logic can be written. * The cost of running applications is much lower, since commodity hardware platforms (at 1/5 the cost of their Unix counterparts) can be used. * The ability to scale up is much greater, with the proved ability to support at least ten times the number of clients any J2EE platform has shown itself able to support. * Interoperability is much stronger, with industry standard eCollaboration built into the platform.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
185. What are the Main Features of .NET platform? Features of .NET Platform are :- Common Language Runtime Explains the features and benefits of the common language runtime, a run-time environment that manages the execution of code and provides services that simplify the development process. Assemblies Defines the concept of assemblies, which are collections of types and resources that form logical units of functionality. Assemblies are the fundamental units of deployment, version control, reuse, activation scoping, and security permissions. Application Domains Explains how to use application domains to provide isolation between applications. Runtime Hosts Describes the runtime hosts supported by the .NET Framework, including ASP.NET, Internet Explorer, and shell executables. Common Type System Identifies the types supported by the common language runtime. Metadata and Self-Describing Components Explains how the .NET Framework simplifies component interoperation by allowing compilers to emit additional declarative information, or metadata, into all modules and assemblies. Cross-Language Interoperability Explains how managed objects created in different programming languages can interact with one another. .NET Framework Security Describes mechanisms for protecting resources and code from unauthorized code and unauthorized users. .NET Framework Class Library Introduces the library of types provided by the .NET Framework, which expedites and optimizes the development process and gives you access to system functionality.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
186. What is the use of JIT ? JIT (Just - In - Time) is a compiler which converts MSIL code to Native Code (ie.. CPU-specific code that runs on the same computer architecture). Because the common language runtime supplies a JIT compiler for each supported CPU architecture, developers can write a set of MSIL that can be JIT-compiled and run on computers with different architectures. However, your managed code will run only on a specific operating system if it calls platform-specific native APIs, or a platform-specific class library. JIT compilation takes into account the fact that some code might never get called during execution. 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 needed during execution and stores the resulting native code so that it is accessible for subsequent calls. The loader creates and attaches a stub to each of a type's methods when the type is loaded. On the initial call to the method, the stub passes control to the JIT compiler, which converts the MSIL for that method into native code and modifies the stub to direct execution to the location of the native code. Subsequent calls of the JIT-compiled method proceed directly to the native code that was previously generated, reducing the time it takes to JIT-compile and run the code.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
187. What meant of assembly & global assembly cache (gac) & Meta data. Assembly:-- An assembly is the primary building block of a .NET based application. It is a collection of functionality that is built, versioned, and deployed as a single implementation unit (as one or more files). All managed types and resources are marked either as accessible only within their implementation unit, or as accessible by code outside that unit. It overcomes the problem of 'dll Hell'.The .NET Framework uses assemblies as the fundamental unit for several purposes: • Security • Type Identity • Reference Scope • Versioning • Deployment Global Assembly Cache :-- Assemblies can be shared among multiple applications on the machine by registering them in global Assembly cache(GAC). GAC is a machine wide a local cache of assemblies maintained by the .NET Framework. We can register the assembly to global assembly cache by using gacutil command. We can Navigate to the GAC directory, C:\winnt\Assembly in explore. In the tools menu select the cache properties; in the windows displayed you can set the memory limit in MB used by the GAC MetaData :--Assemblies have Manifests. This Manifest contains Metadata information of the Module/Assembly as well as it contains detailed Metadata of other assemblies/modules references (exported). It's the Assembly Manifest which differentiates between an Assembly and a Module.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
188. 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: 1) Those that are directly supported by .NET (Pocket PCs, i-Mode phones, and WAP devices) 2) Those that are not (Palm OS and J2ME-powered devices).
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
189. What is GUID , why we use it and where? GUID :-- GUID is Short form of Globally Unique Identifier, a unique 128-bit number that is produced by the Windows OS or by some Windows applications to identify a particular component, application, file, database entry, and/or user. For instance, a Web site may generate a GUID and assign it to a user's browser to record and track the session. A GUID is also used in a Windows registry to identify COM DLLs. Knowing where to look in the registry and having the correct GUID yields a lot information about a COM object (i.e., information in the type library, its physical location, etc.). Windows also identifies user accounts by a username (computer/domain and username) and assigns it a GUID. Some database administrators even will use GUIDs as primary key values in databases. GUIDs can be created in a number of ways, but usually they are a combination of a few unique settings based on specific point in time (e.g., an IP address, network MAC address, clock date/time, etc.).
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
190. Describe the difference between inline and code behind - which is best in a loosely coupled solution ASP.NET supports two modes of page development: Page logic code that is written inside runat="server"> blocks within an .aspx file and dynamically compiled the first time the page is requested on the server. Page logic code that is written within an external class that is compiled prior to deployment on a server and linked ""behind"" the .aspx file at run time.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
191. Whats MSIL, and why should my developers need an appreciation of it if at all? When compiling the source code to managed code, the compiler translates the source into Microsoft intermediate language (MSIL). This is a CPU-independent set of instructions that can efficiently be converted to native code. Microsoft intermediate language (MSIL) is a translation used as the output of a number of compilers. It is the input to a just-in-time (JIT) compiler. The Common Language Runtime includes a JIT compiler for the conversion of MSIL to native code. Before Microsoft Intermediate Language (MSIL) can be executed it, must be converted by the .NET Framework just-in-time (JIT) compiler to native code. This is CPU-specific code that runs on the same computer architecture as the JIT compiler. Rather than using time and memory to convert all of the MSIL in a portable executable (PE) file to native code. It converts the MSIL as needed whilst executing, then caches the resulting native code so its accessible for any subsequent calls.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
192. How many .NET languages can a single .NET DLL contain? One
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
193. What type of code (server or client) is found in a Code-Behind class? Server
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
194. Whats an assembly? Assemblies are the building blocks of .NET Framework applications; they form the fundamental unit of deployment, version control, reuse, activation scoping, and security permissions. An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality. An assembly provides the common language runtime with the information it needs to be aware of type implementations. To the runtime, a type does not exist outside the context of an assembly.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
195. How many classes can a single .NET DLL contain? Unlimited.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
196. What is the difference between string and String ? No difference
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
197. What is manifest? It is the metadata that describes the assemblies.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
197. What is manifest? It is the metadata that describes the assemblies.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
198. 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.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
199. What are the types of assemblies? There are four types of assemblies in .NET: Static assemblies These are the .NET PE files that you create at compile time. Dynamic assemblies These are PE-formatted, in-memory assemblies that you dynamically create at runtime using the classes in the System.Reflection.Emit namespace. Private assemblies These are static assemblies used by a specific application. 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. In .NET, an assembly is the smallest unit to which you can associate a version number;
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
200. What are delegates?where are they used ? A delegate defines a reference type that can be used to encapsulate a method with a specific signature. A delegate instance encapsulates a static or an instance method. Delegates are roughly similar to function pointers in C++; however, delegates are type-safe and secure.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
202. What are class access modifiers ? Access modifiers are keywords used to specify the declared accessibility of a member or a type. This section introduces the four access modifiers: • Public - Access is not restricted. • Protected - Access is limited to the containing class or types derived from the containing class. • Internal - Access is limited to the current assembly. • Protected inertnal - Access is limited to the current assembly or types derived • from the containing class. • Private - Access is limited to the containing type.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
203. What Is Boxing And Unboxing? Boxing :- Boxing is an implicit conversion of a value type to the type object type Eg:- Consider the following declaration of a value-type variable: int i = 123; object o = (object) i; Boxing Conversion UnBoxing :- Unboxing is an explicit conversion from the type object to a value type Eg: int i = 123; // A value type object box = i; // Boxing int j = (int)box; // Unboxing
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
204. What is Value type and refernce type in .Net?. Value Type : A variable of a value type always contains a value of that type. The assignment to a variable of a value type creates a copy of the assigned value, while the assignment to a variable of a reference type creates a copy of the reference but not of the referenced object. The value types consist of two main categories: * Stuct Type * Enumeration Type Reference Type :Variables of reference types, referred to as objects, store references to the actual data. This section introduces the following keywords used to declare reference types: * Class * Interface * Delegate This section also introduces the following built-in reference types: * object * string
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
205. What is the difference between structures and enumeration?. Unlike classes, structs are value types and do not require heap allocation. A variable of a struct type directly contains the data of the struct, whereas a variable of a class type contains a reference to the data. They are derived from System.ValueType class. Enum->An enum type is a distinct type that declares a set of named constants.They are strongly typed constants. They are unique types that allow to declare symbolic names to integral values. Enums are value types, which means they contain their own value, can't inherit or be inherited from and assignment copies the value of one enum to another. public enum Grade { A, B, C }
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
206. What is namespaces?. Namespace is a logical naming scheme for group related types.Some class types that logically belong together they can be put into a common namespace. They prevent namespace collisions and they provide scoping. They are imported as "using" in C# or "Imports" in Visual Basic. It seems as if these directives specify a particular assembly, but they don't. A namespace can span multiple assemblies, and an assembly can define multiple namespaces. When the compiler needs the definition for a class type, it tracks through each of the different imported namespaces to the type name and searches each referenced assembly until it is found. Namespaces can be nested. This is very similar to packages in Java as far as scoping is concerned.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
207. How do you create shared assemblies?. Just look through the definition of Assemblies.. * An Assembly is a logical unit of code * Assembly physically exist as DLLs or EXEs * One assembly can contain one or more files * The constituent files can include any file types like image files, text files etc. along with DLLs or EXEs * When you compile your source code by default the exe/dll generated is actually an assembly * Unless your code is bundled as assembly it can not be used in any other application * When you talk about version of a component you are actually talking about version of the assembly to which the component belongs. * Every assembly file contains information about itself. This information is called as Assembly Manifest. Following steps are involved in creating shared assemblies : * Create your DLL/EXE source code * Generate unique assembly name using SN utility * Sign your DLL/EXE with the private key by modifying AssemblyInfo file * Compile your DLL/EXE * Place the resultant DLL/EXE in global assembly cache using AL utility
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
208. What is global assembly cache? 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. 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.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
209. What is MSIL?. 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 run, 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 run 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.
|
| Author: mohit 04 May 2008 | Member Level: Gold Points : 2 |
211. What is tracing?Where it used.Explain few methods available Tracing refers to collecting information about the application while it is running. You use tracing information to troubleshoot an application. Tracing allows us to observe and correct programming errors. Tracing enables you to record information in various log files about the errors that might occur at run time. You can analyze these log files to find the cause of the errors. In .NET we have objects called Trace Listeners. A listener is an object that receives the trace output and outputs it somewhere; that somewhere could be a window in your development environment, a file on your hard drive, a Windows Event log, a SQL Server or Oracle database, or any other customized data store. The System.Diagnostics namespace provides the interfaces, classes, enumerations and structures that are used for tracing The System.Diagnostics namespace provides two classes named Trace and Debug that are used for writing errors and application execution information in logs. All Trace Listeners have the following functions. Functionality of these functions is same except that the target media for the tracing output is determined by the Trace Listener. Method Name Result Fail Outputs the specified text with the Call Stack. Write Outputs the specified text. WriteLine Outputs the specified text and a carriage return. Flush Flushes the output buffer to the target media. Close Closes the output stream in order to not receive the tracing/debugging output.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
1. How many languages .NET is supporting now? - When .NET was introduced it came with several languages. VB.NET, C#, COBOL and Perl, etc. The site DotNetLanguages.Net says 44 languages are supported.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
2. 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.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
3. How ASP .NET different from ASP? - Scripting is separated from the HTML, Code is compiled as a DLL, and these DLLs can be executed on the server.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
4. Resource Files: How to use the resource files, how to know which language to use?
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
5. What is smart navigation? - The cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
6. What is view state? - The web is stateless. But in ASP.NET, the state of a page is maintained in the in the page itself automatically. How? 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
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
7. How do you validate the controls in an ASP .NET page? - Using special validation controls that are meant for this. We have Range Validator, Email Validator.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
8. 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.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
9. 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.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
9. 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.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
10. 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.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
• Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process. inetinfo.exe is theMicrosoft 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 tothe actual worker process aspnet_wp.exe.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
• What’s the difference between Response.Write() andResponse.Output.Write()? The latter one allows you to write formatted output.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
• What methods are fired during the page load? Init() - when the pageis instantiated, Load() - when the page is loaded into server memory,PreRender() - the brief moment before the page is displayed to the user asHTML, Unload() - when page finishes loading.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
• Where does the Web page belong in the .NET Framework class hierarchy?System.Web.UI.Page
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
• Where do you store the information about the user’s locale? System.Web.UI.Page.Culture
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
• What’s the difference between Codebehind="MyCode.aspx.cs" andSrc="MyCode.aspx.cs"? CodeBehind is relevant to Visual Studio.NET only.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
• What’s a bubbled event? When you have a complex control, likeDataGrid, 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 itsconstituents.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
• Suppose you want a certain ASP.NET function executed on MouseOver over a certain button. Where do you add an event handler? It’s the Attributesproperty, the Add function inside that property. So btnSubmit.Attributes.Add("onMouseOver","someClientCode();") A simple”Javascript:ClientCode();” in the button control of the .aspx page will attach the handler (javascript function)to the onmouseover event.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
• What data type does the RangeValidator control support? Integer,String and Date.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
• Where would you use an iHTTPModule, and what are the limitations of any approach you might take in implementing one? One of ASP.NET’s most useful features is the extensibility of the HTTP pipeline, the path that data takes between client and server. You can use them to extend your ASP.NET applications by adding pre- and post-processing to each HTTP request coming into your application. For example, if you wanted custom authentication facilities for your application, the best technique would be to intercept the request when it comes in and process the request in a custom HTTP module.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
• Where would you use an iHTTPModule, and what are the limitations of any approach you might take in implementing one? One of ASP.NET’s most useful features is the extensibility of the HTTP pipeline, the path that data takes between client and server. You can use them to extend your ASP.NET applications by adding pre- and post-processing to each HTTP request coming into your application. For example, if you wanted custom authentication facilities for your application, the best technique would be to intercept the request when it comes in and process the request in a custom HTTP module.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
• Explain what a diffgram is and a good use for one? A DiffGram is an XML format that is used to identify current and original versions of data elements. The DataSet uses the DiffGram format to load and persist its contents, and to serialize its contents for transport across a network connection. When a DataSet is written as a DiffGram, it populates the DiffGram with all the necessary information to accurately recreate the contents, though not the schema, of the DataSet, including column values from both the Original and Current row versions, row error information, and row order.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
• What is datagrid? The DataGrid Web server control is a powerful tool for displaying information from a data source. It is easy to use; you can display editable data in a professional-looking grid by setting only a few properties. At the same time, the grid has a sophisticated object model that provides you with great flexibility in how you display the data.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
• What is datagrid? The DataGrid Web server control is a powerful tool for displaying information from a data source. It is easy to use; you can display editable data in a professional-looking grid by setting only a few properties. At the same time, the grid has a sophisticated object model that provides you with great flexibility in how you display the data.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
• What’s the difference between the System.Web.UI.WebControls.DataGrid and and System.Windows.Forms.DataGrid? The Web UI control does not inherently support master-detail data structures. As with other Web server controls, it does not support two-way data binding. If you want to update data, you must write code to do this yourself. You can only edit one row at a time. It does not inherently support sorting, although it raises events you can handle in order to sort the grid contents. You can bind the Web Forms DataGrid to any object that supports the IEnumerable interface. The Web Forms DataGrid control supports paging. It is easy to customize the appearance and layout of the Web Forms DataGrid control as compared to the Windows Forms one.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
• How do you customize the column content inside the datagrid? If you want to customize the content of a column, make the column a template column. Template columns work like item templates in the DataList or Repeater control, except that you are defining the layout of a column rather than a row.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
• How do you apply specific formatting to the data inside the cells? You cannot specify formatting for columns generated when the grid’s AutoGenerateColumns property is set to true, only for bound or template columns. To format, set the column’s DataFormatString property to a string-formatting expression suitable for the data type of the data you are formatting.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
• How do you hide the columns? One way to have columns appear dynamically is to create them at design time, and then to hide or show them as needed. You can do this by setting a column’s Visible property.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
• How do you display an editable drop-down list? Displaying a drop-down list requires a template column in the grid. Typically, the ItemTemplate contains a control such as a data-bound Label control to show the current value of a field in the record. You then add a drop-down list to the EditItemTemplate. In Visual Studio, you can add a template column in the Property builder for the grid, and then use standard template editing to remove the default TextBox control from the EditItemTemplate and drag a DropDownList control into it instead. Alternatively, you can add the template column in HTML view. After you have created the template column with the drop-down list in it, there are two tasks. The first is to populate the list. The second is to preselect the appropriate item in the list — for example, if a book’s genre is set to “fiction,” when the drop-down list displays, you often want “fiction” to be preselected.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
• How do you check whether the row data has been changed? The definitive way to determine whether a row has been dirtied is to handle the changed event for the controls in a row. For example, if your grid row contains a TextBox control, you can respond to the control’s TextChanged event. Similarly, for check boxes, you can respond to a CheckedChanged event. In the handler for these events, you maintain a list of the rows to be updated. Generally, the best strategy is to track the primary keys of the affected rows. For example, you can maintain an ArrayList object that contains the primary keys of the rows to update.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
1. What do you know about .NET assemblies? Assemblies are the smallest units of versioning and deployment in the .NET application. Assemblies are also the building blocks for programs such as Web services, Windows services, serviced components, and .NET remoting applications.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
2. What’s the difference between private and shared assembly? Private assembly is used inside an application only and does not have to be identified by a strong name. Shared assembly can be used by multiple applications and has to have a strong name.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
3. What’s a strong name? A strong name includes the name of the assembly, version number, culture identity, and a public key token.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
4. How can you tell the application to look for assemblies at the locations other than its own install? Use the directive in the XML .config file for a given application.
should do the trick. Or you can add additional search paths in the Properties box of the deployed application.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
5. How can you debug failed assembly binds? Use the Assembly Binding Log Viewer (fuslogvw.exe) to find out the paths searched.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
6. Where are shared assemblies stored? Global assembly cache.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
7. How can you create a strong name for a .NET assembly? With the help of Strong Name tool (sn.exe).
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
8. Where’s global assembly cache located on the system? Usually C:\winnt\assembly or C:\windows\assembly.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
9. Can you have two files with the same file name in GAC? Yes, remember that GAC is a very special folder, and while normally you would not be able to place two files with the same name into a Windows folder, GAC differentiates by version number as well, so it’s possible for MyApp.dll and MyApp.dll to co-exist in GAC if the first one is version 1.0.0.0 and the second one is 1.1.0.0.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
10. So let’s say I have an application that uses MyApp.dll assembly, version 1.0.0.0. There is a security bug in that assembly, and I publish the patch, issuing it under name MyApp.dll 1.1.0.0. How do I tell the client applications that are already installed to start using this new MyApp.dll? Use publisher policy. To configure a publisher policy, use the publisher policy configuration file, which uses a format similar app .config file. But unlike the app .config file, a publisher policy file needs to be compiled into an assembly and placed in the GAC.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
11. What is delay signing? Delay signing allows you to place a shared assembly in the GAC by signing the assembly with just the public key. This allows the assembly to be signed with the private key at a later stage, when the development process is complete and the component or assembly is ready to be deployed. This process enables developers to work with shared assemblies as if they were strongly named, and it secures the private key of the signature from being accessed at different stages of development.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
1. What’s the difference between code-based security and role-based security? Which one is better? 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-based 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. There’s no better, or 100% thumbs-up approach, depending on the nature of deployment, both code-based and role-based security could be implemented to an extent.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
2. How can you work with permissions from your .NET application? You can request permission to do something and you can demand certain permissions from other apps. You can also refuse permissions so that your app is not inadvertently used to destroy some data.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
3. How can C# app request minimum permissions? using System.Security.Permissions; [assembly:FileDialogPermissionAttribute(SecurityAction.RequestMinimum, Unrestricted=true)]
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
4. What’s a code group? A code group is a set of assemblies that share a security context.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
5. What’s the difference between authentication and authorization? Authentication happens first. You verify user’s identity based on credentials. Authorization is making sure the user only gets access to the resources he has credentials for.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
6. What are the authentication modes in ASP.NET? None, Windows, Forms and Passport.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
7. Are the actual permissions for the application defined at run-time or compile-time? The CLR computes actual permissions at runtime based on code group membership and the calling chain of the code.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
8. Where’s global assembly cache located on the system? Usually C:\winnt\assembly or C:\windows\assembly.
|
| Author: mohit 07 May 2008 | Member Level: Gold Points : 2 |
Explain the differences between Server-side and Client-side code? Server side scripting means that all the script will be executed by the server and interpreted as needed. ASP doesn’t have some of the functionality like sockets, uploading, etc. For these you have to make a custom components usually in VB or VC++. Client side scripting means that the script will be executed immediately in the browser such as form field validation, clock, email validation, etc. Client side scripting is usually done in VBScript or JavaScript. Download time, browser compatibility, and visible code - since JavaScript and VBScript code is included in the HTML page, then anyone can see the code by viewing the page source. Also a possible security hazards for the client computer.
|
| Author: mohit 07 May 2008 | Member Level: G |