Monday, August 10, 2009

Some reading before Interview

What are the OOPS concepts?

1) Encapsulation: It is the mechanism that binds together code and
data in manipulates, and keeps both safe from outside interference and
misuse. In short it isolates a particular code and data from all other
codes and data. A well-defined interface controls the access to that
particular code and data.

2) Inheritance: It is the process by which one object acquires the
properties of another object. This supports the hierarchical
classification. Without the use of hierarchies, each object would need
to define all its characteristics explicitly. However, by use of
inheritance, an object need only define those qualities that make it
unique within its class. It can inherit its general attributes from
its parent. A new sub-class inherits all of the attributes of all of
its ancestors.

3) Polymorphism: It is a feature that allows one interface to be used
for general class of actions. The specific action is determined by the
exact nature of the situation. In general polymorphism means "one
interface, multiple methods", This means that it is possible to design
a generic interface to a group of related activities. This helps
reduce complexity by allowing the same interface to be used to specify
a general class of action. It is the compiler's job to select the
specific action (that is, method) as it applies to each situation.

What is the difference between a Struct and a Class?

The struct type is suitable for representing lightweight objects such
as Point, Rectangle, and Color. Although it is possible to represent a
point as a class, a struct is more efficient in some scenarios. For
example, if you declare an array of 1000 Point objects, you will
allocate additional memory for referencing each object. In this case,
the struct is less expensive.
When you create a struct object using the new operator, it gets
created and the appropriate constructor is called. Unlike classes,
structs can be instantiated without using the new operator. If you do
not use new, the fields will remain unassigned and the object cannot
be used until all of the fields are initialized.
It is an error to declare a default (parameterless) constructor for a
struct. A default constructor is always provided to initialize the
struct members to their default values.
It is an error to initialize an instance field in a struct.
There is no inheritance for structs as there is for classes. A struct
cannot inherit from another struct or class, and it cannot be the base
of a class. Structs, however, inherit from the base class Object. A
struct can implement interfaces, and it does that exactly as classes
do.
A struct is a value type, while a class is a reference type.

Value type & reference types difference? Example from .NET. Integer
& struct are value types or reference types in .NET?

Most programming languages provide built-in data types, such as
integers and floating-point numbers, that are copied when they are
passed as arguments (that is, they are passed by value). In the .NET
Framework, these are called value types. The runtime supports two
kinds of value types:
Built-in value types
The .NET Framework defines built-in value types, such as System.Int32
and System.Boolean, which correspond and are identical to primitive
data types used by programming languages.
User-defined value types
Your language will provide ways to define your own value types, which
derive from System.ValueType. If you want to define a type
representing a value that is small, such as a complex number (using
two floating-point numbers), you might choose to define it as a value
type because you can pass the value type efficiently by value. If the
type you are defining would be more efficiently passed by reference,
you should define it as a class instead.
Variables of reference types, referred to as objects, store references
to the actual data. This following are the reference types:
class
interface
delegate
This following are the built-in reference types:
object
string


What is Method Overriding? How to override a function in C#?

Use the override modifier to modify a method, a property, an indexer,
or an event. An override method provides a new implementation of a
member inherited from a base class. The method overridden by an
override declaration is known as the overridden base method. The
overridden base method must have the same signature as the override
method.
You cannot override a non-virtual or static method. The overridden
base method must be virtual, abstract, or override.

Can we call a base class method without creating instance?

Its possible If its a static method.
Its possible by inheriting from that class also.
Its possible from derived classes using base keyword.


In which cases you use override and new base?

Use the new modifier to explicitly hide a member inherited from a base
class. To hide an inherited member, declare it in the derived class
using the same name, and modify it with the new modifier.


What are Sealed Classes in C#?

The sealed modifier is used to prevent derivation from a class. A
compile-time error occurs if a sealed class is specified as the base
class of another class. (A sealed class cannot also be an abstract
class)

UDDI
(Universal Description, Discovery and Integration)

WSDL
(Web Services Discription Language)

Web Service (Definition)

- The W3C defines a Web service[1] as a software system designed to support interoperable machine-to-machine interaction over a network.

- A Web Service is a software component that is described via WSDL and is capable of being accessed via standard network protocols such as but not limited to SOAP over HTTP.

SOAP (Definition)

- SOAP is a standard for exchanging XML-based messages over a computer network, normally using HTTP. SOAP forms the foundation layer of the web services stack, providing a basic messaging framework that more abstract layers can build on.

.Net code Compilation and Execution

* Source code is converted to Microsoft Intermediate Language and an assembly is created.
* Upon execution of a .NET assembly, its MSIL is passed through the Common Language Runtime's JIT compiler to generate native code. (NGEN compilation eliminates this step at run time.)
* The native code is executed by the computer's processor.

What is XML ?

- XML (Extensible Markup Language) is a W3C initiative that allows information and services to be encoded with meaningful structure and semantics that computers and humans can understand. XML is great for information exchange, and can easily be extended to include user-specified and industry-specified tags.
- XML is a markup language for documents containing structured information.

What is UML ?

UML is a general-purpose modeling language that includes a standardized graphical notation used to create an abstract model of a system.

No comments:

Post a Comment