Join Dotnetcodes DotnetCodes.com is online Discussion Forum for Software professionals . It lets you find friends around the world and Create professional network that share similar interests as you. Get help on ur projects by industry specialists. Also get answers to all ur technical/placement related querries.Get an edge over others.
Already MemberClick here to login
ASP.net MVC Interview Questions Answers Interview Questions
Get Started Developing for Android Apps with Eclipse Articles
.Net framework 4.0 Interview Questions Answers Interview Questions
SQL server reporting services Interview Questions (SSRS) part 1 Articles
Whats New in ASP.NET 4.0 Part 2 Articles
Serial Number in SSRS Articles
How to Print a Crystal Report direct to printer Articles
SharePoint 2010 interview Questions Answers Interview Questions
Html5 interview questions and answers Interview Questions
Explaining SDLC -System Development Life Cycle Articles
Difference between Encapsulation and Abstraction Interview Questions
Populate or bind Dropdownlist in Asp.net using Jquery and Json Articles
Infosys Interview Questions Interview Questions
Dynamic Menu using HTML List Tag and CSS in ASP.Net Articles
ASP.NET MVC Overview Interview Questions
Submit Articles | More Articles..

frequently asked OOPS Interview Question and Answer

Posted By: mitu678 On:12/21/2012 9:37:03 PM in:Interview Questions Category:OOPS Hits:2647
List of frequently asked OOPS  Interview Question and Answer

What is object-oriented programming (OOP)?

OOP is a technique to develop logical modules, such as classes that contain properties, methods, fields, and events. An object is created in the program to represent a class. Therefore, an object encapsulates all the features, such as data and behavior that are associated to a class. OOP allows developers to develop modular programs and assemble them as software. Objects are used to access data and behaviors of different software modules, such as classes, namespaces, and sharable assemblies. .NET Framework supports only OOP languages, such as Visual Basic .NET, Visual C#, and Visual C++.

How can prevent your class to be inherited further?
You can prevent a class from being inherited further by defining it with the sealed keyword.

What is the index value of the first element in an array?
In an array, the index value of the first element is 0 (zero).

Can you specify the accessibility modifier for methods inside the interface?\

All the methods inside an interface are always public, by default. You cannot specify any other access modifier for them.

Is it possible for a class to inherit the constructor of its base class?

No, a class cannot inherit the constructor of its base class. 

Can you declare an overridden method to be static if the original method is not static?

No. Two virtual methods must have the same signature.

Why is the virtual keyword used in code?

The virtual keyword is used while defining a class to specify that the methods and the properties of that class can be overridden in derived classes.

Can you allow a class to be inherited, but prevent a method from being overridden in C#?

Yes. Just declare the class public and make the method sealed.

 In which namespace, all .NET collection classes are contained?

The System.Collections namespace contains all the collection classes.

When do you really need to create an abstract class?

We define abstract classes when we define a template that needs to be followed by all the derived classes.

Is it a good practice to handle exceptions in code?

Yes, you must handle exceptions in code so that you can deal with any unexpected situations that occur when a program is running. For example, dividing a number by zero or passing a string value to a variable that holds an integer value would result in an exception.

Can you inherit private members of a class?

No, you cannot inherit private members of a class because private members are accessible only to that class and not outside that class.

 Does .NET support multiple inheritance?

.NET does not support multiple inheritance directly because in .NET, a class cannot inherit from more than one class. .NET supports multiple inheritance through interfaces

What is a namespace?

Namespace is considered as a container that contains functionally related group of classes and other types.

Do events have return type?

No, events do not have return type.

A structure in C# can implement one or more interfaces. Is it true or false?

Yes, it is true. Like classes, in C#, structures can implement one or more interfaces.

Can users define their own exceptions in code?

Yes, customized exceptions can be defined in code by deriving from the System.Exception class.
comments powered by Disqus
User Profile
Mitu Sinha
Freelancer Software Consultant
Delhi , India
Email :You must Log In to access the contact details.
Latest Post from :mitu678
What is Extensible Output Caching improvement in ASP.NET 4.0?
View: 903 | Submitted on: 1/11/2013 6:18:27 AM
What is Razor View Engine
View: 1001 | Submitted on: 12/31/2012 6:10:02 AM
Which are the advantages of using MVC Framework
View: 895 | Submitted on: 12/31/2012 6:03:26 AM
What are ways to create input forms for workflow ?
View: 740 | Submitted on: 12/27/2012 1:54:33 AM
What are the types of input forms that can be created for a workflow
View: 640 | Submitted on: 12/27/2012 1:46:30 AM
Submit Articles | All Post of This User..

All rights reserved to dotnetcodes. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks.
Best viewed at 1024 x 768 resolution with Internet Explorer 5.0 or Mozila Firefox 3.5 or Google Crome and higher