.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Kaviya Balasubramanian
Sgraph Infotech
Imran Ghani

Home >> Interview Question >> Sql Server >> Post New Question Subscribe to Interview Questions

What is the default value of an integer data type?

Posted By :Narayanan     Posted Date :October 13, 2011    Points :40   Category :Sql Server 
NULL is the default value of an integer data type?

You can also find related Interview Question to What is the default value of an integer data type?  below: 

Value type & reference types difference? Example from .NET. Integer & struct are value types or reference types in .NET?

Most programming languages provide builtin data types, such as integers and floatingpointnumbers, that are copied when they are passed as arguments (that is, they are passed by value). In the .NET Framework, these are called value types. The runtime

supports two kinds of value types:
· Builtin
value types
The .NET Framework defines builtin
value types, such as System.Int32 and
System.Boolean, which correspond and are identical to primitive data types
used by programming languages.
· Userdefined
value types
Your language will provide ways to define your own value types, which derive from System.ValueType. If you want to define a type representing a value that is small, such as a complex number (using two floatingpoint numbers),
you might choose to define it as a value type because you can pass the value type efficiently by value. If the type you are defining would be more efficiently passed by reference, you should define it as a class instead.

Variables of reference types, referred to as objects, store references to the actual data. This following are the reference types:
· class
· interface
· delegate
This following are the builtin
reference types:
· object (More...)

What is the minimum value of TINYINT data type?

0 is the minimum value of TINYINT data type (More...)



What is the maximum size of data we can store in the image type of SQL?

We can store binary data from 0 to 2^31-1 (2,147,483,647) bytes in an image field of SQL Server. (More...)

What data type does the RangeValidator control support in Asp.net?

There are 3 Data type RangeValidator control support

3)Date (More...)

You have a column that will only contain values from 0 to 256. What's the most economical data type to use for the column?


Correct Answer : B
A SMALLINT data type uses only 2 bytes of data and can store value from -32,768 to 32,767. A TINYINT data type cannot be used because the maximum value it can hold is 255. Although an INT data type can be used, SMALLINT will use only 2 bytes compared to INT's 4 bytes. VARCHAR(3) will use 3 bytes while DECIMAL(3) will use 5 bytes.

This is the progam using inheritence, what is the order of calling constructors and what is the output?
Public Class ConstructorEx
Public Class Class1
Dim a As Integer
Sub New()
a = 1
Console.WriteLine("a in initialized in Class1")
End Sub
End Class

Public Class Class2
Inherits Class1
Dim b As Integer
Sub New()
b = 1
Console.WriteLine("b in initialized in Class2")
End Sub
End Class
Public Class Class3
Inherits Class2
Dim c As Integer
Sub New()
c = 1
Console.WriteLine("c in initialized in Class2")
End Sub
End Class

Shared Sub main()
'Creation of the object of type Class3
Dim c As New Class3()
End Sub
End Class

In this example creation of the object of type class3 calls the Class3 constructor and that constructor calls Class2 Constructor Class2 Calls Class1 Constructor.So first Class1 constructor will execute and then control will be trasfered to class2 constructor,After executing the class2 constructor the control will be treansfered to Class3 constructor.

|---->Sub New()---------------------|
| 'First it will execute <-----|
| End Sub |
| |
| Class2 |
|--->Sub New()----------------------|
| 'Second it will execute<-------|
| End Sub |
| |
| Class3 |
----Sub New()-----------------------|
'Third this will executes<-----|
End Sub

Means In the Creation of the object of type C, First Class1 Constuctor initializes the data, then class2 then class3.

So output of this program is
a in initialized in Class1
b in initialized in Class2
c in initialized in Class3

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend