Sunday, January 26, 2014

C# OOP(Object Oriented Programming) Concepts

Object Oriented Programming Concepts

The Key Concepts of Object Oriented Programming are :

  •  Abstraction
  •  Encapsulation
  •  Inheritance
  •  Polymorphism
Concept & Feature : 
  • Concept : Abstraction
    Feature : Natural mapping and association of data and programs or sub-programs   which operate on that data.
  • Concept : Encapsulation
    Feature : Hide or Unhide part of the data or Functionality from some components
  • Concept : Inheritance
    Feature : Extend the functionality for new requirements without disturbing the existing implementation.

==> Difference between Object oriented & Object Based Languages

Object oriented Languages : All programming languages that support abstraction, encapsulation, inheritance and polymorphism are known as Object-Oriented.

Object Based Languages : All programming Languages that support abstraction and encapsulation but do not support inheritance, therefore cannot support polymorphism are known as object based languages. VB and Ada are are Object-Based languages.

What is an Object ?
  • An object is an entity which has a well defined structure and behavior.
  • An Object Possesses certain Characteristics are:
    ==> State
    ==> Behavior
    ==> Identity
    ==> Responsibility
Abstraction :
  •  Abstraction is the Process of identifying the key aspects of an entity and ignoring the rest.
  • Only those aspects are selected that are important to the current problem scenario.
Encapsulation :
  • Encapsulation is a mechanism used to hide the data, internal structure, and implementation details of an object.
  • All interaction with the object is through a public interface of operations.
  • The user knows only about the interface, any changes to the implementation does not affect the user.
Inheritance :
  • The Process of acquiring the Properties of Base class (Parent Class) to the Sub Class (Child Class) is known as Inheritance.
  •  Inheritance is  " is - a " a kind of hierarchy.
Polymorphism : 
  • The ability of different types of related objects to respond to the same message in their own ways is called polymorphism. 
  • Polymorphism helps us to design extensible software, as new objects can be added to the design without rewriting existing procedures.
  • Polymorphism is the ability to take more than one form. This means that one command may invoke different implementation for different related objects.

Capgemini Interview questions and answers



Questions and Answers for Capgmini Technical Round


1 ) What is OOP (Object Oriented Programming) ?--> OOP is a Programming paradigm  that represents concepts as "Objects" that have data fields (attributes that describes the Object) and associated procedures known as methods.
Objects, usually instances of Classes are used to interact with one another to design applicationsand computer Programs.
Some of OOP Laguages are C++, Objective-C, Small talk, Java, C#, Perl, Python, Ruby and PHP. 
           

2 ) What is VIEW ?--> VIEW is a Virtual Table.
The View is the Parts of the application that handles the display of the data.
most often the views are created from the model data.

In SQL-->
A View contains Rows and Columns, just like a real table. The fields in a View are fields from one or more real tables in Database. We can add SQL functions WHERE and JOIN statements to a view and present the data as if the data were coming from one single table.

A VIEW always shows up to date data.
The database engine recreates the data, using the VIEW's  SQL Statements. Every time a user queries q VIEW.

3 ) What is Object and Class ?
--> Object is Instance of a class through which we can access the methods of that class. "New" Keyword is used for creating an Object.
Class is like a Blue print.

Object is a real world entity. Every object has state, behaviour an and identity. They are classified by their common state and behaviour by defining classes.

Class is compared to a template or mould, out of which similar kind of objects are created. object is an instance of a class.

Syntax :

<access specifier> class <class name>
{

           field declarations with respective access specifiers
           Event / Property / method declaration
}
    
4 ) Difference between RDBMS and DBMS ?--> 
DBMS manages large quantity of structured data with the advantages of query processing, controlling the access to data, data sharing and proper retrieval as well as modification of data.
RDBMS is a DBMS that 
stores the data in tables, a table is a collection of interrelated data entries and consists of columns and rows. Each of these tables has a unique identifier or "primary key". RDBMS also stores the relationship among the data in the form of tables.

Simply, In DBMS we can tables that can contain data. but, In RDBMS the tables have relationship.


5 ) What is PostBack ?--> PostBack is the name given to the process of submitting an ASP.NET page to the server for processing. PostBack is done if certain credentials of the page are to be checked against some sources (such as verification of username and password using database). This is something that a client machine is not able to accomplish and thus these details have to be 'posted back' to the server.
6 ) What is difference between Windows Application and Web 
Application ?
--> window 


7 ) What are the Class Access Modifiers ?
---> Public, Static and Void are the Class Access Modifiers.

8 ) What is an Assembly ?---> An assembly is a collection of types and resources that forms a logical unit of functionality.
 
When you compile an application, the MSIL code created is stored in an assembly 
Assemblies include both executable application files that you can run directly from Windows without the need for any other programs (these have a .exe file extension), and libraries (which have a .dll extension) for use by other applications.
 
There are two kind of assemblies in .NET :i) Private Assembly.
ii) Shared Assembly.

9 ) What is Serialization ?--> Serialization is the process of converting an object into a stream of Bytes.

When we want to transport an object through a network, then we have to convert the object into a stream of bytes. The process of converting an object into a stream of Bytes is called Serialization. For an object to be serialize, it should inherit ISerialize Interface. De-Serialization is the reverse process of creating an object from a stream of Bytes.

10) Difference between Clone() and Copy() ?--> Using clone() we can creates a new array object containing all the elements in the original array and using copy() method, all the elements of existing array copies into another existing array. Both methods perform Shallow copy.

11) What is Reflection ?--> Reflection is ability to examine the metadata in the assembly manifest at runtime.

reflection is technique provided for developers to examine the metadata at runtime. The ability to 
examine the metadata in the assembly manifest at runtime is known as reflection. It is used to dynamically create an instance of a type, bind the type to an existing object, or get the type from an existing object and invoke its methods or access its fields and properties.
  


12) Write a simple Program for Object()
--> syntax for object

class Date             // this is class program
{

       public int day;
       public int month;
       public int year;
     
       public void PrintDate()       // this is method
       {
            Console.WriteLine("Date is :"+ day + " " + month + " " + year);
       }

}
class program
{
      static void main (string[] args)
      {
           Date d1 = new Date();              // object intialization
           d1.day = 26;
           d1.month = 1;
           d1.year = 2014;
           d1.PrintDate();
        }
}

Capgemini Interview Questions for .NET Candidates

WRITTEN TEST 
It contains Total 3 sections 50 questions 60 minutes.
1) Aptitude
2) Analytic
3) Verbal 


TECHNICAL ROUND 
1 ) What is OOP (Object Oriented Programming) ?
2 ) What is VIEW ?
3 ) What is Object and Class ?
4 ) Diffence between RDBMS and DBMS ?
5 ) What is Postback ?
6 ) What is difference between Window Page and Web Page ?
7 ) What are the Class Access Modifiers ?
8 ) What is an Assembly ?
9 ) What is Serialization ?
10) Difference between Clone() and Copy() ?
11) What is Reflection ?
12) Write a simple Program for Object(), and Polymorphism ...

TELEPHONIC INTERVIEW