Here are some of the interview questions that even I have faced during the early days of my carrier. I will keep adding them as i get them. Would also like you to provide the ones that you have might have faced. So here they are :
1. What is the difference between Convert.ToString() & .ToString() – C# ?
Convert.ToString() can handle a null values in a variable but ToString() will give an error to the user when used.
2. Difference between Delete and Truncate – MS-SQL Server ?
Both are used to clear the data from the tables.
- But the difference is that, Delete can be used with WHERE clause but Truncate cannot use WHERE clause.
- Logs are maintained for the delete command but not for the Truncate. As a result, you can Rollback the delete command but you cannot roll back the truncate command.
- Truncate command resets the IDENTITY seed of the table but the delete command does not affects the identity values
3. What are constructors – C# ?
Constructors are the methods of the classes with the same name as the class name but with no return type. These are automatically called whenever an instance of the class is created using the new operator. A constructor may or may not have parameters. A constructor without any parameter is known as the default constructor. C# compiler provides a default constructor, in case the user does not writes any constructor for the class. The main role of the constructor is that it can be used to initialize the members of the class when ever its instance is created.
4. Can we call a stored procedure in another stored procedure – SQL Server ?
Yes, we can call a stored procedure in another stored procedure. We can also call a user defined function in a stored procedure.
5. Get the nth highest salary from a table – SQL Server.
Check out the answer here
6. What is M.S.I.L. – .NET Framework ?
M.S.I.L. stands for Microsoft Intermediate Language. When a programmer writes a program using VB or C# ,the compiler of that language converts it into an Intermediate code or Microsoft Intermediate Language and sends it to CLR which further converts it into native code for the machine.
7. What is Common Type System – .NET Framework ?
Different languages in .Net framework like VB and C# use different syntax to declare a data type. For Ex: an integer is declared as int in C# and integer in VB. To avoid any mismatch of these two declaration syntax, a common class System.Int32 has been defined to interpret these. Similarly for other data types like string, datetime etc. base classes have been defined. These all base classes are derived from a single base type System.Object , which form a system called as Common Type System or C.T.S.
8. What is difference between N-tier vs N-layer architecture ?
N-tier and n-layer are entirely different concepts. People often use this term interchangeably during the design of the application architecture. N-tier refers to the actual n system components of your application. For ex: Suppose you create a web application, its components include your application server where it is being hosted, the database being used with it, on another server and the user machine who access the application, forms the third component. These are referred to as the 3 tiers of your application. So they may be n in number and so the term n-tier application. So tiers are the physically separate components of the same system. On the other hand, layers refer to the internal architecture of your component. For ex: in your code, you divide the code into different layers like Data access layer, Business logic layer etc.. So they are internal to the component and these layers interact with each other internally to form the entire component.