This section contains aptitude questions and answers on C# data types (set 3).
1) What is the range of double in C#?
- +-1.5 x 10-45 to +-3.4 x 1038
- +-5.0 x 10-324 to +-1.7 x 10308
- +-1.0 x 10-28 to +-7.9 x 1028
- +-2.0 x 10-28 to +-7.9 x 1028
Correct answer: 2
+-5.0 x 10-324 to +-1.7 x 10308
The range of double numbers in C# is: +-5.0 x 10-324 to +-1.7 x 10308
2) What is the range of float in C#?
- +-1.5 x 10-45 to +-3.4 x 1038
- +-5.0 x 10-324 to +-1.7 x 10308
- +-1.0 x 10-28 to +-7.9 x 1028
- +-2.0 x 10-28 to +-7.9 x 1028
Correct answer: 1
+-1.5 x 10-45 to +-3.4 x 1038
The range of float numbers in C# is: +-1.5 x 10-45 to +-3.4 x 1038
3) What is the range of decimal in C#?
- +-1.5 x 10-45 to +-3.4 x 1038
- +-5.0 x 10-324 to +-1.7 x 10308
- +-1.0 x 10-28 to +-7.9 x 1028
- +-2.0 x 10-28 to +-7.9 x 1028
Correct answer: 3
+-1.0 x 10-28 to +-7.9 x 1028
The range of decimal numbers in C# is: +-1.0 x 10-28 to +-7.9 x 1028
4) What is the default value of boolean type in C#?
- True
- False
- -1
- 0
Correct answer: 2
False
The default value of boolean type is False.
5) Value types are occupied space in?
- Stack segment
- Register segment
- Heap segment
- None of the above
Correct answer: 1
Stack segment
All value types are occupied space in Stack Segment.
6) Reference types are occupied space in?
- Stack segment
- Register segment
- Heap segment
- None of the above
Correct answer: 3
Heap segment
All reference types are occupied space in Heap Segment.
7) There is a statement is given below which is true or false??
"Every data type available in C#, is either a reference type or value type?"
- True
- False
Correct answer: 1
True
The given statement is True.
8) There is a statement is given below which is true or false?
""In C#, widening conversions happened automatically, there is no need to do widening conversion explicitly.
- True
- False
Correct answer: 1
True
The given statement is True.
9) Which statement is correct about boxing in C#?
- Assign an integer value to object type.
- Convert Object type value to a value type.
- Both of the above
- None of the above
Correct answer: 1
Assign an integer value to object type.
Assign an integer value to object type is known as boxing.
10) There are following statements are given below, what are the correct ways to initialize value 5 into A and B integer variables?
- int A=5;
int B=5;
- int A,B=5;
- int A=5,B=5;
- int A=B=5;
Options
- A, C
- Only A
- Only C
- Only D
Correct answer: 1
A, C
In the above options A and C are correct ways to initialize A and B with 5.
11) There is a statement is given below which is true or false?
"Can we store null value to value types?"
- True
- False
Correct answer: 2
False
We cannot store null value to the value types. Null value can be store reference types only.
12) There is a statement is given below which is true or false?
""In C#, in the case of all value types there is an implicit constructor which is used to initialize value type variable by its default value?
- True
- False
Correct answer: 1
True
The above statement is True.