C# Programming - Datatypes - Discussion

Discussion Forum : Datatypes - General Questions (Q.No. 11)
11.
Which of the following statements are correct?
  1. We can assign values of any type to variables of type object.
  2. When a variable of a value type is converted to object, it is said to be unboxed.
  3. When a variable of type object is converted to a value type, it is said to be boxed.
  4. Boolean variable cannot have a value of null.
  5. When a value type is boxed, an entirely new object must be allocated and constructed.
2, 5
1, 5
3, 4
2, 3
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
13 comments Page 2 of 2.

Morsi said:   1 decade ago
Boolean test = -1;

Constant value '-1' cannot be converted to a 'bool'

Girish Menghani said:   1 decade ago
We can create a Boolean variable which have null value by assigning it "-1" that represents "null Boolean value".

Rahul said:   1 decade ago
Boolean variable cannot have a value of null - is a correct one.


Post your comments here:

Your comments will be displayed after verification.