Interview Tips Interview Tips, Interview Questions and Answers

15May/110

General Questions

1.Does C# support multiple-inheritance?
No. But you can use Interfaces.

2.Where is a protected class-level variable available?
It is available to any sub-class derived from base class

3.Are private class-level variables inherited?
Yes, but they are not accessible.

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

6.Which class is at the top of .NET class hierarchy?
System.Object.

7.What does the term immutable mean?
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.

8.What’s the difference between System.String and System.Text.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.

9.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 a string is changed, a new instance in memory is created.

10.Can you store multiple data types in System.Array?
No.

11.What’s the difference between the System.Array.CopyTo() and System.Array.Clone()?
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.

12.How can you sort the elements of the array in descending order?
By calling Sort() and then Reverse() methods.

13.What’s the .NET collection class that allows an element to be accessed using a unique key?
HashTable.

14.What class is underneath the SortedList class?
A sorted HashTable.

15.Will the finally block get executed if an exception has not occurred?
Yes.

16.What’s the C# syntax to catch 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 {}.

17.Can multiple catch blocks be executed for a single try statement?
No. Once the proper catch block processed, control is transferred to the finally block .

18.Explain the three services model commonly know as a three-tier application?
Presentation (UI), Business (logic and underlying code) and Data (from storage or other sources).

10Jan/110

Array Functions in VBScript

Array Returns a variant containing an array
Filter Returns a zero-based array that contains a subset of a string array based on a filter criteria
IsArray Returns a Boolean value that indicates whether a specified variable is an array
Join Returns a string that consists of a number of substrings in an array
LBound Returns the smallest subscript for the indicated dimension of an array
Split Returns a zero-based, one-dimensional array that contains a specified number of substrings
UBound Returns the largest subscript for the indicated dimension of an array

17Nov/100

What Can Generics Do For Me?

In .NET v1.0 there were collections, such as the ArrayList for working with groups of objects. An ArrayList is much like an array, except it could automatically grow and offered many convenience methods that arrays don't have. The problem with ArrayList and all the other .NET v1.0 collections is that they operate on type object. Since all objects derive from the object type, you can assign anything to an ArrayList. The problem with this is that you incur performance overhead converting value type objects to and from the object type and a single ArrayList could accidentally hold different types, which would cause a hard to find errors at runtime because you wrote code to work with one type. Generic collections fix these problems.

A generic collection is strongly typed (type safe), meaning that you can only put one type of object into it. This eliminates type mismatches at runtime. Another benefit of type safety is that performance is better with value type objects because they don't incur overhead of being converted to and from type object. With generic collections, you have the best of all worlds because they are strongly typed, like arrays, and you have the additional functionality, like ArrayList and other non-generic collections, without the problems.

29Jun/100

JavaScript & AJAX interview questions

1.  JavaScript is interpreted by _________

A.  Client

B.   Server

C.  Object

D.  None of the above

2.  Using _______ statement is how you test for a specific condition.

A.  Select

B.  If

C.  Switch

D.  For

3.  Which of the following is the structure of an if statement?

A.  if (conditional expression is true) thenexecute this codeend if

B.   if (conditional expression is true)execute this codeend if

C.  if (conditional expression is true)   {then execute this code>->}

D.  if (conditional expression is true) then {execute this code}

4.  How to create a Date object in JavaScript?

A.  dateObjectName = new Date([parameters])

B.   dateObjectName.new Date([parameters])

C.  dateObjectName := new Date([parameters])

D.  dateObjectName Date([parameters])

5.  The _______ method of an Array object adds and/or removes elements from an array.

A.  Reverse

B.   Shift

C.  Slice

D.  Splice

6.  To set up the window to capture all Click events, we use which of the following statement?

A.  window.captureEvents(Event.CLICK);

B.   window.handleEvents (Event.CLICK);

C.  window.routeEvents(Event.CLICK );

D.  window.raiseEvents(Event.CLICK );

7.  Which tag(s) can handle mouse events in Netscape?

A.  <IMG>

B.  <A>

C.  <BR>

D.  None of the above

8.  ____________ is the tainted property of a window object.

A.  Pathname

B.   Protocol

C.  Defaultstatus

D.  Host

9.  To enable data tainting, the end user sets the _________ environment variable.

A.  ENABLE_TAINT

B.   MS_ENABLE_TAINT

C.  NS_ENABLE_TAINT

D.  ENABLE_TAINT_NS

10.  In JavaScript, _________ is an object of the target language data type that encloses an object of the source language.

A.  a wrapper

B.   a link

C.  a cursor

D.  a form

25Mar/100

C# Interview Questions, Part 2

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

22. How can you overload a method? Different parameter data types, different number of parameters, different order of parameters.

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

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

25. What’s the advantage of using System.Text.StringBuilder over System.String? StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each time it’s being operated on, a new instance is created.

26. Can you store multiple data types in System.Array? No.

27. What’s the difference between the System.Array.CopyTo() and System.Array.Clone()? The first one performs a deep copy of the array, the second one is shallow.

28. How can you sort the elements of the array in descending order? By calling Sort() and then Reverse() methods.

29. What’s the .NET datatype that allows the retrieval of data by a unique key? HashTable.

30. What’s class SortedList underneath? A sorted HashTable.

31. Will finally block get executed if the exception had not occurred? Yes.

32. 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 {}.

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

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

35. What’s a delegate? A delegate object encapsulates a reference to a method. In C++ they were referred to as function pointers.

36. What’s a multicast delegate? It’s a delegate that points to and eventually fires off several methods.

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

38. What are the ways to deploy an assembly? An MSI installer, a CAB archive, and XCOPY command.

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

40. What namespaces are necessary to create a localized application? System.Globalization, System.Resources.

13Mar/100

C# interview questions and answers

1. What’s the advantage of using System.Text.StringBuilder over System.String?

StringBuilder is more efficient in cases where a large amount of manipulation is done in the text. Strings are immutable, so it is increasingly being operated, a new instance is created.

2. Can you store multiple data types in System.Array?

No.

3. What’s the difference between the System.Array.CopyTo() and System.Array.Clone()?

The first three performs a deep copy of the array, the second three is shallow.

4. How can you sort the elements of the array in descending order?

By calling Sort() and then Reverse() methods.

5. 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 Process.Exception. You can also omit the parameter information type in this case and write catch {}.

6. Why is it a bad idea to throw your own exceptions?

Well, if that point is known that an error has occurred, why not write the code of law to resolve this error, instead of passing a new Exception object to the catch block? Start your own exclusions means that some design flaws in the project.

7. What’s a delegate?

A delegate object encapsulates a reference to a system. In C++ they were referred to as function pointers.

8. How’s the DLL Hell problem solved in .NET?

Assembly versions allows the application to specify not only the library it needs to function (which was available under Win32), but also the version of the Assembly.

9. What are the ways to deploy an assembly?

An MSI installer, a CAB archive, and XCOPY command.

10. What’s a satellite assembly?

When writing a multilingual application in multi-cultural. NET, and need to deliver the core application separately from the localized modules, the localized assemblies that change the core application are called satellite assemblies.

11. What’s the difference between // comments, /* */ comments and /// comments?

Single-line, multi-line and XML documentation comments.

12. How do you generate documentation from the C# file commented properly with a command-line compiler?

Compile it with a /doc switch.

13. What’s the difference between <c> and <code> XML documentation tag?

Single line code example and multiple-line code example.

9Mar/100

C# Interview Questions & Answers :

1. Does C# support multiple-inheritance?
No.

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

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

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

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

6. What does the term immutable mean?
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.

7. What’s the difference between System.String and System.Text.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.

8. 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 a string is changed, a new instance in memory is created.

9. Can you store multiple data types in System.Array?
No.

10. What’s the difference between the System.Array.CopyTo() and System.Array.Clone() ?
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.

29Dec/090

C# interview questions

    1. What’s the advantage of using System.Text.StringBuilder over System.String? StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each time it’s being operated on, a new instance is created.
    2. Can you store multiple data types in System.Array? No.
    3. What’s the difference between the System.Array.CopyTo() and System.Array.Clone()? The first one performs a deep copy of the array, the second one is shallow.
    4. How can you overload a method? Different parameter data types, different number of parameters, different order of parameters.
    5. 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.
    6. 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.
    7. What’s a delegate? A delegate object encapsulates a reference to a method. In C++ they were referred to as function pointers.
    8. What’s a multicast delegate? It’s a delegate that points to and eventually fires off several methods.

More: http://tipsinterview.com/doc/Csharp_Interview_Questions.doc