C# Programming - Datatypes - Discussion

Discussion :: Datatypes - General Questions (Q.No.5)

5. 

Which of the following are value types?

  1. Integer
  2. Array
  3. Single
  4. String
  5. Long

[A]. 1, 2, 5
[B]. 1, 3, 5
[C]. 2, 4
[D]. 3, 5

Answer: Option B

Explanation:

No answer description available for this question.

Taniya said: (May 29, 2012)  
In Int, long, single will take directly value but other taking the reference of that value.

Rasmikanta Malla said: (Jun 10, 2012)  
Array and String take value as reference type.

Abhijit said: (Feb 4, 2013)  
Int, single, Long is of fixed length and all are store data in stack.

Parvezkhan said: (Sep 21, 2014)  
Data Types are divided into two type:.

1. Value types.
2. Reference type.

If all the values of variable stored in stack memory we called it as a VALUE type where all the fixed length types are value types only.

EG: int, float, char etc.

Note: Stack memory is under OS control that able to allocated the memory only in fixed length. Now the question arises string and objects are variable length datatypes then how memory allocation is there on stack for them?

ANSWER: This is overcome by a special thing called it as a "MANAGED HEAP" in which all the values of variable length datatype is store on manage heap and the address or reference of that variable is store on stack memory where all variable length types are reference type only.

EG: string and objects etc.

Heap is a memory location which is monitored by Garbage Collector which provide a beautiful feature of automatic memory management.

NOTE: In Java and .Net as a heap is monitored by Garbage collector it is referred as managed heap.

Dr. Shahryar Sultan said: (Apr 19, 2015)  
There are two types of datatypes:

1) Value type: int, long, short...etc.

2) Reference type: string & array.

Daisy J said: (Aug 7, 2015)  
Array is a variable data type? But it is behind a int. So, how it is called variable data type?

P.Thiruselvi said: (Jun 7, 2016)  
Hi, Thankyou all. It is very useful for students and beginners.

Shrinivas Amate said: (Jul 30, 2017)  
Structures are variable length or fixed length?

Shrinivas Amate said: (Jul 30, 2017)  
Enumerations are value type. Wheather they are of fixed length or variable length?

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.