Friday, March 11, 2016

Dot Net interview question and answer for fresher



What is an application server?
An application server is a software engine that delivers applications to client computers. The name of the application server is IIS, IBM, Red Hat etc.

What is inheritance?
Inheritance is one of the fundamental object oriented programming language concept that allow the creation of hierarchical classifications.in C# programming the, a class that is inherited is called base class. In simple words the child class inherit variables, methods, properties and indexers of the parent class by using the “:” character. The main advantage inheritance is to re-usability of code.

How do you prevent a class from being inherited?
By making the class sealed

Can you use multiple inheritance in .NET?
We cannot use multiple inheritance in .NET directly it can be use by the interface

What is an Interface?
Interface is like a class but has no implementation it contains only declaration methods, properties and indexer .It is declared by the interface keywords in place of class.

What is abstract class in c#?
An abstract class is an incomplete class that cannot be instantiated, it only allow other class to inherit from it.an abstract method must be implemented in child class by using the override keyword.

What is structure in c#?
In C sharp Structure are the light weight classes and also value type, it contains fields, methods, constants, constructor, indexer.

Polymorphism in c # with example
Ability to take more than one form is called polymorphism. The polymorphism consist two words poly and morphism poly means “multiple” and morphism means “form”.

What is constructor in C#?
Constructor is special kinds of method which is automatically call when we create the instance or object of the class. It is also responsible for the object initialization and memory allocation of class.
Constructor name and class name should be same.
Constructor don’t return any value
We cannot inherited to the constructor
Constructor always public
Types of constructor
The types of Constructor are given below:
1. Default constructor
2. Parameterized constructor
3. Private constructor
4. Copy constructor
5. Static constructor

What is generic in C#?
Generic can be defined as <T> sign after the class name, by using the generic there is no need of boxing and unboxing. Generic also can be implemented with interfaces, delegates and methods.

What is Boxing/Unboxing?
Conversion of value type to reference type is called boxing and reference type to value type is called unboxing.

What is delegate?
Delegate is a user defined data type. It is used to store the reference of method.

What is Enum?
An Enum is a user defined value data type and also a group of related constant.

What is partial class?
Partial class is the class by which the class code is divided into two .cs file.

Why we use Generic?
By using the generic there is no need of boxing and unboxing.

What is the element of MSIL?
MSIT contains manifest, Meta data, assemble code

What is root name space?
System

What is super most class?
Object

You can create two default constructors
Yes, Static and Non Static

Does static constructor may be copy constructor
No

May the static constructor parameterized.
No Only Default.

What is CLS?
CLS is stand for common language specification, all the common set of rules which is necessary to follow to all the language is called CLS.

What of CTS?
CTS is stand for common type system the work of the CTS is to convert all language data type into the common data type.

What is business logic?
It is the functionality which handles the exchange of information between database and a user interface.

What is control?
A control is a component that provides UI (user interface) capabilities.

What is component?
Component is a group of related classes and methods.

What is globalization and localization?
Globalization is the process that the application support multiple culture and region, localization support a given culture and region.
What is overloading and overriding
Overloading means the class contains two or more methods with name and different signature, in overriding method name should be same and also same signature.

What is business logic?
Business logic is the functionality that handles the exchange of information between data base and user interface.

What is global assemble cache (GAC)?
GAC allows .Net applications to share libraries.GAC solve the problem of DLL Hell.

What is logging?
 Logging is the process of represent the information about the status of an application.
 
What is assembly?
Assembly is the primary unit of deployment of managed code it can be either DLL or .exe.

What is private assembly?
Private assemble is used by the single application.

What is shared assembly?
A shared assembly is used by the one or more application on a machine.

What is digital signature?
Digital signature is an electronic signature which is used to verify the identity of the person who is sending the message.

What is garbage collection?
Garbage collection is the process of remove the object which is not used for the longer time.


What is location of global assemble cache (GAC) on the system
C:\windows\assembly

What is difference between .tostring(), convert. Tostring()?
Difference both of them is that “convert” function handles Nulls while .tostrong() does not handle Null reference exception error.

What is collation?
Collation refers to set of rules that determine how the data is stored and compared

What is the difference between authorization and authentication?
Authorization is the process of allow or deny the resources to the particular user while the authentication is the process of identifying the credentials of user like username, password etc.
 





Wednesday, March 2, 2016

What is the difference between abstract class and interface in c#?

Abstract class


  • Abstract class not not support multiple inheritance
  • It contains constructor
  • An abstract class contains access modifier
  • Fast execution to find the actual method in the class
  • in abstract class fields and constraints have defined
  • An abstract class provides the complete code 
  •  Member of the abstract class can be static  
 Interface 


  • Interface support multiple inheritance
  • It does not contain constructor
  • an interface not not have any access modifier
  • Take more time to find the actual method in the class
  • fields can not be defined in the interface
  • An interface can not provide any code rather then the signature
  • member of the static class can not be static

Monday, February 29, 2016

What is abstract class in c#?



An abstract class is an incomplete class that cannot be instantiated, it only allow other class to inherit from it.an abstract method must be implemented in child class by using the override keyword.

Features of abstract class: 

Abstract class have constant and fields
It can be implement a property
It can have constructor and destructors
It cannot support multiple inheritance
The example of the abstract class is given below:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication7
{
    public abstract class Class1
    {
        protected string s;
        public abstract void show();
    }
    public class class2 : Class1
    {
        public override void show()
        {
            s = "Dot Net Darpan";
            MessageBox.Show(s);
         
        }
    }
}


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication7
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            class2 obj = new class2();
            obj.show();
        }
    }
}
 
Output:  

 

Friday, February 26, 2016

What is inheritance in C#?



Inheritance is one of the fundamental object oriented programming language concept that allow the creation of hierarchical classifications.in C# programming the, a class that is inherited is called base class. In simple words the child class inherit variables, methods, properties and indexers of the parent class by using the “:” character. The main advantage inheritance is to re-usability of code.

The example of the inheritance is given below:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace inheritance
{
    public class Class1
    {
        public void xyz()
        {
            MessageBox.Show("Hello");
        }
    }

    public class pqr : Class1
    {
        public void xyz1()
        {
            MessageBox.Show("Hi");
        }
    }
}

 
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace inheritance
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            pqr obj = new pqr();
            obj.xyz();
            obj.xyz1();
        }
    }
}
 

output: Hello
Hi