0% found this document useful (0 votes)
8 views3 pages

Oops Interview

Oops frequently asked questions in any interview.

Uploaded by

Faiz Syed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

Oops Interview

Oops frequently asked questions in any interview.

Uploaded by

Faiz Syed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

!. What is oops concept.

OOP stands for Object-Oriented Programming.


OOps is a programming that is used defining objects.
Four key concepts of OOPs are abstraction, encapsulation, inheritance, and
polymorphism.

Encapsulation-
Encapsulation is the concept of wrapping data into a single unit. It collects data
members and member functions into a single unit called class.
By using the encapsulation program, we can hide the members of one class from
another class.

Abstraction-
It is one of the major principle of oops.
It allows the programmer to display only the necessary data while hiding the others
from the user.

Polymorphism
Polymorphism means one name, many forms. One function behaves in different forms.
In other words, "Many forms of a single object is called Polymorphism."

There are two types of polymorphism:


Compile Time Polymorphism / Static Polymorphism.
Run-Time Polymorphism / Dynamic Polymorphism.

Method Overloading
Method Overloading is a type of polymorphism. It has several names like “Compile
Time Polymorphism” or “Static Polymorphism,” and sometimes it is called “Early
Binding”.
Method Overloading means creating multiple methods in a class with the same names
but different Parameters.

Method Overriding is a type of polymorphism. It has several names like “Run Time
Polymorphism” or “Dynamic Polymorphism,” and sometimes it is called “Late Binding”.
Method Overriding means having two methods with the same name and same
[parameters]; one should be in the base class, and another method should be in a
derived class [child class]

Inheritance.
Inheritance, in C#, is the ability to create a class that inherits attributes and
behaviors from an existing class. The newly created class is the derived (or child)
class and the existing class is the base (or parent) class. Inheritance is one of
the key features of object-oriented programming.

Abstract class: is a restricted class that cannot be used to create objects .To
access it, it must be inherited from another class.

Abstract method: it can only be used in an abstract class, and it does not have a
body. The body is provided by the derived class (inherited from).

Interface:Interface is a blueprint of a class. It is like abstract class because


all the methods which are declared inside the interface are abstract methods.It is
used to achieve multiple inheritance which can't be achieved by class.

Need for oops.


OOP is faster and easier to execute
OOP provides a clear structure for the programs
OOP helps to keep the C# code DRY "Don't Repeat Yourself", and makes the code
easier to maintain, modify and debug
OOP makes it possible to create full reusable applications with less code and
shorter development time.

What Is namespace C#?


Namespaces are used in C# to organize codes. They can be considered as a container
which consists of other namespaces, classes, etc.

Constructors
A constructor is a special method that is used to initialize objects. The advantage
of a constructor, is that it is called when an object of a class is created. It can
be used to set initial values for fields.

What is Access modifiers.


Access modifiers define the accescibility of the class and its members.
public - The code is accessible for all classes

private - The code is only accessible within the same class

protected -The code is accessible within the same class, or in a class that is
inherited from that class.

internal- The code is only accessible within its own assembly, but not from another
assembly.

What is string and string builder?


String
String is immutable, Immutable means if you create string object then you cannot
modify it and It always create new object of string type in memory.

Stringbuilder
StringBuilder is mutable, means if create string builder object then you can
perform any operation like insert, replace or append without creating new instance
for every time.it will update string at one place in memory doesnt create new space
in memory.

Session:

Think of a session as a temporary storage area that is unique to each user during
their visit to a website.
When a user visits a website, a session is created for that user. It can store
information that is specific to that user's interaction with the site.
The session data is stored on the web server, not on the user's computer.
It is typically used for storing things like user login information, shopping cart
contents, and other user-specific data.

Cookie:

A cookie is a small piece of data that is stored on the user's computer.


Cookies are sent back and forth between the user's browser and the web server with
each request and response.
They are often used to store small pieces of information, such as user preferences
or tracking information, like remembering a user's language preference or login
status.
Unlike sessions, cookies are stored on the user's computer, which means they
persist even after the user leaves the website and returns later.

You might also like