Archive by Author


11 Jun

Here are some very commonly asked questions in a .NET/SQL Interview..

Q: What is CLR?
Answer: The Common Language Runtime (CLR) is the virtual machine component of Microsoft’s .NET framework and is responsible for managing the execution of .NET programs. In a process known as just-in-time (JIT)compilation, the CLR compiles the intermediate language code into the machine instructions that in turn are executed by the computer’s CPU.

Q: What are lambda expressions?

Answer: Let us start by an example:

delegate int del(int i);

static void Main(string[] args)


del myDelegate = x => x * x;

int j = myDelegate(5); //j = 25


The left side of the lambda operator (=>) specifies the input parameters (if any) and the right side holds the expression or statement block. The lambda expression x => x * x is read “x goes to x times x.”

Q:What is the difference between hashtable and Dictionary?

Answer: Dictionary is a generic type, Hashtable is not. So, you get type safety with Dictionary, because you can’t insert any random object into it, and you don’t have to cast the values you   take out. Hashtable is thread safe for use by multiple reader threads and a single writing thread, while in Dictionary public static members are thread safe, but any instance members are not guaranteed to be thread safe.

Q: Describe cycles in a ASP.NET Page life

Answer:  To answer this question Please read the following link:

Q: Is String a Value Type of Reference Type?

Answer: String is a reference type.

Q: IN SSIS Packages What are variables and what is variable scope?

Answer:  A variable is used to store values. There are basically two types of variables, System Variable (like ErrorCode, ErrorDescription, PackageName etc) whose values you can use but cannot change and User Variable which you create, assign values and read as needed. A variable can hold a value of the data type you have chosen when you defined the variable. Variables can have a different scope depending on where it was defined. For example you can have package level variables which are accessible to all the tasks in the package and there could also be container level variables which are accessible only to those tasks that are within the container.

Q: What is the use of Sequence Containers in SSIS Packages?

Answer: Using Sequence Containers lets you handle the control flow in more detail, without having to manage individual tasks and containers. For example, you can set the Disable property of the Sequence container to True to disable all the tasks and containers in the Sequence container.

If a package has many tasks then it is easier to group the tasks in Sequence Containers and you can collapse and expand Sequence Containers.

Q: What does NullIF expression in SQL do?

Answer: NULLIF returns the first expression if the two expressions are not equal. If the expressions are equal, NULLIF returns a null value of the type of the first expression.

NULLIF ( expression1 , expression2 )


Thanks for reading my post. If you would like me to post more questions please comment in the section below.


20 May

Things to do in Las Vegas:

    Las Vegas
    VenetianThese are said to be the replicas of famous 17th & 18th century Renaissance artists Tiepolo, Rici, Pellogrini, and Bambino. The floor is the exact replica of the Church of Gesuiti of Venice built in 1728.
    Bellagio Fountains The fountains put on their show — wonderfully timed to music choreography.
    TowerA signature of the Las Vegas skyline, the replica Eiffel Tower at Paris Las Vegas is a half-scale exact reproduction of one of Europe’s most famous landmarks.
    Newyork HotelBridgeNew York New York Hotel and Casino replicates New York’s skyline and its most famous landmarks.
    MGM CasinoLion Habitat MGM If you’re around the MGM Grand, you may find a visit to the Lion Habitat right up your street!
    StratosphereStratosphere RidesTower is the tallest observation tower, and the 9th tallest freestanding structure, in the United States, as well as being the tallest structure in Las Vegas.The top of the tower has two observation decks, a restaurant known as “Top of the World” (revolving restaurant), and four thrill rides:
  8. LUXOR:
    LUXOR This hotel is shaped like a pyramid. It has a sphinx outside which is huge! Take some time to have a look around this Egyptian themed hotel and casino.
    Cirque_du_soleliHere’s their website to describe the show & get tickets:
    Grand Canyon It is considered one of the Seven Natural Wonders of the World. You can drive or take a tour from Las Vegas.
    Fremont Street downtownThe most obvious and largest part of the Fremont Street Experience is the Viva Vision canopy and light show. The canopy towers 90 feet above the ground and spans the length of five football fields. Featuring more than 12 million LED modules and 555,000-watt sound system, the light show attracts tourists and locals alike.


26 Apr "Politics is a funny game"


It is all about seat

The complexities of political system, mindset of politicians and downgrading of countries have always puzzled my tiny innocent brain 🙂 When I was growing up, I was always told that country comes first therefore I am having a hard time understanding the concept of politicians spending their whole time thinking about elections, winning a seat and NOT about country and economy.


Every day I somehow feel the pressure of a slowing economy, Wall Street Blunders and Congress Failure!! Everyday I ask myself: Is it my fault that I elected these politicians?? For months and months politicians will criticize each other and then one day I will wake up, flip the newspaper and see this –

We are best friends

Thank GOD I am not one of them.



SQL INDEXING – Simplified

3 Apr SQL Indexing

Let us talk about indexing in SQL Server:

Depending on size of the data, a table can have more than a million rows. If you want to search for a specific record there are two ways:

  1. Go row by row and see if that is the row you want.
    Example: Let us say we want to search an employee table that has 1 million rows for an employee with last name “Smith”. Remember you can have more than one record with name “Smith”. One way to do this is to go record by record and check if last name is “Smith”. The problem with this approach is that this will be very slow as you have to go row by row. May be there is only one record with last name “Smith” and that could be the last record. In this case you will have to read one million times, only to find one record. This in SQL terms is called “TABLE SCAN”.
  2. The second approach is a better approach. What if I tell you that all names are sorted in “Alphabetical Order”. So, if you directly go to half a million record and if that name is say “Karsen” then you know “Smith” will be after “Karsen” (‘S’ comes after ‘K’). Now you can go directly to six hundred thousand record and if that name is “Tedd” then you know “Smith” is between half a million record and six hundred thousand record.  So now in two attempts you have narrowed it down from one million to hundred thousand. Isn’t that great? This is what is called as indexing.

Let us now get deep into details. Indexes are created on columns in tables. The index provides a fast way to look up data based on the values within those columns. An index is made up of a set of pages (index nodes) that are organized in a B-tree structure. Figure below shows how a typical B-tree looks like.


SQL Indexing Example
Fig.1 – B-tree.


Data is stored in the form of pages. Now let us try to find records with last name “Dull”.
Go to Root Page (level 1). With indexing now we know that any name starts with ‘Bennet’ and is before ‘Karsen’ we should go to page 1007. What this means is if we want to find out employees with name “Charlie” we should go to page 1007 and if we want to find out employees with name “Kyle’ we should go to page 1009 (“Ky” comes between “Ka” and “Sm”).

So, looking at page 1007 (level 0) we see that if name is between ‘Bennet’ and ‘Greane’ (‘D’ comes between ‘B’ and ‘G’) we need to go to page 1132. So, let us go there and find out.

Looking at page 1132 we can see record with name “Dull”. Hurray…. our search is over. We found our record. This is how indexing will work typically.

There are two types of indexes, Clustered index and Non Clustered Index. Clustered index is on primary key and data will be physically sorted. So, leaf level will have the actual data record. In a non-clustered index level will have a pointer to actual data page. This means you have to go one extra step to actually get your data. Remember indexes can make your search faster but insert, updates and delete will be slower.

Thanks for visiting my blog. Please feel free to leave suggestions/feedbacks/comments.
If you like my post please click “LIKE” button below.

Read about SQL Technical Interview Questions here: Crack the SQL Interview

Written by Amit Uppal

Email us

SQL Interview Questions

1 Apr

These are the most common yet tricky questions that you can expect in a .NET/SQL interview.

1)      What is the difference between truncate and Delete?

  1.  Delete will fire delete trigger, truncate will not.
  2. The DELETE statement removes rows one at a time and records an entry in the transaction log for each deleted row.TRUNCATE TABLE removes the data by deallocating the data pages used to store the table data and records only the page deallocations in the transaction log.Once you truncate you can’t rollback.
  3. If there is an identity column in the table truncate will reset identity to 1, delete will not.

2)      Name the different type of joins

  1. Inner Join
  2. Outer Join  (Left Outer Join and Right Outer Join)
  3. Cross join
  4. Self-Join

3)      What is an Index?

There are two types of indexes. Clustered index and Non Clustered Index. A table can have only 1 Clustered Index while it can have up to 249 & 999 nonclustered indexes on SQL Server 2005 & 2008 respectively. A clustered index stores the actual data rows at the leaf level of the index. Indexes can make Select statement fast but delete, update and insert statements will get slow.

4)      What are different types of Isolation levels in SQL Server





e)       SNAPSHOT

 5)      What are different types of constraints in SQL Server?

  1.  Primary key Constraint
  2. Foreign key Constraint
  3. Check Constraint
  4. Unique Key Constraint

6)      What is the difference between where and having clause?

A having clause is typically used when you use group by clause.


SELECT titles.pub_id, AVG(titles.price)
FROM titles INNER JOIN publishers
ON titles.pub_id = publishers.pub_id
WHERE publishers.state = ‘CA’
GROUP BY titles.pub_id
HAVING AVG(titles.price) > 10

WHERE clause is applied first to the individual rows in the tables . Only the rows that meet the conditions in the WHERE clause are grouped. The HAVING clause is then applied to the rows in the result set

7)      How would you do “Error Handling” in SSIS?

SSIS package could mainly have two types of errors

a) Procedure Error: Can be handled in Control flow through the precedence control and redirecting the execution flow.

b) Data Error: is handled in DATA FLOW TASK buy redirecting the data flow using Error Output of a component.

8)      What is the difference between a primary key and a unique key?

Both primary key and unique enforce uniqueness of the column on which they are defined. But by default primary key creates a clustered index on the column. Major difference is that, primary key does not allow NULLs, but unique key allows NULL.

9)      What are defaults? Is there a column to which a default cannot be bound?

A default is a value that will be used by a column, if no value is supplied to that column while inserting data. IDENTITY columns and timestamp columns can’t have defaults bound to them.

You can create default and then bind a column to them.


//This will create default ” ZipCode ” in database

Create default ZipCode as “78746″

//This will bind the default we created to a column “PostalCode” in table “EmployeeData”
sp_bindefault ZipCode, “EmployeeData.PostalCode”
10)  What is SQL Blocking?
Blocking happens when one connection from an application holds a lock and a second connection requires a conflicting lock type. This forces the second connection to wait, blocked on the first.
Thanks for visiting my blog. Please feel free to leave suggestions/feedbacks/comments.
If you like my post please click “LIKE” button below.

Check back again for more SQL and .NET Interview Questions. Read more on .NET Questions here .NET Questions

Anyone on Twitter? Follow @MCADDeveloper @Consultpri

Commonly asked .NET Technical Interview Questions and ANSWERS!

20 Mar

Here are some commonly asked .NET Interview Questions which you can expect in a Technical .NET Interview.

What is CLR?
Common Language Runtime.

  • CLR is responsible for managing the execution of .NET programs.
  • It invokes just-in-time (JIT) compiler which is responsible for converting IL code to machine code.
  • The CLR provides additional services including memory management, type safety and exception handling. Memory management is provided using Garbage collector.

What is CLS?
Common Language Specification.

  • Set of basic language features needed by many applications.
  • Helps enhance and ensure language interoperability by defining a set of features that developers can rely on to be available in a wide variety of languages

What is Inheritance?
It is one of the most important features of Object Oriented programming that helps in using existing functionality and we do not have to write same code again and again in all classes. (Please refer to my blog post on inheritance for further explanation)

What are Interfaces?
Interfaces define members without implementations. A class can only inherit from only one class but can implement more than one interface. See more information on inheritance below.

What is Polymorphism?
Through inheritance, a class can be used as more than one type; it can be used as its own type, any base types, or any interface type if it implements interfaces. This is called polymorphism.

What is Reflection?
All .NET compilers produce metadata about the types defined in the modules
they produce. This metadata is packaged along with the module (modules in
turn are packaged together in assemblies), and can be accessed by a
mechanism called reflection. The System.Reflection namespace contains
classes that can be used to interrogate the types for a module/assembly.

Does C# support multiple-inheritance?

C# Tutorials: Inheritance

When you derive a class from a base class, the derived class will inherit all members of the base class except constructors.
Example: Let us define a base class “Location”. This class will have two Properties City and State. We will define two methods in this class, one is Get City which will be a virtual method (Derive class can override it) and other will be abstract method getState (Which must be overridden). Here is the code:

Code for Base Class:
using System;
namespace MyCode
public abstract class Location
/// <summary>
/// This is constructor
/// </summary>
public Location()
/// <summary>
/// this is Property
/// </summary>
public string City { get; set; }

/// <summary>
/// this is Property
/// </summary>
public string State { get; set; }

/// <summary>
/// getCity
/// </summary>
/// <returns></returns>
/// Virtual means derived class can override it
public virtual string getCity()
return City;

/// <summary>
/// getState
/// </summary>
/// <returns></returns>
/// abstract means derived class must overide it
public abstract string getState();

Now we will write two classes that will derive from the base class (Location). One class will override getCity Method and other will not.
Code for Derived Classes:
using System;
namespace MyCode
public class IBMCompanyLocation : Location
public IBMCompanyLocation()
State = “Texas”;
/// <summary>
/// getCity
/// </summary>
/// <returns></returns>
public override string getCity()
return “Austin”;
/// <summary>
/// getState
/// </summary>
/// <returns></returns>
public override string getState()
return State;
using System;
namespace MyCode
public class MicrosoftCompanyLocation : Location
public MicrosoftCompanyLocation()

State = “Washington”;
City = “Seattle”;
/// <summary>
/// getState
/// </summary>
/// <returns></returns>
public override string getState()
return State;

%d bloggers like this: