Interview Questions For 3 Year .NET Professionals

Introduction

Last week I attended an interview with Infosys, Chennai. When I entered the compound, there were very many candidates. The atmosphere and culture in Infosys was very nice.

Background

I have attended many interviews in my life. But the interview with Infosys was something different. I thought to share that experience with you all.

Points to be remember

There are some mistakes I made in the interview. I don't want you to do the same.
  1. Please ensure that you are maintaining eye contact with the interviewer.
  2. Be confident of what you say. Don't change your answer if the interviewer tries to make you do so.
  3. Please avoid the unwanted examples.
  4. Please never use any other technical terms that may provoke the interviewer into asking questions about.
  5. If you don't know the answer, please say "I don't know". It is always better to say so instead of going with the wrong answer.

You can find more tips here.

Questions asked and answers

Here I am giving the answers that I answered.

1. Tell me about yourself?

A. You can find many answers to this question in the internet. Please see the following link:

Tell me about yourself

2. What is your role in your project? What is the team size?

A. I said "My main role is coding, unit testing, big fixing and maintenance. My team size is 7".

3. What is the hierarchy of your team?

A. First I was confused by this question. Then I answered "Project Manager, Team Leader, Software Engineers, Trainees".

4. Describe the projects that you have worked on?

A. I described them. Please include the technologies you used in your projects and what kind of architecture (for example: 3-tire, n- tier) you used.

5. What is the employee size in your company? You don't need to be accurate. You can provide the approximate value.

A. I said "150 to 200".

Then he moved to the programming section.

6. Write an algorithm and program to determine whether or not a word is a palindrome.

We can do it in either of the following two ways:

a) Using a built-in function as in the following:

  1. string strRev,strReal = null;  
  2. Console.WriteLine("Enter the string..");  
  3. strReal = Console.ReadLine();  
  4. char[] tmpChar = strReal.ToCharArray();  
  5. Array.Reverse(tmpChar);  
  6. strRev=new string(tmpChar);  
  7. if(strReal.Equals(strRev, StringComparison.OrdinalIgnoreCase))  
  8. {  
  9.     Console.WriteLine("The string is pallindrome");  
  10. }  
  11. else  
  12. {  
  13.     Console.WriteLine("The string is not pallindrome");  
  14. }  
  15.     Console.ReadLine(); 


Ref: To check string is palindrome or not in .NET (C#)

b) Without using a built-in function.

When I wrote the first program, the interviewer asked me to write the same without using a built-in function.

  1. private static bool chkPallindrome(string strVal)  
  2.        {  
  3.            try  
  4.            {  
  5.                int min = 0;  
  6.                int max = strVal.Length - 1;  
  7.                while (true)  
  8.                {  
  9.                    if (min > max)  
  10.                        return true;  
  11.                    char minChar = strVal[min];  
  12.                    char maxChar = strVal[max];  
  13.                    if (char.ToLower(minChar) != char.ToLower(maxChar))  
  14.                    {  
  15.                        return false;  
  16.                    }  
  17.                    min++;  
  18.                    max--;  
  19.                }  
  20.            }  
  21.            catch (Exception)  
  22.            {  
  23.                  
  24.                throw;  
  25.            }  
  26.        } 

Ref: You can find more here: C# Palindrome

7. Write a program to determine the count of a specific character in a string.

A.

  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Text;  
  5.   
  6. namespace FindCountCharOccurance  
  7. {  
  8.     class Program  
  9.     {  
  10.         static void Main(string[] args)  
  11.         {  
  12.             string strOccur,strChar = null;  
  13.             Console.WriteLine("Enter the string in which you need to find the count of a char occurance");  
  14.             strOccur = Console.ReadLine();  
  15.               
  16.             Console.WriteLine("Enter the char to be searched..");  
  17.             strChar = Console.ReadLine();  
  18.             int intCnt =strOccur.Length- strOccur.Replace(strChar, string.Empty).Length;  
  19.             Console.WriteLine("Count of occurance is "+intCnt);  
  20.             Console.ReadLine();  
  21.         }  
  22.     }  

Please see this for more suggestions: count the number of characters in a string.

8. Next he gave me a program like the following and asked me what the output of this will be.

  1. public class A  
  2.     {  
  3.         public int A()  
  4.         {  
  5.             Console.WriteLine("Hi you are in class A");  
  6.         }  
  7.     } 

A. I said "Here we have a constructor A; a constructor should not have a return type. So the code above will throw a compilation error."

9. What may be the output of the following program?

  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Text;  
  5.   
  6. namespace RefClass  
  7. {  
  8.     class Program  
  9.     {  
  10.         static void Main(string[] args)  
  11.         {  
  12.             B bObj= new B();  
  13.             Console.ReadLine();  
  14.   
  15.         }  
  16.     }  
  17.     public class A  
  18.     {  
  19.         public  A()  
  20.         {  
  21.             Console.WriteLine("Hi you are in class A");  
  22.         }  
  23.     }  
  24.   
  25.     public class B:A  
  26.     {  
  27.         public B()  
  28.         {  
  29.             Console.WriteLine("Hi you are in class B");  
  30.         }  
  31.     }  

A. I said the output will be:

Hi you are in class A

Hi you are in class B

Even though you are creating an object of the derived class, it will invoke the base class first.

10. Write the output of the following program.

  1. class Program  
  2.     {  
  3.         static void Main(string[] args)  
  4.         {  
  5.             B bObj= new B(2);  
  6.             Console.ReadLine();  
  7.   
  8.         }  
  9.     }  
  10.     public class A  
  11.     {  
  12.         public  A()  
  13.         {  
  14.             Console.WriteLine("Hi you are in class A");  
  15.         }  
  16.   
  17.         public A(int x)  
  18.         {  
  19.               
  20.         }  
  21.     }  
  22.   
  23.     public class B:A  
  24.     {  
  25.         public B()  
  26.         {  
  27.             Console.WriteLine("Hi you are in class B");  
  28.         }  
  29.     } 

A. It will throw a compilation error.

B does not contain a constructor that takes 1 argument. If you want to make this program run, you must create a parameterized constructor for class B also.

11. Abstract and interface real time examples

B.Please read it here: Real time example of interface

12. Describe authentication, types, differences?

A. Forms, Windows, Passport. Please read more here: ASP.NET authentication and authorization

13. Why DBMS? Why don't we save data in separate files?

A. I didn't know what exactly he meant, I got stuck there for a while. Finally I came up with the answer that "Normalization" is the main advantage of a DBMS.

Read more here: Why use a DBMS?

14. What is the differences between a Primary key and a Unique key?

A. Primary key doesn't allow NULL, a unique key does.

15. What exactly is happening when we make a field a primary key?

A. A clustered index will be created for that specific field.

16. How may clustered index we can create in table?

A. Basically we can create only one clustered index, but there is a way to have more. Please read here: Only one clustered index can be created on table <Tablename>. (Visual Database Tools)

17. What is the difference between a clustered and a non-clustered index?

A. I explained, please read here: Clustered and Non-Clustered Index in SQL 2005

18. What is a Distributed System?

A. A collection of autonomous computers.

 
19. What will be the output for the below mentioned lines in JQuery?
     
  1. alert('5' + 5 + 5);  
  2. alert(5 + 5 + '5');  
  3. alert(5 + '5' + '5');  
  4. alert(5 + '5' ); 
That was little tricky at that time. For a while I thought, and I just wrote the question to a paper, and replied.       
  1. alert('5' + 5 + 5);    Output= 555  
  2. alert(5 + 5 + '5');    Output=105  
  3. alert(5 + '5' + '5');  Output=555  
  4. alert(5 + '5' );       Output=55 
Hmmm finally he said "You are selected for the next round" :)

Next was the direct HR round. That was a simple round. He just asked me to fill in some forms.

Finally they sent me an Offer Letter :)

Wish you good luck.
You can read another series of interview questions here : Interview Questions And Answers


Please find the original article here.

Up Next
    Ebook Download
    View all
    Learn
    View all