Search blogs  
Browse by category
RAMESH NAIDU - dotnet developer
Ramesh Babu Akula
Author:Ramesh Babu Akula
Software engineer
DOTNET5
Thursday 31st, July 2008

What is the need of abstraction? What is abstraction? What is the abstraction for stack?

Abstraction is nothing but binding the code and data

Together to protect the code and data from out side world.

I have two textboxes one for user name and another for password. I have a table name compare (which contains name, password etc.,) my doubt is how compare username textbox with name column and how compare password textbox with password column. I want the code

U will compare the 2 textboxes values i.e. username &Password with the database values by writing the following code: cn.Open (); SqlCommand cmd = new SqlCommand ("select count (*)From compare where username='" + TextBox1.Text + "'andpassword='" + TextBox2.Text + "'", cn); int count = (int)cmd.ExecuteScalar(); cn.Close (); If (count! = 0) { Page.RegisterStartupScript ("pr","alert ('welcome to MS.Net') "); } Else { Page.RegisterStartupScript ("an","alert ('sorry') "); } What are the attributes of Dataset?Dataset Data Table Data Columns Data row DataPrimaryKey DataForgeinKey Data Relationship What is Dataset?A Dataset is a cache of records retrieved from a data source. It works like a virtual data store: A dataset includes one or more tables based on the tables in the actual database, and it can include information about the relationships between those tables and constraints on what data the tables can contain. What are fundamental parts of the Dataset?The fundamental parts of a dataset are exposed to you through standard programming constructs such as properties and collections. For example:

The Dataset class includes the Tables collection of data tables and the Relations collection of Data Relation objects.
What is use of Data Adapter Class? Data Adapter Class represents a set of SQL commands and a database connection that are used to fill the Dataset and update the data source. The Data Adapter serves as a bridge between a Dataset and a data source for retrieving and saving data. You can use a data adapter to perform the following operations: Retrieve rows from a data store into corresponding data tables within the dataset. To retrieve rows into a dataset, use the Fill method on a data adapter object (SqlDataAdapter, OleDbDataAdapter, OdbcDataAdapter, or OracleDataAdapter). When you invoke the Fill method, it transmits an SQL SELECT statement to the data store. Transmit changes made to a dataset table to the corresponding data store. To transmit a dataset table of the dataset to the data store, use the adapter's Update method. When you invoke the method, it executes whatever SQL INSERT, UPDATE or DELETE statements are needed, depending on whether the affected record is new, changed, or deleted.

Which Data adapters are available for use with different Databases in ADO.NET?

ADO.NET makes these data adapters available for use with databases:

The OleDbDataAdapter object is suitable for use with any data source exposed by an OLE DB provider. The SqlDataAdapter object is specific to SQL Server. Because it does not have to go through an OLE DB layer, it is faster than the OleDbDataAdapter. However, it can only be used with SQL Server 7.0 or later. The OdbcDataAdapter object is optimized for accessing ODBC data sources. The OracleDataAdapter object is optimized for accessing Oracle databases.

Object Oriented Programming (OOPS) Interview Questions

Please tell me the oops concept with detailed answer

Oops is an acronym for object oriented programming language Or object oriented paradigm Building blocks of oops are 1) Data Encapsulation:Hiding non essential things from an user 2) AbstractionImplementation of data encapsulation 3) InheritanceReusability of code 4) PolymorphismThe ability of a function that can act on different data Types in different ways Give some examples of pure object oriented languages.Eiffel, Java, Simula, Smalltalk are some pure object oriented languages. What are the sections in class specification?
There are basically two sections in class specification: Class declaration and class function definition. Write the syntax for class declaration.
Syntax:
class
{
private:
variables;
functions;
public:
variables;
functions;
};
What are class members?
The variables and functions used in a class are called class members. Write the syntax for defining member functions inside the class. Syntax:
class
{
private:
variables;
public:
variables:
return type
{
statements;
}
};
Write the syntax for defining member functions outside the class.Syntax:
return type: (arguments)
{
body;
}

What is Polymorphism in OOPS Languages?

The feature of exhibiting many forms is called polymorphism.
In object-oriented programming, polymorphism is a generic term that means 'many shapes'. (From the Greek meaning "having multiple forms"). Polymorphism is briefly described as "one interface, many implementations." polymorphism is a characteristic of being able to assign a different meaning or usage to something in different contexts - specifically, to allow an entity such as a variable, a function, or an object to have more than one form.

There are two types of polymorphism one is compile time polymorphism and the other is run time polymorphism. Compile time polymorphism is functions and operators overloading. Runtime time polymorphism is done using inheritance and virtual functions. Here are some ways how we implement polymorphism in Object Oriented programming languages

Interface and abstract methods
Like in C# or JAVA different classes implement a common interface in different ways; is an example of Runtime polymorphism. The interface defines the abstract member functions (no implementation). In class that implement the interface; we define body of those abstract members according to the requirement. Means single definition in interface but multiple implementations in child classes.

Virtual member functions
using virtual member functions in an inheritance hierarchy allows run-time selection of the appropriate member function. A virtual function is a member function of the base class and which is redefined by the derived class. Such functions can have different implementations that are invoked by a run-time determination of the subtype (virtual method invocation, dynamic binding).

What is Virtual function in class?

A virtual function is a member function of the base class and which is redefined by the derived class. When a derived class inherits the class containing the virtual function, it has ability to redefine the virtual functions.

A virtual function has a different functionality in the derived class according to the requirement. The virtual function within the base class provides the form of the interface to the function. Virtual function implements the philosophy of one interface and multiple methods (polymorphism).

The virtual functions are resolved at the run time. This is called dynamic binding. The functions which are not virtual are resolved at compile time which is called static binding. A virtual function is created using the keyword virtual which precedes the name of the function.

Limitations and Restrictions of Interface

The essential idea to remember is that an interface never contains any implementation. The following restrictions and imitations are natural consequences of this:

You're not allowed any fields in an interface, not even static ones. A field is an implementation of an object attribute.

You're not allowed any constructors in an interface. A constructor contains the statements used to initialize the fields in an object, and an interface does not contain any fields!

You're not allowed a destructor in an interface. A destructor contains the statements used to destroy an object instance.

You cannot supply an access modifier. All methods in an interface are implicitly public.

You cannot nest any types (enums, struts, classes, interfaces, or delegates) inside an interface

What is an Object?

An objec t is an insta nce of a class. It can be uniquely identified by its name and it defines a state which is represented by the values of its attributes at a particular time.

An object can be considered a "thing" that can perform a set of activities. The set of activities that the objec t performs defines the object's behavior.

The state of the objec t changes according to the methods which are applied to it. We refer to these possible sequences of state changes as the behavior of the object. So the behavior of an object is defined by the set of methods which can be applied on it.

What is Inheritance?

Inheritance is the mechanism which allows a class A to inherit properties of a class B. We say "A inherits from B''. Objects of class A thus have access to attributes and methods of class B without the need to redefine them.

If class A inherits from class B, then B is called super class of A. A is called subclass of B. Objects of a subclass can be used where objects of the corresponding super class are expected. This is due to the fact that objects of the subclass share the same behavior as objects of the super class.

However, subclasses are not limited to the state and behaviors provided to them by their super class. Subclasses can add variables and methods to the ones they inherit from the super class.

In the literature you may also find other terms for "super class" and "subclass". Super classes are also called parent classes or base classes. Subclasses may also be called child classes or just derived classes.


Inheritance Example

Like a car, truck or motorcycles have certain common characteristics- they all have wheels, engines and brakes. Hence they all could be represented by a common class Vehicle which encompasses all those attributes and methods that are common to all types of vehicles.

However they each have their own unique attributes; car has 4 wheels and is smaller is size to a truck; whereas a motorcycle has 2 wheels. Thus we see a parent-child type of relationship here where the Car, Truck or Motorcycle can inherit certain Characteristics from the parent Vehicle; at the same time having their own unique attributes. This forms the basis of inheritance; Vehicle is the Parent, Super or the Base class. Car, Truck and Motorcycle become the Child, Sub or the Derived class.

What is an Interface?

An Interface is a reference type and it contains only abstract members. Interface's members can be Events, Methods, Properties and Indexers. But the interface contains only declaration for its members. Any implementation must be placed in class that realizes them. The interface can't contain cons tants, data fields, constructors, destructors and static members. All the member declarations inside interface are implicitly public.

What is Difference between abstract class and interface?

An Interface cannot implement methods.

An abstract class can implement methods.

An Interface can only inherit from another Interface.

An abstract class can inherit from a class and one or more interfaces.

An Interface cannot contain fields.

An abstract class can contain fields.

An Interface can contain property definitions.

An abstract class can implement a property.

An Interface cannot contain constructors or destructors.

An abstract class can contain constructors or destructors.

An Interface can be inherited from by structures.

An abstract class cannot be inherited from by structures.

An Interface can support multiple inheritance.

An abstract class cannot support multiple inheritance

What is a Static Class?

We can declare a static class. We use static class when there is no data or behavior in the class that depends on object identity. A static class can have only static members. We can not create instances of a static class using the new keyword. .NET Framework common language runtime (CLR) loads Static classes automatically when the program or namespace containing the class is loaded.

Here are some more features of static class:

Static classes only contain static members. Static classes can not be instantiated. They cannot contain Instance Constructors Static classes are sealed.

What is Static member of class?

A static member belongs to the class rather than to the instances of the class. In C# data fields, member functions, properties and events can be declared static. When any instances of the class are created, they cannot be used to access the static member.

To access a static class member, use the name of the class instead of an instance variable

Static methods and Static properties can only access static fields and static events.

Like: int i = Car.GetWheels;

Here Car is class name and Get Wheels is static property.

Static members are often used to represent data or calculations that do not change in response to object state.

What is a field?

Field is a Data Member of a class. Fields can be Value Type members, like Integer or Dates, or can be aggregate types, like structures or classes.

What is difference between value Parameter and reference parameter?

A value parameter is used for "in" parameter passing, in which the value of an argument is passed into a method, and modifications of the parameter do not impact the original argument. A value parameter refers to its own variable, one that is distinct from the corresponding argument. This variable is initialized by copying the value of the corresponding argument.

A reference parameter is used for "by reference" parameter passing, in which the parameter acts as an alias for a caller-provided argument. A reference parameter does not itself define a variable, but rather refers to the variable of the corresponding argument. Modifications of a reference parameter impact the corresponding argument.

What is a Property?

A Property is a special member constructor that is used like a field, but acts like a method. Properties are special kind of methods that generally are used to provide constrained access to Field.

What are Read-Only, Write Only and Shared Properties?

Read only property is a property that can be used as an r- value only. That’s why a property statement that includes a read only modifier will generate a getter block only and users can evaluate this property but can not modify it.

1. public string Strings {

2.

3.

4.

5. get { return FStrings(index); }

6. }

What are Constructor and Destructor?

A constructor is called to initialize a class. A destructor is called to finalize the class. Visual Basic.NET implements the constructor as Sub New and Destructor as protected method Sub Finalize ().

What are My Base and My Class?

My Base allows you to invoke methods in your class’s Base Class that may be overloaded in your class, resolving any name ambiguity.

My Class is roughly equivalent to the me reference to self.

What is Method Overloading?

A: Method Overloading means to have two or more methods in the same class with different signature. The benefit of method overloading is that it allows you to implement methods that support the same semantic operation but differ by argument number or type.

1. public void GetCustomer(string strCustomerName)

2. {

3.

4. }

5. public void GetCustomer(int iCustomerID)

6. {

7.

8. }

What is Method Overriding?

Method Overriding changing the behavior of a method in a base class. Use keyword Overrides.

What are Overridable, Must override and NotOverridable modifiers?

Overridable – modifier indicates that a method can be overridden.

NotOverridable- modifier indicates that you can not override a method.

Must Override- modifier indicate that a method is abstract, and child class must implement the Must Override method in a parent class?

What Shadows modifier?

Shadows – if you want a child class to use a name previously used in a parent class, use the Shadows keyword to do so. Shadows keyword simply allows yo

 
Post your valuable comment here
Email:      Password:  
Don't have SiliconIndia ID? Sign up      Forgot your Password?  Retrieve

 Latest postings

C# Modifiers
Modifiers    C#:1)Static :1)Use the static modifier to declare a static member, which belongs to the type itself rather than to a speci... more >>
SQLSERVER FAQS
SQLSERVER 2005 Interview Questions If I want to see what fields a table is made of, and what the sizes of thefields... more >>
SAMPLE .NET APPLICATION IN 3 TIER
using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System... more >>
Asp.net Authentication and Authorization
Authentication and AuthorizationAuthentication and Authorization are two interrelated security concepts. In short, authentication is a process of iden... more >>
asp.net
ASP.NET State Management Web form pages are HTTP-Based, they are stateless, which means they don’t know whether the requests are all from the same... more >>
More postings 1  2  3    next >>

Career

GROOMING for men and women
Grooming means dressing well, to be presentable to others. You ma... more >>
By
ravi kanth
BOSS is never happy !!!
BOSS is never happy !!!! This is dedicated to all bosses who are ... more >>
By
Nitin Gupta
Are you doing what you like?
It's definitely worth thinking about! So many of us end up choo... more >>
By
Diana Menezes
STAR
Aries (March 21-April 19)Arians are trendsetters in fashi... more >>
By
Hariharan Janardhanan
The Five Myths of Leadership
Mike Griffiths, Project Manager, Quadrus Developmen, December... more >>
By
Sundaram, S

Guest contributors

Vineet Nayar
Vineet Nayar
CEO, HCL Technologies
Rajendra K Misra
Rajendra K Misra
Author is the founder of Change India
Narayana Murthy
Narayana Murthy
Chairman & Chief Mentor, Infosys Technologies.
Sridhar Jayanthi
Sridhar Jayanthi
Vice President of Engineering and Head of India Operations, McAfee
Vikram Shah
Vikram Shah
President - India Operations, NetApp.
 Our sponsors