Get benefited from interview Q/A and Online Test section. Subscribe to this blog to get updates directly in your mail box.
Best View in Google Crome, Mozilla firefox or IE 7 or above

Monday, December 26, 2011

How to Learn Dotnet Basics?

This article is intended for Students, freshers or experienced professionals who want to learn dotnet as beginners.

Classroom training in Dotnet:

To get started and familiarize with Dotnet Tools and Techniques , a classroom training in dotnet is very helpful. You can learn many things in a short span of time. So, enroll yourself in a good Dotnet training programme.

Online tutorials:

There are many useful websites that guides you with Dotnet step by step tutorials, examples etc. There are also a lot of dotnet videos tutorials available in the internet.

Here are some useful websites to get started:
http://www.asp.net/web-forms/tutorials
http://www.asp.net/web-forms/videos
http://www.dotnetspider.com/tutorials
http://www.w3schools.com
http://asp.net-tutorials.com
http://www.csharp-station.com/Tutorial/

There are many more useful websites on Dotnet tutorials. If you come across a good website, do share in comments.

Books:

.Net Programming Black Book
Microsoft Press books
Wrox Publication

Sunday, July 24, 2011

Dotnet Interview Questions for 1 year experience

Here are few basic dotnet interview questions asked in interview for a 1 year experience candidate.

About your project:

Get maximum knowledge about your current project. You should know the architecture diagram of your project. Also, you have to explain the Dataflow. You might be asked to tell what all dotnet new features used in your project.

Then follows technical discussion.

Dotnet Framework Interview Questions for 1 Year Experience:

1. What is CLR and it's functions?
2. How memory is managed in Dotnet applications?
Hint: Automatically by Garbage collector
3. What is an assembly?
4. What is a strong name?
5. What is MSIL?

C# Interview Questions for 1 Year Experience:

1. What are the 4 pillars of Object Oriented Programming?
2. What is a Class? What is an Object?
3. What is a partial class?
4. What is a sealed class?
5. What is constructor?
6. What is stringbuilder?

ADO.Net Interview Questions for 1 Year Experience:

1. What is connection string?
2. What is Datareader?
3. Difference between Dataset and datareader?
4. What is Ado.Net?
5. Namespace for using sqlserver database?

ASP.Net Interview Questions for 1 Year Experience:

1. What is web.config file and it's use?
2. What is global.asax?
3. What is session?
4. Which all controls you have used in your project?
5. What is gridview?
6. What is Authentication in ASP.Net and types of authentication?

SQL Server Interview Questions for 1 Year Experience:

1. What is Primary key, unique key and difference between them?
2. What is index? Types of index?
3. What is a stored procedure? Why it is better than inline query?
Hint: Stored Procedure is precompiles and has a execution plan. Hence faster execution.
4. You might be asked to write simple query
5. What is inner join

Also, if you know any advance concepts like WCF, WPF, LINQ, MVC, JQuerymention while telling "about yourself". You will be given preference. But, make sure you know the basics or worked on them for sometime.

Post questions you faced in interview in comments. Also post answers in comments to questions mentioned above.

Monday, July 11, 2011

What is the difference between web.config and machine.config

This is a common question asked in ASP.Net interviews.

Web.config and machine.config are two files used for managing configuration of web applications.

Machine.config:

1. The configurations mentioned in machine.config file are applicable to all the applications hosted in a machine/computer/server.

2. The machine.config file is located in x:\\Microsoft.NET\Framework\\config\machine.config

3. There can be only one machine.config file per machine (per dotnet framework installed).

web.config:

1. web.config file contains configurations for a single application.

2. Web.config files overrides the configurations mentioned in machine.config file.

3. The web configuration file is located in your application's root folder

4. There can be multiple web.config files in a single web application in different sub folders.

Sunday, July 10, 2011

Difference between a temp table and Table Variable in SQL Server

I have faced this question in almost all the interviews. What is the difference between a Temporary table and Table Variable in SQL Server?

Here are the main differences:

1. Declaration syntax:

Temp Table:       CREATE TABLE #tmptbl(ID INT, NAME VARCHAR(20))
Table Variable:   DECLARE @tblvar TABLE(ID INT, NAME VARCHAR(20))

2. Creating Index:

You can create Indexes (Clustered and non-clustered Indexes) in Temp Tables. This can return records faster if there are large number of records in a table.

You cannot create indexes in Table Variables.
Note: You can have Primary key in table variables which will create a clustered index by default. But you cannot create any index explicitly by using Create Index command.

3. Transaction:

The transaction logs are not recorded for the table-variables. Hence, we cannot implement transaction mechanism in case of table variables.
But transaction mechanism is applicable in case of temp tables.

CREATE TABLE #tmptbl (val VARCHAR(50))
DECLARE @tblvar TABLE(val VARCHAR(50))

INSERT INTO #tmptbl VALUES ('Old value in temp table')
INSERT INTO @tblvar VALUES ('Old value in table variable')

BEGIN TRAN
UPDATE
#tmptbl SET val='New value in temp table'
UPDATE @tblvar SET val='New value in table variable'

SELECT * FROM #tmptbl
SELECT * FROM @tblvar
ROLLBACK

SELECT * FROM #tmptbl
SELECT * FROM @tblvar




The output will be as below:


New value in temp table
New value in table variable


Old value in temp table
New value in table variable


Notice that the Update command against the table variable is not getting rolled back.

4. Stored Procedure Recompilation:

A procedure with a temporary table cannot be pre-compiled. But a procedure with table-variables can be compiled in advance. A Pre-compiled Stored Procedure runs faster.

5. Performance:

For small to medium volumes of data and simple usage scenarios you should use table variables. For large set of data, you should go for Temp tables (with proper Indexes).

If you have any more differences, please share in comments.

Sunday, June 26, 2011

Find the Bugs in this C Sharp Dotnet Code

Here is another simple C Sharp dotnet interview question.

There is a piece of code in C# Dotnet as written below. The function takes a number array as input and returns the largest number. It has few bugs in it. Find out the bugs and fix them.

Code :

        public static int Largest(int[] list)
        {
            int max = int.MaxValue;

            for (int i = 0; i < list.Length - 1; i++)
                if (list[i] > max)
                    max = list[i];

            return max;
        }

You can post the answers as comments. Thank you.

String Reverse with X in between each character in C Sharp Dotnet

Here is a C# Interview question I faced in an interview. This is very easy. But, I am sharing just to make all of you aware of this type of questions being asked in interviews.

Question:

Write a function named XReverse in C# that will take a string as input and return the reverse of the string with 'X' in between each characters as Output.

Solution Code:


public static string xReverse(string inputStr)
        {
            int len = inputStr.Length;
            StringBuilder revStr = new StringBuilder();

            for (int i = len - 1; i >= 0; i--)
            {
                revStr.Append(inputStr[i]);
                if (i != 0)
                {
                    revStr.Append('X');
                }
            }
            return revStr.ToString();
        }

Output:


If anybody has any other solution or has a better idea, please share as comments.

Wednesday, March 30, 2011

Interview Question on Inheritance and Default Constructor

Here is a question on OOPS concepts like Inheritance and Default Constructor. The code provided is in C#.

There are three classes named A, B and C.
Class A has a default constructor that writes "In A" to console. Similarly Class B and C has default constructors that write "In B", and "In C" to Console respectively.
Class C inherits from Class B and Class B inherits from class A.

[Code]
class A
{
public A()
{
Console.WriteLine("In A");
}
}

class B:A
{
public B()
{
Console.WriteLine("In B");
}
}

class C:B
{
public C()
{
Console.WriteLine("In C");
}
}

[/Code]

Now, the question is as below.
If we instanciate class C, what will be the output.

[Code]
static void Main(string[] args)
{
C objC = new C();
Console.Read();
}

[/Code]

Result:
The result will be:
In A
In B
In C

Tuesday, March 29, 2011

What are the problems/challenges you faced in your previous projects?

Sometimes the interviewer asks a question like:
"What are the problems/challenges you faced in your previous projects?"

To answer this question, you have to think of all projects you handled and prepare a list of challenges you faced and how you resolved them. If you don't prepare this list, it will be difficult to remember all points at the time of interview.

I will list down few problems that I faced in my previous projects. That will help you prepare a list for yourself.

Challenge 1

Challenge: This is the biggest challenge I faced. The Production web application connecting to the Crystal Enterprise server was always down. The client was very upset and was using the UAT web application to run Ad-hoc query in Crystal Enterprise server.

Resolution: After a long research on Crystal Enterprise server, IIS, Web application settings, application pools etc for about 3 months, I got the answer.
Another application installed in the same application Pool was causing this web application down when there was any run time error in that application. I resolved the issue by separating the Application Pools for each web applications.

Challenge 2

Challenge: I was part of a Unit Testing team in a big project. We were doing Unit Testing in VSTS (Visual Studio Team System). The challenge was to achieve the code coverage above 90% and to automate the input data for test cases above 95%.

Resolution:
Code coverage - To achieve code coverage above 90% is very difficult task as it is very difficult to write test cases to prodecue all type of exceptions and reach all the catch block code. We put all our innovations to produce maximum type of exceptions and managed to keep code cpoverage above 90%.

Automating Test Data - We faced difficulty in automating test data for many scenarios. We put lots of innovations to automate test data above 95% level.
i) We used SQL query to retrieve test data dynamically and it helped automating test data for many scenarios.
ii) We organised the sequence of execution of few test cases and that helped for some scenarios. Example of a sequence: Create, Edit, Delete

You can post comments about some of the challenges you faced for others to learn & benefit from you.

Sunday, March 6, 2011

C# Online Test Questions and Answers

1. Can an Interface be instantiated directly?
Yes
No
It can be instantiated with static constructor
None of these
 

2. What is the Difference between Convert.ToInt32 and Int.Parse?
Both are Same
Int.Parse Can't Handle Null values , It will throws ArgumentNullException Error.
Convert.ToInt32 Can't Handle Null Values ,it will throws ArgumentNullException error.
Both can Handle Null Values
Both can't Handle Null Values
 

3. C# doesnot support:
inheritance
polymorphism
abstraction
multiple inheritance
C# supports all
 

4. Whice is true about Interface and abstract methods?
We can write only one abstract method inside interface.
No method is abstract inside interface
All the methods inside Interface in an abstract method.
None of the above
 

5. Which keyword is used to achieve shadowing in C#?
Abstract
Sealed
New
Shadow
None of the above
 

6. Which of the following class cannot be inherited?
Sealed
Abstract
Both
None
 

7. In C#, the statement that is used to replace multiple if statements is called?
?: (ternary operator)
The switch case statement
The nestedif statement
The #endif statement
None of these
 

8. Which of these is a valid path declaration?
string strPath="c:\\abc.txt";
string strPath="c:/abc.txt";
string strPath=@"c:\abc.txt";
All of these
None of these
 

9. What is the difference between Convert.ToString(str) and str.ToString() method?
Convert.ToString(str) function handles NULL while str.ToString() does not. It will throw a NULL reference exception.
str.ToString() function handles NULL while Convert.ToString(str) does not. It will throw a NULL reference exception.
Both can handle NULL
None can Handle NULL
 

10. Waht does a strong name contain?
assembly name
assembly version
publiuc key
All the above
None of these
 

Wednesday, January 12, 2011

Find number of words in a text file in C# Dotnet

The below code can be used to count the number of words in a text file.

using System;
using System.IO;

namespace ConsoleApplication1
{
class CountWords
{
public string content { get; set; }


 internal int wordsInFile(string P)
 {
   return File.ReadAllText(P).Split(' ').Length;
 }
}

class Program
{
 static void Main(string[] args)
 {
 CountWords c = new CountWords();
 int numWords = c.wordsInFile(@"C:\test_data.txt");
 Console.WriteLine(numWords);
 Console.ReadLine();
 }
}
}

Text and Speech Project in C# Dotnet

  © Blogger templates Shiny by Ourblogtemplates.com 2008

Back to TOP