300x250 AD TOP

helooo
Tagged under:

1. What is C#?
C# is a new object-oriented language from Microsoft that is currently used for application development on the .NET platform. It exhibits features found in languages such as C++, Java, Smalltalk, and Perl, among others.
C# has been submitted to the standards body.
C# can inter operate exceptionally well, with different languages in the .Net platform.
C# is fully object oriented programming language to develop dynamic web applications in .net  frame work.
C# is an object oriented and user friendly. It gives security and re usability.
We can develop multiple applications.
    

2
. What is the difference between abstract classes and interface?
Abstract classes
Interface
1.
Can contain declaration & also implementation
Class can contain only declaration
2.
A class may inherit only abstract class.
A class may inherit several interfaces.

3.
An abstract class provides complete, default code or just the details that have to be override.
An interface cannot provide any code just the signature.


4.What is a delegate?
Delegate is a class that can hold a reference to a method or a function. Delegate class has a signature 
and it can only reference those methods whose signature is compliant with the class. 
Delegates is a function pointer like in C.Which holds the references of the method. 
It has two type 

1.Single 

2. Multicast.
  

5.What is the difference between convert.to.string and .to. string() method?

Convert function handles nulls while i.string() does not it will throw a null reference exception error.


6.What is the difference between const and static readonly?
The difference is that static read-only can be modified by the containing class, but const can never be 

modified and must be initialized to a compile time constant. To expand on the static read-only case a 

bit, the containing class can only modify it:
- in the variable declaration (through a variable initializer)

- in the static constructor (instance constructors if it's not static).


7.What is an Indexer?
An indexer is a member that enables an object to be indexed in the same way as an array.


8.What is difference between constants, readonly and, static ?
Constants : The value can't be changed.
Read-only : The value will be initialized only once from the constructor of the class.
Static : Value can be initialized once.


9.What is a static constructor?
A constructor for a class, rather than instances of a class. The static constructor is called when the class is loaded.
Static constructor does not contain parameters. class contain only one static constructors.
Constructor has same name of class. if class name is ‘a’ than it should necessary the constructor name 
is also ‘a’'.


10.What is a Class?
A class describes all the attributes of objects as well as the methods that implements the behavior of 
member objects.
Class is collection of an object. It is a blueprint that describes the details(characteristics and 
behaviour)of an object for e.g 

Bird is a class
Kingfisher, Peacock, Sparrow are all birds. They all lay eggs,covered with feather, have ability to fly so 
they share common characteristics and features and belong to the class called bird.
Class is a collection object. Class is a collection of data member & member function. Class has no existance.
  

11.What are the different accessibility levels defined in .NET?
There are Five levels of Access Modifiers are :
Private
Protected
Friend
Protected Friend
Public
1.private 2.protected 3.internal 4.protected internal 5.public these access modifiers are used in c#.net 

friend access modifier is used in vb.net


12.Can I use exceptions in C#?
Yes, in fact exceptions are the recommended error-handling mechanism in C# (and in .NET in general). 

Most of the .NET framework classes use exceptions to signal errors.


13.Can we have shared events?
Yes, you can have shared events note only shared methods can raise shared events.


14.What are the namespaces used in C#.NET?
namespace is designed for providing a way to keep one set of names separate from another. The 
class names declared in one namespace will not conflict with the same class names declared in another.

using System; 
using System.Collections.Generic; 

using System.Linq; 

using System.Runtime.Serialization; 

using System.ServiceModel; 
using System.Text; 
using System.Web; 
using System.ServiceModel.Web; 
using System.Data.SqlClient;
using system.configuration;
using system.io;


15.What are the two data types available in C#?
Value type
Reference type


16.What is Array List?
Array List can hold item of different types. As array list can increase and decrease size dynamically you 
do not have to use the REDIM keyword. You can access any item in array using INDEX value of the array position.


17.How is method overriding different from overloading?

When overriding, you change the method behavior for a derived class. Overloading simply involves having a method with the same name within the class.


18.What is hash table?
Hash table provides way of accessing the index using a user identified KEY value, thus removing the INDEX problem.


19.What are the similarities between class and structures?
Both can have constructors, methods, properties, fields, constants, enumeration, events and event handlers.
Structures and classes can implement interface.
Both can have delegates and events.
Both of them can have constructors with and without parameter.

20.Does C# have copy constructors?
No. Objects in C# are always created by reference rather than by value, so a copy constructor is never 

implicitly called the way that it might be in C++.