C# Programming - Datatypes - Discussion

Discussion Forum : Datatypes - General Questions (Q.No. 5)
5.
Which of the following are value types?
  1. Integer
  2. Array
  3. Single
  4. String
  5. Long
1, 2, 5
1, 3, 5
2, 4
3, 5
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
9 comments Page 1 of 1.

Shrinivas Amate said:   8 years ago
Enumerations are value type. Wheather they are of fixed length or variable length?

Shrinivas Amate said:   8 years ago
Structures are variable length or fixed length?

P.Thiruselvi said:   9 years ago
Hi, Thankyou all. It is very useful for students and beginners.
(1)

Daisy J said:   1 decade ago
Array is a variable data type? But it is behind a int. So, how it is called variable data type?

Dr. Shahryar Sultan said:   1 decade ago
There are two types of datatypes:

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

2) Reference type: string & array.
(1)

Parvezkhan said:   1 decade ago
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.
(1)

Abhijit said:   1 decade ago
Int, single, Long is of fixed length and all are store data in stack.

Rasmikanta malla said:   1 decade ago
Array and String take value as reference type.
(1)

Taniya said:   1 decade ago
In Int, long, single will take directly value but other taking the reference of that value.

Post your comments here:

Your comments will be displayed after verification.