Members BookmarksPolls Fresher Jobs Funny Photos B.Tech Projects New Member FAQ  



My Profile
Active Members
TodayLast 7 Days more...



Awards & Gifts
Online Exams

Fresher Jobs


Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian cities including Bangalore, Chennai, Hyderabad, Pune or Kochi

Resources


Find educational articles, blogs, discussion threads and other resources.

Colleges


Find details about any college in India or search for courses.

Advertisements


website counter



dot net questions(5)


Posted Date: 11 May 2008    Resource Type: Articles/Knowledge Sharing    Category: Computer & Technology

Posted By: mohit       Member Level: Gold
Rating:     Points: 2



01. Does C# support multiple-inheritance?
Ans : No.

02. Who is a protected class-level variable available to?
Ans : It is available to any sub-class (a class inheriting this class).

03. Are private class-level variables inherited?
Ans : Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.

04. Describe the accessibility modifier “protected internal”.
Ans : It is available to classes that are within the same assembly and derived from the specified base class.

05. What’s the top .NET class that everything is derived from?
Ans : System.Object.

06. What does the term immutable mean?
Ans : The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.

07. What’s the difference between System.String and System.Text.StringBuilder classes?
Ans : System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.

08. What’s the advantage of using System.Text.StringBuilder over System.String?
Ans : StringBuilder is more efficient in cases where there is a large amount of string manipulation. Strings are immutable, so each time a string is changed, a new instance in memory is created.

09. Can you store multiple data types in System.Array?
Ans : No.


10. What’s the difference between the System.Array.CopyTo() and System.Array.Clone()?
Ans : The Clone() method returns a new array (a shallow copy) object containing all the elements in the original array. The CopyTo() method copies the elements into another existing array. Both perform a shallow copy. A shallow copy means the contents (each array element) contains references to the same object as the elements in the original array. A deep copy (which neither of these methods performs) would create a new instance of each element's object, resulting in a different, yet identacle object.




Responses

Author: mohit    11 May 2008Member Level: Gold   Points : 2
11. How can you sort the elements of the array in descending order?
Ans : By calling Sort() and then Reverse() methods.



Author: mohit    11 May 2008Member Level: Gold   Points : 2
12. What’s the .NET collection class that allows an element to be accessed using a unique key?
Ans : HashTable.



Author: mohit    11 May 2008Member Level: Gold   Points : 2

13. What class is underneath the SortedList class?
Ans : A sorted HashTable.



Author: mohit    11 May 2008Member Level: Gold   Points : 2
14. Will the finally block get executed if an exception has not occurred?
Ans : Yes.



Author: mohit    11 May 2008Member Level: Gold   Points : 2
15. What’s the C# syntax to catch any possible exception?
Ans : A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this case and just write catch {}.




Author: mohit    11 May 2008Member Level: Gold   Points : 2
16. Can multiple catch blocks be executed for a single try statement?
Ans : No. Once the proper catch block processed, control is transferred to the finally block (if there are any).



Author: mohit    11 May 2008Member Level: Gold   Points : 2
17. Explain the three services model commonly know as a three-tier application.
Ans : Presentation (UI), Business (logic and underlying code) and Data (from storage or other sources).



Author: mohit    11 May 2008Member Level: Gold   Points : 2
01. Explain the differences between Server-side and Client-side code? Server side code executes on the server.For this to occur page has to be submitted or posted back.Events fired by the controls are executed on the server.Client side code executes in the browser of the client without submitting the page. e.g. In ASP.NET for webcontrols like asp:button the click event of the button is executed on the server hence the event handler for the same in a part of the code-behind (server-side code). Along the server-side code events one can also attach client side events which are executed in the clients browser i.e. javascript events.


Author: mohit    11 May 2008Member Level: Gold   Points : 2
02. How does VB.NET/C# achieve polymorphism? Polymorphism is also achieved through interfaces. Like abstract classes, interfaces also describe the methods that a class needs to implement. The difference between abstract classes and interfaces is that abstract classes always act as a base class of the related classes in the class hierarchy. For example, consider a hierarchy-car and truck classes derived from four-wheeler class; the classes two-wheeler and four-wheeler derived from an abstract class vehicle. So, the class 'vehicle' is the base class in the class hierarchy. On the other hand dissimilar classes can implement one interface. For example, there is an interface that compares two objects. This interface can be implemented by the classes like box, person and string, which are unrelated to each other.
C# allows multiple interface inheritance. It means that a class can implement more than one interface. The methods declared in an interface are implicitly abstract. If a class implements an interface, it becomes mandatory for the class to override all the methods declared in the interface, otherwise the derived class would become abstract.
Can you explain what inheritance is and an example of when you might use it? The savingaccount class has two data members-accno that stores account number, and trans that keeps track of the number of transactions. We can create an object of savingaccount class as shown below.
savingaccount s = new savingaccount ( "Amar", 5600.00f ) ;
From the constructor of savingaccount class we have called the two-argument constructor of the account class using the base keyword and passed the name and balance to this constructor using which the data member's name and balance are initialised.
We can write our own definition of a method that already exists in a base class. This is called method overriding. We have overridden the deposit( ) and withdraw( ) methods in the savingaccount class so that we can make sure that each account maintains a minimum balance of Rs. 500 and the total number of transactions do not exceed 10. From these methods we have called the base class's methods to update the balance using the base keyword. We have also overridden the display( ) method to display additional information, i.e. account number.
Working of currentaccount class is more or less similar to that of savingaccount class. Using the derived class's object, if we call a method that is not overridden in the derived class, the base class method gets executed. Using derived class's object we can call base class's methods, but the reverse is not allowed.
Unlike C++, C# does not support multiple inheritance. So, in C# every class has exactly one base class. Now, suppose we declare reference to the base class and store in it the address of instance of derived class as shown below.
account a1 = new savingaccount ( "Amar", 5600.00f ) ;
account a2 = new currentaccount ( "MyCompany Pvt. Ltd.", 126000.00f) ;

Such a situation arises when we have to decide at run-time a method of which class in a class hierarchy should get called. Using a1 and a2, suppose we call the method display( ), ideally the method of derived class should get called. But it is the method of base class that gets called. This is because the compiler considers the type of reference (account in this case) and resolves the method call. So, to call the proper method we must make a small change in our program. We must use the virtual keyword while defining the methods in base class as shown below.
public virtual void display( ) { }
We must declare the methods as virtual if they are going to be overridden in derived class. To override a virtual method in derived classes we must use the override keyword as given below.
public override void display( ) { }
Now it is ensured that when we call the methods using upcasted reference, it is the derived class's method that would get called. Actually, when we declare a virtual method, while calling it, the compiler considers the contents of the reference rather than its type.
If we don't want to override base class's virtual method, we can declare it with new modifier in derived class. The new modifier indicates that the method is new to this class and is not an override of a base class method.



Author: mohit    11 May 2008Member Level: Gold   Points : 2
03. How would you implement inheritance using VB.NET/C#?
When we set out to implement a class using inheritance, we must first start with an existing class from which we will derive our new subclass. This existing class, or base class, may be part of the .NET system class library framework, it may be part of some other application or .NET assembly, or we may create it as part of our existing application. Once we have a base class, we can then implement one or more subclasses based on that base class. Each of our subclasses will automatically have all of the methods, properties, and events of that base class ? including the implementation behind each method, property, and event. Our subclass can add new methods, properties, and events of its own - extending the original interface with new functionality. Additionally, a subclass can replace the methods and properties of the base class with its own new
implementation - effectively overriding the original behavior and replacing it with new behaviors. Essentially inheritance is a way of merging functionality from an existing class into our new subclass. Inheritance also defines rules for how these methods, properties, and events can be merged. In VB.NET we can use implements keyword for inheritance, while in C# we can use the sign ( :: ) between subclass and baseclass.



Author: mohit    11 May 2008Member Level: Gold   Points : 2
04. How is a property designated as read-only?
In VB.NET:
Private mPropertyName as DataType
Public ReadOnly Property PropertyName() As DataType
Get Return mPropertyName
End Get
End Property
In C#
Private DataType mPropertyName;
public returntype PropertyName
{
get{
//property implementation goes here
return mPropertyName;
}
// Do not write the set implementation
}



Author: mohit    11 May 2008Member Level: Gold   Points : 2
05. What is hiding in CSharp ?
Hiding is also called as Shadowing. This is the concept of Overriding the methods. It is a concept used in the Object Oriented Programming.
E.g.
public class ClassA {
public virtual void MethodA() {
Trace.WriteLine("ClassA Method");
}
}
public class ClassB : ClassA {
public new void MethodA() {
Trace.WriteLine("SubClass ClassB Method");
}
}
public class TopLevel {
static void Main(string[] args) {
TextWriter tw = Console.Out;
Trace.Listeners.Add(new TextWriterTraceListener(tw));

ClassA obj = new ClassB();
obj.MethodA(); // Outputs “Class A Method"

ClassB obj1 = new ClassB();
obj.MethodA(); // Outputs “SubClass ClassB Method”
}
}



Author: mohit    11 May 2008Member Level: Gold   Points : 2
06. What is the difference between an XML "Fragment" and an XML "Document." An XML fragment is an XML document with no single top-level root element. To put it simple it is a part (fragment) of a well-formed xml document. (node) Where as a well-formed xml document must have only one root element.


Author: mohit    11 May 2008Member Level: Gold   Points : 2
07. What does it meant to say “the canonical” form of XML?
"The purpose of Canonical XML is to define a standard format for an XML document. Canonical XML is a very strict XML syntax, which lets documents in canonical XML be compared directly.
Using this strict syntax makes it easier to see whether two XML documents are the same. For example, a section of text in one document might read Black & White, whereas the same section of text might read Black & White in another document, and even in another. If you compare those three documents byte by byte, they'll be different. But if you write them all in canonical XML, which specifies every aspect of the syntax you can use, these three documents would all have the same version of this text (which would be Black & White) and could be compared without problem. This Comparison is especially critical when xml documents are digitally signed. The digital signal may be interpreted in different way and the document may be rejected.



Author: mohit    11 May 2008Member Level: Gold   Points : 2

08. Why is the XML InfoSet specification different from the Xml DOM? What does the InfoSet attempt to solve? "The XML Information Set (Infoset) defines a data model for XML. The Infoset describes the abstract representation of an XML Document. Infoset is the generalized representation of the XML Document, which is primarily meant to act as a set of definitions used by XML technologies to formally describe what parts of an XML document they operate upon.
The Document Object Model (DOM) is one technology for representing an XML Document in memory and to programmatically read, modify and manipulate a xml document. Infoset helps defining generalized standards on how to use XML that is not dependent or tied to a particular XML specification or API. The Infoset tells us what part of XML Document should be considered as significant information.



Author: mohit    11 May 2008Member Level: Gold   Points : 2
09. Contrast DTDs versus XSDs. What are their similarities and differences? Which is preferred and why? Document Type Definition (DTD) describes a model or set of rules for an XML document. XML Schema Definition (XSD) also describes the structure of an XML document but XSDs are much more powerful. The disadvantage with the Document Type Definition is it doesn’t support data types beyond the basic 10 primitive types. It cannot properly define the type of data contained by the tag. An Xml Schema provides an Object Oriented approach to defining the format of an xml document. The Xml schema support most basic programming types like integer, byte, string, float etc., We can also define complex types of our own which can be used to define a xml document. Xml Schemas are always preferred over DTDs as a document can be more precisely defined using the XML Schemas because of its rich support for data representation.


Author: mohit    11 May 2008Member Level: Gold   Points : 2
10. Speaking of Boolean data types, what's different between C# and C/C++?
There's no conversion between 0 and false, as well as any other number and true, like in C/C++.



Author: mohit    11 May 2008Member Level: Gold   Points : 2
11. How do you convert a string into an integer in .NET?
Int32.Parse(string)



Author: mohit    11 May 2008Member Level: Gold   Points : 2
12. Can you declare a C++ type destructor in C# like ~MyClass()?
Yes, but what's the point, since it will call Finalize(), and Finalize() has no guarantees when the memory will be cleaned up, plus, it introduces additional load on the garbage collector.



Author: mohit    11 May 2008Member Level: Gold   Points : 2
13. What's different about namespace declaration when comparing that to package declaration in Java?
No semicolon.



Author: mohit    11 May 2008Member Level: Gold   Points : 2
14. What's the difference between const and readonly? The readonly keyword is different from the const keyword. 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;



Author: mohit    11 May 2008Member Level: Gold   Points : 2
15. What does \a character do?
On most systems, produces a rather annoying beep.



Author: mohit    11 May 2008Member Level: Gold   Points : 2
16. Can you create enumerated data types in C#?
Yes.



Author: mohit    11 May 2008Member Level: Gold   Points : 2
17. What's different about switch statements in C#?
No fall-throughs allowed.



Author: mohit    11 May 2008Member Level: Gold   Points : 2
18. What happens when you encounter a continue statement inside the for loop?
The code for the rest of the loop is ignored, the control is transferred back to the beginning of the loop.



Author: mohit    11 May 2008Member Level: Gold   Points : 2
19. How can you sort the elements of the array in descending order?
By calling Sort() and then Reverse() methods.



Author: mohit    11 May 2008Member Level: Gold   Points : 2
20. Will finally block get executed if the exception had not occurred?
Yes.



Author: mohit    11 May 2008Member Level: Gold   Points : 2
21. What's the C# equivalent of C++ catch (…), which was a catch-all statement for any possible exception?
A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this case and just write catch {}.



Author: mohit    11 May 2008Member Level: Gold   Points : 2
22. 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    11 May 2008Member Level: Gold   Points : 2
23. 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    11 May 2008Member Level: Gold   Points : 2
24. What's the difference between // comments, /* */ comments and /// comments?
Single-line, multi-line and XML documentation comments.



Author: mohit    11 May 2008Member Level: Gold   Points : 2
25. How do you generate documentation from the C# file commented properly with a command-line compiler?
Compile it with a /doc switch.



Author: mohit    11 May 2008Member Level: Gold   Points : 2
26. 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    11 May 2008Member Level: Gold   Points : 2
27. 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    11 May 2008Member Level: Gold   Points : 2
28. 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    11 May 2008Member Level: Gold   Points : 2
29. Does C# support multiple inheritance?
No, use interfaces instead.



Author: mohit    11 May 2008Member Level: Gold   Points : 2
30. So how do you retrieve the customized properties of a .NET application from XML .config file? Can you automate this process?
Initialize an instance of AppSettingsReader class. Call the GetValue method of AppSettingsReader class, passing in the name of the property and the type expected. Assign the result to the appropriate variable. In Visual Studio yes, use Dynamic Properties for automatic .config creation, storage and retrieval.



Author: mohit    11 May 2008Member Level: Gold   Points : 2
33. What are jagged array?
First lets us answer the question that what an array is?
The dictionary meaning of array is an orderly arrangement or sequential arrangement of elements.
In computer science term:
An array is a data structure that contains a number of variables, which are accessed through computed indices. The variables contained in an array, also called the elements of the array, are all of the same type, and this type is called the element type of the array.
An array has a rank that determines the number of indices associated with each array element. The rank of an array is also referred to as the dimensions of the array. An array with a rank of one is called a single-dimensional array. An array with a rank greater than one is called a multi-dimensional array. Specific sized multidimensional arrays are often referred to as two-dimensional arrays, three-dimensional arrays, and so on.
Now let us answer What are jagged arrays?
A jagged array is an array whose elements are arrays. The elements of jagged array can be of different dimensions and sizes. A jagged array is sometimes called as “array-of-arrays”. It is called jagged because each of its rows is of different size so the final or graphical representation is not a square.
When you create a jagged array you declare the number of rows in your array. Each row will hold an array that will be on any length. Before filling the values in the inner arrays you must declare them.
Jagged array declaration in C#:
For e.g. : int [] [] myJaggedArray = new int [3][];
Declaration of inner arrays:

myJaggedArray[0] = new int[5] ; // First inner array will be of length 5.
myJaggedArray[1] = new int[4] ; // Second inner array will be of length 4.
myJaggedArray[2] = new int[3] ; // Third inner array will be of length 3.
Now to access third element of second row we write:
int value = myJaggedArray[1][2];
Note that while declaring the array the second dimension is not supplied because this you will declare later on in the code.
Jagged array are created out of single dimensional arrays so be careful while using them. Don’t confuse it with multi-dimensional arrays because unlike them jagged arrays are not rectangular arrays.
For more information on arrays:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vclrfarrayspg.asp



Author: mohit    11 May 2008Member Level: Gold   Points : 2
1. Why is it not a good idea to insert code into InitializeComponent method when working with Visual Studio?
The designer will likely through it away, most of the code inside InitializeComponent is auto-generated.



Author: mohit    11 May 2008Member Level: Gold   Points : 2
32. Where do you add an event handler?
It's the Attributesproperty, the Add function inside that property.
e.g. btnSubmit.Attributes.Add(""onMouseOver"",""someClientCode();"")



Author: mohit    11 May 2008Member Level: Gold   Points : 2
34. What is a delegate, why should you use it and how do you call it ? A delegate is a reference type that refers to a Shared method of a type or to an instance method of an object. Delegate is like a function pointer in C and C++. Pointers are used to store the address of a thing. Delegate lets some other code call your function without needing to know where your function is actually located. All events in .NET actually use delegates in the background to wire up events. Events are really just a modified form of a delegate. It should give you an idea of some different areas in which delegates may be appropriate:
• They enable callback functionality in multi-tier applications as demonstrated in the examples above.
• The CacheItemRemoveCallback delegate can be used in ASP.NET to keep cached information up to date. When the cached information is removed for any reason, the associated callback is exercised and could contain a reload of the cached information.
• Use delegates to facilitate asynchronous processing for methods that do not offer asynchronous behavior.
• Events use delegates so clients can give the application events to call when the event is fired. Exposing custom events within your applications requires the use of delegates.
34. How does the XmlSerializer work? XmlSerializer in the .NET Framework is a great tool to convert Xml into runtime objects and vice versa
35. If you define integer variable and a object variable and a structure then how those will be plotted in memory.
Integer , structure – System.ValueType -- Allocated memory on stack , infact integer is primitive type recognized and allocated memory by compiler itself .
Infact , System.Int32 definition is as follows :
[C#]
[Serializable]
public struct Int32 : IComparable, IFormattable, IConvertible
So , it’s a struct by definition , which is the same case with various other value types .
Object – Base class , that is by default reference type , so at runtime JIT compiler allocates memory on the “Heap” Data structure .
Reference types are defined as class , derived directly or indirectly by System.ReferenceType




Author: mohit    11 May 2008Member Level: Gold   Points : 2
01. What is the syntax to inherit from a class in C#?
Ans: Place a colon and then the name of the base class.
Example: class MyNewClass : MyBaseClass



Author: mohit    11 May 2008Member Level: Gold   Points : 2
02. Can you prevent your class from being inherited by another class?
Ans : Yes. The keyword “sealed” will prevent the class from being inherited.



Author: mohit    11 May 2008Member Level: Gold   Points : 2
03. Can you allow a class to be inherited, but prevent the method from being over-ridden?
Ans: Yes. Just leave the class public and make the method sealed.



Author: mohit    11 May 2008Member Level: Gold   Points : 2
04. What’s an abstract class?
Ans: 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    11 May 2008Member Level: Gold   Points : 2
05. When do you absolutely have to declare a class as abstract?
1. When the class itself is inherited from an abstract class, but not all base abstract methods have been overridden.
2. When at least one of the methods in the class is abstract.



Author: mohit    11 May 2008Member Level: Gold   Points : 2
06. What is an interface class?
Ans : Interfaces, like classes, define a set of properties, methods, and events. But unlike classes, interfaces do not provide implementation. They are implemented by classes, and defined as separate entities from classes.



Author: mohit    11 May 2008Member Level: Gold   Points : 2
07. Why can’t you specify the accessibility modifier for methods inside the interface?
Ans : They all must be public, and are therefore public by default.



Author: mohit    11 May 2008Member Level: Gold   Points : 2
08. Can you inherit multiple interfaces?
Ans : Yes. .NET does support multiple interfaces.



Author: mohit    12 May 2008Member Level: Gold   Points : 2
09. What happens if you inherit multiple interfaces and they have conflicting method names?
Ans : 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.
To Do: Investigate



Author: mohit    12 May 2008Member Level: Gold   Points : 2
10. What’s the difference between an interface and abstract class?
Ans : In an interface class, all methods are abstract - there is no implementation. In an abstract class some methods can be concrete. In an interface class, no accessibility modifiers are allowed. An abstract class may have accessibility modifiers.



Author: mohit    12 May 2008Member Level: Gold   Points : 2
11. What is the difference between a Struct and a Class?
Structs are value-type variables and are thus saved on the stack, additional overhead but faster retrieval. Another difference is that structs cannot inherit.



Author: mohit    12 May 2008Member Level: Gold   Points : 2
01. What’s the implicit name of the parameter that gets passed into the set method/property of a class?
Ans : Value. The data type of the value parameter is defined by whatever data type the property is declared as.



Author: mohit    12 May 2008Member Level: Gold   Points : 2
02. What does the keyword “virtual” declare for a method or property?
Ans : The method or property can be overridden.



Author: mohit    12 May 2008Member Level: Gold   Points : 2
03. How is method overriding different from method overloading?
Ans : 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    12 May 2008Member Level: Gold   Points : 2
04. Can you declare an override method to be static if the original method is not static?
Ans : No. The signature of the virtual method must remain the same. (Note: Only the keyword virtual is changed to keyword override)



Author: mohit    12 May 2008Member Level: Gold   Points : 2
05. What are the different ways a method can be overloaded?
Ans : Different parameter data types, different number of parameters, different order of parameters.



Author: mohit    12 May 2008Member Level: Gold   Points : 2
06. If a base class has a number of overloaded constructors and an inheriting class has a number of overloaded constructors; can you enforce a call from an inherited constructor to a specific base constructor?
Ans : 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    12 May 2008Member Level: Gold   Points : 2
01. What’s a delegate?
Ans : A delegate object encapsulates a reference to a method.



Author: mohit    12 May 2008Member Level: Gold   Points : 2
02. What’s a multicast delegate?
Ans : A delegate that has multiple handlers assigned to it. Each assigned handler (method) is called.



Author: mohit    12 May 2008Member Level: Gold   Points : 2
01. Is XML case-sensitive?
Ans : Yes.



Author: mohit    12 May 2008Member Level: Gold   Points : 2
02. What’s the difference between // comments, /* */ comments and /// comments?
Ans : Single-line comments, multi-line comments, and XML documentation comments.



Author: mohit    12 May 2008Member Level: Gold   Points : 2
-03. How do you generate documentation from the C# file commented properly with a command-line compiler?
Ans : Compile it with the /doc switch.




Author: mohit    12 May 2008Member Level: Gold   Points : 2
01. What are different transaction options available for services components?
There are 5 transactions types that can be used with COM+. Whenever an object is registered with COM+ it has to abide either to these 5 transaction types.
Disabled: - There is no transaction. COM+ does not provide transaction support for this component.
Not Supported: - Component does not support transactions. Hence even if the calling component in the hierarchy is transaction enabled this component will not participate in the transaction.
Supported: - Components with transaction type supported will be a part of the transaction if the calling component has an active transaction.
If the calling component is not transaction enabled this component will not start a new transaction.
Required: - Components with this attribute require a transaction i.e. either the calling should have a transaction in place else this component will start a new transaction.
Required New: - Components enabled with this transaction type always require a new transaction. Components with required new transaction type instantiate a new transaction for themselves every time.



Author: mohit    12 May 2008Member Level: Gold   Points : 2
02. Can we use com Components in .net?.How ?.can we use .net components in vb?.Explain how ? COM components have different internal architecture from .NET components hence they are not innately compatible. However .NET framework supports invocation of unmanaged code from managed code (and vice-versa) through COM/.NET interoperability. .NET application communicates with a COM component through a managed wrapper of the component called Runtime Callable Wrapper (RCW); it acts as managed proxy to the unmanaged COM component. When a method call is made to COM object, it goes onto RCW and not the object itself. RCW manages the lifetime management of the COM component. Implementation Steps -
Create Runtime Callable Wrapper out of COM component. Reference the metadata assembly Dll in the project and use its methods & properties RCW can be created using Type Library Importer utility or through VS.NET. Using VS.NET, add reference through COM tab to select the desired DLL. VS.NET automatically generates metadata assembly putting the classes provided by that component into a namespace with the same name as COM dll (XYZRCW.dll)
.NET components can be invoked by unmanaged code through COM Callable Wrapper (CCW) in COM/.NET interop. The unmanaged code will talk to this proxy, which translates call to managed environment. We can use COM components in .NET through COM/.NET interoperability. When managed code calls an unmanaged component, behind the scene, .NET creates proxy called COM Callable wrapper (CCW), which accepts commands from a COM client, and forwards it to .NET component. There are two prerequisites to creating .NET component, to be used in unmanaged code:
1. .NET class should be implement its functionality through interface. First define interface in code, then have the class to implement it. This way, it prevents breaking of COM client, if/when .NET component changes.
2. Secondly, .NET class, which is to be visible to COM clients must be declared public. The tools that create the CCW only define types based on public classes. The same rule applies to methods, properties, and events that will be used by COM clients.
Implementation Steps - 1. Generate type library of .NET component, using TLBExporter utility. A type library is the COM equivalent of the metadata contained within a .NET assembly. Type libraries are generally contained in files with the extension .tlb. A type library contains the necessary information to allow a COM client to determine which classes are located in a particular server, as well as the methods, properties, and events supported by those classes. 2. Secondly, use Assembly Registration tool (regasm) to create the type library and register it.
3. Lastly install .NET assembly in GAC, so it is available as shared assembly.



Author: mohit    12 May 2008Member Level: Gold   Points : 2
03. What is Runtime Callable wrapper? When it will created ?
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 manage calls between a .NET client and a COM object. This wrapper turns the COM interfaces exposed by the COM component into .NET-compatible interfaces. For oleautomation (attribute indicates that an interface is compatible with Automation) 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.



Author: mohit    12 May 2008Member Level: Gold   Points : 2
04. What is Com Callable wrapper? When it will created? .NET components are accessed from COM via a COM Callable Wrapper (CCW). This is similar to a RCW, but works in the opposite direction. Again, if the wrapper cannot be automatically generated by the .NET development tools, or if the automatic behavior 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. CCWs also manage the object identity and object lifetime of the managed objects they wrap.


Author: mohit    12 May 2008Member Level: Gold   Points : 2
05. What is a primary interop ? A primary interop assembly is a collection of types that are deployed, versioned, and configured as a single unit. However, unlike other managed assemblies, an interop assembly contains type definitions (not implementation) of types that have already been defined in COM. These type definitions allow managed applications to bind to the COM types at compile time and provide information to the common language runtime about how the types should be marshaled at run time.


Author: mohit    12 May 2008Member Level: Gold   Points : 2
06. What are tlbimp and tlbexp tools used for ? The Type Library Exporter generates a type library that describes the types defined in a common language runtime assembly. The Type Library Importer converts the type definitions found within a COM type library into equivalent definitions in a common language runtime assembly. The output of Tlbimp.exe is a binary file (an assembly) that contains runtime metadata for the types defined within the original type library.


Author: mohit    12 May 2008Member Level: Gold   Points : 2
07. What benefit do you get from using a Primary Interop Assembly (PIA)? PIAs are important because they provide unique type identity. The PIA distinguishes the official type definitions from counterfeit definitions provided by other interop assemblies. Having a single type identity ensures type compatibility between applications that share the types defined in the PIA. Because the PIA is signed by its publisher and labeled with the PrimaryInteropAssembly attribute, it can be differentiated from other interop assemblies that define the same types.




Author: mohit    12 May 2008Member Level: Gold   Points : 2
01. What debugging tools come with the .NET SDK?
Ans : 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.



Author: mohit    12 May 2008Member Level: Gold   Points : 2
02. What does assert() method do?
Ans : 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    12 May 2008Member Level: Gold   Points : 2
03. What’s the difference between the Debug class and Trace class?
Ans : Documentation looks the same. Use Debug class for debug builds, use Trace class for both debug and release builds.



Author: mohit    12 May 2008Member Level: Gold   Points : 2
04. Why are there five tracing levels in System.Diagnostics.TraceSwitcher?
Ans : 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.



Author: mohit    12 May 2008Member Level: Gold   Points : 2
05. Where is the output of TextWriterTraceListener redirected?
Ans : To the Console or a text file depending on the parameter passed to the constructor.



Author: mohit    12 May 2008Member Level: Gold   Points : 2
06. How do you debug an ASP.NET Web application?
Ans : Attach the aspnet_wp.exe process to the DbgClr debugger.



Author: mohit    12 May 2008Member Level: Gold   Points : 2
07. What are three test cases you should go through in unit testing?
Ans : 1. Positive test cases (correct data, correct output).
2.Negative test cases (broken or missing data, proper handling).
3. Exception test cases (exceptions are thrown and caught properly).



Author: mohit    12 May 2008Member Level: Gold   Points : 2
08. Can you change the value of a variable while debugging a C# application?
Ans : Yes. If you are debugging via Visual Studio.NET, just go to Immediate window.



Author: mohit    12 May 2008Member Level: Gold   Points : 2
08. Can you change the value of a variable while debugging a C# application?
Ans : Yes. If you are debugging via Visual Studio.NET, just go to Immediate window.



Author: mohit    12 May 2008Member Level: Gold   Points : 2
02. 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.


Author: mohit    12 May 2008Member Level: Gold   Points : 2
03. 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.



Author: mohit    12 May 2008Member Level: Gold   Points : 2

04. 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.



Author: sac    12 May 2008Member Level: Diamond   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.

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: sac    12 May 2008Member Level: Diamond   Points : 2
3. 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.

4. 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.

5. 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: sac    12 May 2008Member Level: Diamond   Points : 2
6. 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.

7. 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: sac    12 May 2008Member Level: Diamond   Points : 2
8. 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.

9. 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    13 May 2008Member Level: Gold   Points : 2
thanks a lot sac for your feedbacks... it was great from you


Author: himika    15 May 2008Member Level: Gold   Points : 2
1) What is difference between the following 2 lines….

int temp = (int)(0×00);

int temp = (0×00int);





Author: himika    15 May 2008Member Level: Gold   Points : 2
2) Implement the following function for sorting a linked list of integers in ascending order. The function takes a pointer to the head of the list, and returns a pointer to the head of the sorted list. Your function should use only a constant amount of memory. It’s prohibited to change the value of ListNode, instead ListNodes must be rearranged. struct ListNode{ int value() { return _value; } ListNode *pNext;private: int _value;}; ListNode* SortList(ListNode *pHead){ // Insert your implementation here}

I need this implementation code




Author: himika    15 May 2008Member Level: Gold   Points : 2
There is a planet more than thousand light years away from earth. They have a big
problem, because they still don’t have a police force and laws, and people are fighting
for land.

There are N (2 <= N <= 1000) people living in this planet. Every person has an
ID number from 1 to N and no two persons will have the same ID number. When they
fight the stronger one wins and the weaker loses. There are M (1 <= M <=
1000) fights going on.

You
are given the strength of each person and the fighting pairs and you have to
determine the winner of each fight.

There won’t be any two persons
with the same strength
Input (fight.in)

1. First line contains N and M.

2. Each of the next N Lines contains one integer Pi (1
<= Pi
<= 2000) which is the strength the ith
person.

3. Next M lines contains two integers x and y (1 <= x, y <= N), the ID
numbers of the fighting pair.

Output (fight.out)

First
M lines should contain one integer which is the ID no of the winner of the
respective fight.
Example Input

4 4

1

3

5

2

1 2

2 3

3 4

1 4

Example Output

2

3

3

4




Author: himika    15 May 2008Member Level: Gold   Points : 2
3) People in a certain island want a modern airport. This island has the shape of a
square with side length L (1 <= L <= 10). Its top left corner is at X, Y
(0 <= X, Y <= 50) and the right bottom corner is at X+L, Y+L. They have a
list of N (0 <= N <= 20) existing airports and their locations which they
need to visit frequently. These may be
situated inside this island or outside. Any number of airports can be situated
at the same coordinate position.

The aircraft fly only along grid lines for safety reasons. For example the distance
between (4, 6) and (7, 5) is 7-4+6-5 = 4. The top left corner of the grid is 0,
0. X axis increases from 0, left to right and Y axis increases from top to
bottom from 0. All the airports including the new one are located on grid
points. The total cost of traveling is the sum of the distances to all the other
airports from the new airport. They want the new airport to be located so
that the total cost of traveling is minimized.

Your
task is to find the total cost T of traveling when the airport is built at the
location where the total cost is minimized.

Input (Standard
Input)

1. First Line will be four integers X, Y, L and N.

2. Each of the next N Lines will contain two integers x, y (0 <= x, y
<= 100), the coordinates of an existing airport.

Output (Standard
Output)

You
should output T.
Example Input

2 3 2 4

0 0

4 3

5 5

3 4

Example Output

12


Author: himika    15 May 2008Member Level: Gold   Points : 2
4) Which is the only operator in c++ which can be overloaded but not inherited?




Author: himika    15 May 2008Member Level: Gold   Points : 2
5 ) Write a program that reads a positive integer N and then prints an “N times table” containing values up to N * N.
For example, if program reads the value 5, it should pront
5 * 1 = 5
5 * 2 = 10
5 * 3 = 15
5 * 4 = 20
5 * 5 = 25


Author: himika    15 May 2008Member Level: Gold   Points : 2
6) what is the output of the below.?why?
Class A
{
public:
void func();
};
class B:pubic A
{
void func(int a);
};
int main()
{
B derv;
derv.func();
}




Author: himika    15 May 2008Member Level: Gold   Points : 2
7) What are near,far,huge pointers


Author: sri phani kumari    16 May 2008Member Level: Gold   Points : 2
lot of doubts mohit have plese clrify them


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: How to Find the MAC Address of Network interface Card of your Computer
Previous Resource: C LANGUAGE QUESTIONS-1
Return to Discussion Resource Index
Post New Resource
Category: Computer & Technology


Post resources and earn money!
 
Related Resources


Contact Us    Privacy Policy    Terms Of Use   

SpiderWorks Technologies Pvt Ltd. 2006 - 2007 All Rights Reserved.