Interview Tips Interview Tips, Interview Questions and Answers

30Aug/100

Interview Questions on Networking

What are the factors that affect the performance of NIC?
The following factors affect the performance of NIC,
Bus Speed :- It depends on ISA or PCI slot. PCI has higher speed.
Memory :- More the memory, better the performance.
Memory Access Method :- DMA is faster than I/O method.

What is datagram in a TCP/IP network?
At the network layer of TCP/IP model the data unit created is called the 'datagram '.

ST connectors or SMA connectors are used with which type of cable?
NOTE: This is objective type question, Please click question title for correct answer.

What is a Passive Hub?
Passive hub is a type of hub that do not provide the amplification of signals.

These hub also do not require any external electrical supply.

What are different switching methods used by a switch to send data?
Switch adopts two methods for sending data,

Cut Through Switching:-
In this method of switching data frames are send to the destination computer without error and integrity checking.

Store and Forward Switching:-
In this method the switch sends the data frames after receiving all the frames well as after error and integrity checking.

11Apr/100

asp.net interview: How to redirect a page to another page?

A common question asked in interviews. The Response object has a famous Redirect method that is used most widely to transfer a web page visitor from one page to another page.

Syntax of Response.Redirect ...
Response.Redirect("DestinationPage.aspx")

There is another famous method called Transfer method of the Server object.

Syntax of Server.Transfer ...
Server.Transfer("DestinationPage.aspx")

29Mar/100

ASP .NET Interview Questions, Part 2

19. Whats an assembly? Assemblies are the building blocks of the .NET framework. Overview of assemblies from MSDN

20. Describe the difference between inline and code behind. Inline code written along side the html in a page. Code-behind is code written in a separate file and referenced by the .aspx page.

21. Explain what a diffgram is, and a good use for one? The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML. For reading database data to an XML file to be sent to a Web Service.

22. Whats MSIL, and why should my developers need an appreciation of it if at all? MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL.

23. Which method do you invoke on the DataAdapter control to load your generated dataset with data? The .Fill() method

24. Can you edit data in the Repeater control? No, it just reads the information from its data source

25. Which template must you provide, in order to display data in a Repeater control? ItemTemplate

26. How can you provide an alternating color scheme in a Repeater control? Use the AlternatingItemTemplate

27. What property must you set, and what method must you call in your code, in order to bind the data from some data source to the Repeater control? You must set the DataSource property and call the DataBind method.

28. What base class do all Web Forms inherit from? The Page class.

29. Name two properties common in every validation control? ControlToValidate property and Text property.

30. What tags do you need to add within the asp:datagrid tags to bind columns manually? Set AutoGenerateColumns Property to false on the datagrid tag

31. What tag do you use to add a hyperlink column to the DataGrid?

32. What is the transport protocol you use to call a Web service? SOAP is the preferred protocol.

33. True or False: A Web service can only be written in .NET? False

34. What does WSDL stand for? (Web Services Description Language)

35. Where on the Internet would you look for Web services? (http://www.uddi.org)

36. Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box? DataTextField property

37. Which control would you use if you needed to make sure the values in two different controls matched? CompareValidator Control

38. True or False: To test a Web service you must create a windows application or Web application to consume this service? False, the webservice comes with a test page and it provides HTTP-GET method to test.

39. How many classes can a single .NET DLL contain? It can contain many classes.

24Mar/100

C# Interview Questions, Part 1

1. What’s the implicit name of the parameter that gets passed into the class’ set method? Value, and its datatype depends on whatever variable we’re changing.

2. 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++.

3. Does C# support multiple inheritance? No, use interfaces instead.

4. When you inherit a protected class-level variable, who is it available to? Classes in the same namespace.

5. Are private class-level variables inherited? Yes, but they are not accessible, so looking at it you can honestly say that they are not inherited. But they are.

6. Describe the accessibility modifier protected internal. It’s available to derived classes and classes within the same Assembly (and naturally from the base class it’s declared in).

7. C# provides a default constructor for me. I write a constructor that takes a string as a parameter, but want to keep the no parameter one. How many constructors should I write? Two. Once you write at least one constructor, C# cancels the freebie constructor, and now you have to write one yourself, even if there’s no implementation in it.

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

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

10. What does the keyword virtual mean in the method definition? The method can be over-ridden.

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

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

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

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

15. What’s an abstract class? A class that cannot be instantiated. A concept in C++ known as pure virtual method. A class that must be inherited and have the methods over-ridden. Essentially, it’s a blueprint for a class without any implementation.

16. When do you absolutely have to declare a class as abstract (as opposed to free-willed educated choice or decision based on UML diagram)? When at least one of the methods in the class is abstract. When the class itself is inherited from an abstract class, but not all base abstract methods have been over-ridden.

17. What’s an interface class? It’s an abstract class with public abstract methods all of which must be implemented in the inherited classes.

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

19. Can you inherit multiple interfaces? Yes, why not.

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

15Mar/100

C# interview questions on Constructors and destructors

What is a constructor in C#?
Constructor is a class method that is executed when an object of a class is created. Constructor has the same name as the class, and usually used to initialize the data members of the new object.

In C#, What will happen if you do not explicitly provide a constructor for a class?
If you do not provide a constructor explicitly for your class, C# will create one by default that instantiates the object and sets all the member variables to their default values.

Structs are not reference types. Can structs have constructors?
Yes, even though Structs are not reference types, structs can have constructors.

We cannot create instances of static classes. Can we have constructors for static classes?
Yes, static classes can also have constructors.

Can a class or a struct have multiple constructors?
Yes, a class or a struct can have multiple constructors. Constructors in csharp can be overloaded.

Can a child class call the constructor of a base class?
Yes,

Can you mark static constructor with access modifiers?
No, we cannot use access modifiers on static constructor.

Can you have parameters for static constructors?
No, static constructors cannot have parameters.

What happens if a static constructor throws an exception?
If a static constructor throws an exception, the runtime will not invoke it a second time, and the type will remain uninitialized for the lifetime of the application domain in which your program is running.

Give 2 scenarios where static constructors can be used?
1. A typical use of static constructors is when the class is using a log file and the constructor is used to write entries to this file.
2. Static constructors are also useful when creating wrapper classes for unmanaged code, when the constructor can call the LoadLibrary method.

Does C# provide copy constructor?
No, C# does not provide copy constructor.

8Mar/100

Microsoft – C# Interview Questionsv

1. How do you inherit from a class in C#?
2. What is .NET Framework?
3. How we handle sql exceptions? What is the class that handles SqlServer exceptions?
4. What is the advantage of serialization?
5. how to fill datalist usinf XML file and how to bind it,code behind language is c#
6. What is the difference between const and static read-only?
7. Is it mandatory to implement all the methods which are there in abstract class if we inherit that abstract
8. Why do I get a "CS5001: does not have an entry point defined" error when compiling?
9. What's the implicit name of the parameter that gets passed into the class' set method?
10. What is indexer? Where it is used explain
11. Does C# support multiple inheritance?
12. When you inherit a protected class-level variable, who is it available to?
13. Are private class-level variables inherited?
14. Describe the accessibility modifier protected internal.
15. What is the implicit name of the parameter that gets passed into the class set method?
16. What's the top .NET class that everything is derived from?
17. How's method overriding different from overloading?
18. What does the keyword virtual mean in the method definition?
19. What is an abstract class?
20. What is the data provider name to connect to Access database?

25Feb/100

C# interview questions with answers

How can you check a nullable variable is assigned?
using hasvalue method

what is the syntax of a nullable variable?
Nullable myval=null;

I would like to check a variable as assigned or not. How can we do that?
Declare the variable as Nullable

What are the different compiler generated methods when a .NET delegate is compiled?
Compilation of a .NET delegate results in a sealed class with three compiler generated methods whose parameters and return values are dependent on the delegate declaration. The methods are,
Invoke()
BeginInvoke() and
EndInvoke().

When TimerCallback delegate is used?
Many application have the need to call a specific method during regular intervals. For such situations we can use the System.Threading.Timer type in conjunction with a related delegate named TimerCallback.

Which enumeration defines different PenCap in C#?
LineCap enumeration which defines different pen cap styles as follows,

public enum LineCap
{
Flat, Square, Round, Triangle, NoAncher, SquareAnchor,
RoundAnchor, DiamondAnchor, ArrowAnchor, AnchorMask, Custom
}

What is the use of param keyword in C#?
In C# param parameter allows us to create a method that may be sent to a set of identically typed arguments as a single logical parameter.

8Feb/100

15 Most Basic C# Interview Questions with Answers

  1. 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.
  2. How do you inherit from a class in C#? Place a colon and then the name of the base class.!!!!
  3. When you inherit a protected class-level variable, who is it available to? Only classes that ultimately inherit from the class with a protected member can see that member.
  4. Are private class-level variables inherited? Yes, but they are not accessible, so looking at it you can honestly say that they are not inherited. But they are.
  5. Describe the accessibility modifier protected internal. It’s available to derived classes and classes within the same Assembly (and naturally from the base class it’s declared in).
  6. 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.
  7. 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.
  8. What’s an interface class? It’s an abstract class with public abstract methods all of which must be implemented in the inherited classes.
  9. 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.
  10. Can you inherit multiple interfaces? Yes, why not.
  11. C# provides a default constructor for me. I write a constructor that takes a string as a parameter, but want to keep the no parameter one. How many constructors should I write? Two. Once you write at least one constructor, C# cancels the freebie constructor, and now you have to write one yourself, even if there’s no implementation in it.
  12. What’s the top .NET class that everything is derived from? System.Object.
  13. 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.
  14. What’s an abstract class? A class that cannot be instantiated. A concept in C++ known as pure virtual method. A class that must be inherited and have the methods over-ridden. Although an abstract class does not require implementations (its methods can be abstract) it can also offer implementations of methods (either virtual or not) which can be called in implementing classes.
  15. When do you absolutely have to declare a class as abstract (as opposed to free-willed educated choice or decision based on UML diagram)? When at least one of the methods in the class is abstract. When the class itself is inherited from an abstract class, but not all base abstract methods have been over-ridden.