Prov International .Net Fresher Interview questions with Answers – PART 2

Hi, in this post we are going to continue discussing Prov International .Net Fresher Interview questions with Answers [Also see Prov International .Net Fresher Interview questions with Answers – PART 1]. Let us explore them briefly;

Prov International .Net Fresher Interview questions with Answers – PART 2

8.What is inheritance?

=>Inheritance allows us to define a class in terms of another class, which makes it easier to create and maintain an application.
=>This also provides an opportunity to reuse the code functionality and speeds up implementation time.
=>The idea of inheritance implements the IS-A relationship.
SYNTAX:
<acess-specifier> class <base_class> {

}
class <derived_class> : <base_class> {

}
SAMPLE CODE:
using System;
namespace InheritanceApplication {
class Shape {
public void setWidth(int w) {
width = w;
}
public void setHeight(int h) {
height = h;
}
protected int width;
protected int height;
}
// Derived class
class Rectangle: Shape {
public int getArea() {
return (width * height);
}
}
class RectangleTester {
static void Main(string[] args) {
Rectangle Rect = new Rectangle();
Rect.setWidth(5);
Rect.setHeight(7);
// Print the area of the object.
Console.WriteLine(“Total area: {0}”, Rect.getArea());
Console.ReadKey();
}
}
}
SAMPLE OUTPUT:
Total area: 35

9.Discuss the Data types in .Net?

=>Data types refer to an extensive system used for declaring variables or functions of different types. The type of a variable determines how much space it occupies in storage.
=>.Net provides a wide range of data types which are as follows:

        Data Type         Storage Allocation                           Value Range
Boolean Depends on implementing platform True or False
Byte 1 byte 0 through 255 (unsigned)
Char 2 bytes 0 through 65535 (unsigned)
Date 8 bytes 0:00:00 (midnight) on January 1, 0001 through 11:59:59 PM on December 31, 9999
Decimal 16 bytes 0 through +/-79,228,162,514,264,337,593,543,950,335 (+/-7.9…E+28) with no decimal point; 0 through +/-7.9228162514264337593543950335 with 28 places to the right of the decimal
Double 8 bytes -1.79769313486231570E+308 through -4.94065645841246544E-324, for negative values4.94065645841246544E-324 through 1.79769313486231570E+308, for positive values
Integer 4 bytes -2,147,483,648 through 2,147,483,647 (signed)
Long 8 bytes -9,223,372,036,854,775,808 through 9,223,372,036,854,775,807(signed)
Object 4 bytes on 32-bit platform8 bytes on 64-bit platform Any type can be stored in a variable of type Object
SByte 1 byte -128 through 127 (signed)
Short 2 bytes -32,768 through 32,767 (signed)
Single 4 bytes -3.4028235E+38 through -1.401298E-45 for negative values;1.401298E-45 through 3.4028235E+38 for positive values
String Depends on implementing platform 0 to approximately 2 billion Unicode characters
UInteger 4 bytes 0 through 4,294,967,295 (unsigned)
ULong 8 bytes 0 through 18,446,744,073,709,551,615 (unsigned)
User-Defined Depends on implementing platform Each member of the structure has a range determined by its data type and independent of the ranges of the other members
UShort 2 bytes 0 through 65,535 (unsigned)

10.What are the inheritance Types in .Net?

The following are the types of inheritance in .Net;
1.Single inheritance:
=>It is the type of inheritance in which there is one base class and one derived class.
2.Hierarchical inheritance:
=>This is the type of inheritance in which there are multiple classes derived from one base class.
=>This type of inheritance is used when there is a requirement of one class feature that is needed in multiple classes.
3.Multilevel inheritance:
=>When one class is derived from another derived class then this type of inheritance is called multilevel inheritance.
4.Hybrid inheritance:
=>This is combination of more than one inheritance.
=>Hence, it may be a combination of Multilevel and Multiple inheritance or Hierarchical and Multilevel inheritance or Hierarchical and Multipath inheritance or Hierarchical, Multilevel and Multiple inheritance.
5.Multipath inheritance:
=>In this inheritance, a derived class is created from another derived classes and the same base class of another derived classes.
6.Multiple inheritance:
=>In this inheritance, a derived class is created from more than one base class.

11.What is ASP?

=>The full form for ASP is Active Server Pages (ASP) technology.
=>ASP.NET is an open-source server-side web application framework designed for web development to produce dynamic web pages.
=>It was developed by Microsoft to allow programmers to build dynamic web sites, web applications and web services.
=>There are various page extensions provided by Microsoft that are being used for web site development. Eg: aspx, asmx, ascx, ashx, cs, vb, html, XML etc.
=>There are the following two types of validation in ASP.NET:
            1.Client-Side Validation
           2.Server-Side Validation

12.Different Between ASP and ASP.NET?

                                 ASP                            ASP .Net
ASP is interpreted. ASP.NET is compiled.
Classic ASP uses a technology called ADO to connect and work with databases. ASP.NET uses the ADO.NET technology 
ASP has Mixed HTML and coding logic. In asp.net html and coding part are separated by code behind files. 
ASP is partially object oriented. ASP.NET purely object oriented
For ASP No in-built support for XML .  ASP.NET full XML Support for easy data exchange.
ASP doesn’t support Page level transactions. ASP.NET supports Page level transactions.
ASP has maximum of 4 built in classes like Request, Response, Session and Application . ASP.NET using .NET framework classes which has more than 2000 built-in classes.

To be continued…

References:
https://www.tutorialspoint.com/vb.net/vb.net_data_types.htm
https://www.dotnettricks.com/learn/oops/understanding-inheritance-and-different-types-of-inheritance
https://www.c-sharpcorner.com/UploadFile/8ef97c/Asp-Net-interview-questions-and-answers/
https://en.wikipedia.org/wiki/ASP.NET
https://www.guru99.com/asp-net-interview-questions-answers.html
https://en.wikibooks.org/wiki/Active_Server_Pages/Differences_between_ASP_3.0_and_ASP.NET