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

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.

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");


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

static void Main(string[] args)
C objC = new C();


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%.

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?
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:
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#?
None of the above

6. Which of the following class cannot be inherited?

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

  © Blogger templates Shiny by 2008

Back to TOP