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.

10Jul/100

How to use performance monitor to diagnose bottlenecks in your application?

Monitor is a tool built to assist you in diagnosing the problem.
Type ‘perfmon’ in command prompt to access Performance Monitor

The counters, sampling intervals, etc can be used to monitor the performance.

A baseline should be established so that critical reference points, changes and trends can be observed and identified.

Results can be made more readable by removing all the distracting sample noise so that the graphical view of trend lines is not blurred. This can be done using buckets - a vertical line, indicating the minimum, average, and maximum of the sample points in the bucket.

It should be noted that the bottlenecks can be caused due to over utilization of physical disk, memory, process, CPU, and network.

30May/100

Whats the difference betweeen Structure, Class and Enumeration

Structures and Enumerations are Value-Types. This means, the data that they contain is stored as a stack on the memory. Classes are Reference-Types, means they are stored as a heap on the memory.
Structures are implicitly derived from a class called System.ValueType. The purpose of System.ValueType is to override the virtual methods defined by System.Object. So when the runtime encounters a type derived from System.ValueType, then stack allocation is achieved. When we allocate a structure type, we may also use the new keyword. We may even make a constructor of a structure, but, remember, A No-argument constructor for a structure is not possible. The structure's constructor should always have a parameter.

So if we define the following structure

struct MyStruct
{
public int y,z;
}
and we create a structure type
MyStruct st = new MyStruct();

In case of a class, no-argument constructors are possible. Class is defined using the class keyword.

A struct cannot have an instance field, whereas a class can.

class A
{
int x = 5; //No error
...
}

struct
{
int x = 5; //Syntax Error
}

A class can inherit from one class (Multiple inheritance not possible). A Structure cannot inherit from a structure.

Enum is the keyword used to define an enumeration. An enumeration is a distinct type consisting of a set of named constants called the enumerator list. Every enumeration has an underlying type. The default type is "int". Note: char cant be the underlying data type for enum. First value in enum has value 0, each consequent item is increased by 1.

enum colors {red, green, blue, yellow};

Here, red is 0, green is 1, blue is 2 and so on.
An explicit casting is required to convert an enum value to its underlying type

int x = (int)colors.yellow;

2May/100

Explain the concepts of CTS and CLS(Common Language Specification).

CTS

When different languages are integrated and want to communicate, it is certain that the languages have their own data types and different declaration styles. CTS define how these different variables are declared and used in run time. E.g. VB offers an Integer data type while C++ offers long data type. Using CTS, these data types are converted to System32 which itself a data type of CLS.

CLS

Any language(s) that intend to use the Common Language Infrastructure needs to communicate with other CLS-Compliant language. This communication is based on set of rules laid by CLS. These rules define a subset of CTS.

24Mar/100

Data Dictionary Queries for Oracle

For ORACLE
select * from sys.dba_objectswhere owner = 'scott'and object_type='TABLE'
SELECT owner, object_name, object_type FROM sys.dba_objectswhere object_type='SEQUENCE' and owner='scott';

3Mar/100

C# interview questions and answers

I need to restrict a class by creating only one object throughout the application. How can I achieve this?
We can declare the constructor of the class as either protected or as private

int? d = 1; Type testType = d.GetType(); will result…
NOTE: This is objective type question, Please click question title for correct answer.

How can you make your machine shutdown from your program?
Process.Start("shutdown", "-s -f -t 0");

What is the use of unsafe keyword in C#?
In C# the value can be directly referenced to a variable, so there is no need of pointer. Use of pointer sometime crashes the application. But C# supports pointer, that means we can use pointer in C#.

The use of pointer in C# is defined as a unsafe code. So if we want to use pointer in C# the pointer must be present in the body of unsafe declaration. But pointer does not come under garbage collection.

Example:-

unsafe
{
int a, *b;
a = 25;
b = &a;
Console.WriteLine("b= {0}",b);//returns b= 25
}

What is difference between var and Dynamic ?
Var word was introduced with C#3.5(specifically for LINQ) while dynamic is introduced in C#4.0. variables declared with var keyword will get compiled and you can have all its related methods by intellisense while variables declared with dynamic keyword will never get compiled. All the exceptions related to dynamic type variables can only be caught at runtime.

What is dynamic keyword ?
Its newly introduced keyword of C#4.0. To indicate that all operations will be performed runtime.

What will happen if you declare a variable named "checked" with any data type?
Compiler will throw an error as checked is a keyword in C# So It cannot be used as variable name. Checked keyword is used to check the overflow arithmetic checking.

What are anonymous methods?
Anonymous methods are another way to declare delegates with inline code except named methods.

Restrictions of yield in try-catch.
While using yield keyword, mainly two restrictions are observed.
First is , we can’t use yield in finally.
Second is , we can’t place yield keyword in the catch block if try contains more than one catch blocks.

With yield break statement, control gets …
NOTE: This is objective type question, Please click question title for correct answer.

What first action compiler will take on detection of iterator ?
As soon as compiler will detect iterator, it will automatically generate current, MoveNext and Disposemethods of the IEnumerator or IEnumerator(T) type.

28Feb/100

C# interview questions with answers

What are the different method parameter modifiers in C#?
out
ref
params

What are the different Iteration Constructs in C#?
for loop
foreach/in loop
while loop
do/while loop

What is the use of ?? operator in C#?
This operator allows you to assign a value to a nullable type if the retrieved value is in fact null.

What is the CIL representation of implicit and explicit keywords in C#?
The CIL representation is op_Implicit and op_Explicit respectively.

Which operators in C# provides automatic detection of arithmetic overflow and underflow conditions?
'checked' and 'unchecked' keywords provide automatic detection of arithmetic overflow and underflow conditions.

What is the use of stackalloc keyword in C#?
In an unsafe context it is used to allocate C# array directly on the stack.

Which keyword in C# is used to temporarily fix a variable so that its address may be found?
fixed keyword

What are the different C# preprocessor directives?
#region , #endregion :- Used to mark sections of code that can be collapsed.

#define , #undef :-Used to define and undefine conditional compilation symbols.

#if , #elif , #else , #endif :- These are used to conditionally skip sections of source code.

What is the use of GetInvocationList() in C# delegates?
GetInvocationList() returns an array of System.Delegate types, each representing a particular method that may be invoked.

C# delegate keyword is derived form which namespace?
C# delegate keyword is derived form System.MulticastDelegate.

What will be the length of string type variable which is just declared but not assigned any value?
As variable is not initialized and it is of reference type. So it's length will be null and it will throw a run time exception of "System.NullReferenceException" type, if used.

18Feb/100

C# Interview Questions and Answers

1) The C# keyword ?int? maps to which .NET type?

  1. System.Int16

  2. System.Int32

  3. System.Int64

  4. System.Int128

2) Which of these string definitions will prevent escaping on backslashes in C#?

  1. string s = #?n Test string?;

  2. string s = ??n Test string?;

  3. string s = @?n Test string?;

  4. string s = ?n Test string?;

3) Which of these statements correctly declares a two-dimensional array in C#?

  1. int[,] myArray;

  2. int[][] myArray;

  3. int[2] myArray;

  4. System.Array[2] myArray;

4) If a method is marked as protected internal who can access it?

  1. Classes that are both in the same assembly and derived from the declaring class.

  2. Only methods that are in the same class as the method in question.

  3. Internal methods can be only be called using reflection.

  4. Classes within the same assembly, and classes derived from the declaring class.

5) What is boxing?

a) Encapsulating an object in a value type.

b) Encapsulating a copy of an object in a value type.

c) Encapsulating a value type in an object.

d) Encapsulating a copy of a value type in an object.

6) What compiler switch creates an xml file from the xml comments in the files in an assembly?

  1. /text

  2. /doc

  3. /xml

  4. /help

7) What is a satellite Assembly?

  1. A peripheral assembly designed to monitor permissions requests from an application.

  2. Any DLL file used by an EXE file.

  3. An assembly containing localized resources for another assembly.

  4. An assembly designed to alter the appearance or ?skin? of an application.

8) What is a delegate?

  1. A strongly typed function pointer.

  2. A light weight thread or process that can call a single method.

  3. A reference to an object in a different process.

  4. An inter-process message channel.

9) How does assembly versioning in .NET prevent DLL Hell?

  1. The runtime checks to see that only one version of an assembly is on the machine at any one time.

  2. .NET allows assemblies to specify the name AND the version of any assemblies they need to run.

  3. The compiler offers compile time checking for backward compatibility.

  4. It doesn?t.

10) Which ?Gang of Four? design pattern is shown below?

public class A {

    private A instance;

    private A() {

    }

    public
static A Instance {

        get

        {

            if ( A == null )

                A = new A();

            return instance;

        }

    }

}

  1. Factory

  2. Abstract Factory

  3. Singleton

  4. Builder