blogspot visit counter

Thursday 4 April 2013

c# .net interview question answers

c# .net interview question answers
What is C#?

C# is an object oriented, type safe and managed language that is compiled by .Net framework to generate Microsoft Intermediate Language.  
  • 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.

What is the difference between abstract classes and interface?

Abstract class can have concrete methods while interfaces have no methods implemented.
Interfaces do not come in inheriting chain, while abstract classes come inheritance.

 What are the types of comment in C# with examples?
Single line
Eg:
   //This is a Single line comment
ii. Multiple line (/* */)
Eg: /* my name is chitranjan*/

What is the difference between public, static and void?
All these are access modifiers in C#.
Public:- Public declared variables or methods are accessible anywhere in the application.
Static:-  Static declared variables or methods are globally accessible without creating an instance of the class. The compiler stores the address of the method as the entry point and uses this information to begin execution before any objects are created.
Void:- Void is a type modifier that states that the method or variable does not return any value.

What are the namespaces used in C#.NET?
    Namespace is a logical grouping of class.
  • using System;
  • using System.Collections.Generic;
  • using System.Windows.Forms;

What is an object?
An object is an instance of a class through which we access the methods of that class. “New” keyword is used to create an object. A class that creates an object in memory will contain the information about the methods, variables and behavior of that class.

What are the characteristics of C#?
    There are several characteristics of C# are :
  • Simple
  • Type safe
  • Flexible
  • Object oriented
  • Compatible
  • Consistent
  • Interoperable
  • Modern
What are the basic concepts of object oriented programming?
    It is necessary to understand some of the concepts used extensively in object oriented programming.These include
  • Objects
  • Classes
  • Data abstraction and encapsulation
  • Inheritance
  • Polymorphism
  • Dynamic Binding
  • Message passing.

What is an object? 
An object is an instance of a class through which we access the methods of that class. “New” keyword is used to create an object. A class that creates an object in memory will contain the information about the methods, variables and behavior of that class.

What is the difference between Object and Instance?
An instance of a user-defined type is called an object. We can instantiate many objects from one class.
An object is an instance of a class.

Define Constructors?  
A constructor is a member function in a class that has the same name as its class. The constructor is automatically invoked whenever an object class is created. It constructs the values of data members while initializing the class.
 

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...