C# Programming - Datatypes - Discussion
Discussion Forum : Datatypes - General Questions (Q.No. 11)
11.
Which of the following statements are correct?
- We can assign values of any type to variables of type object.
- When a variable of a value type is converted to object, it is said to be unboxed.
- When a variable of type object is converted to a value type, it is said to be boxed.
- Boolean variable cannot have a value of null.
- When a value type is boxed, an entirely new object must be allocated and constructed.
Discussion:
13 comments Page 2 of 2.
Morsi said:
1 decade ago
Boolean test = -1;
Constant value '-1' cannot be converted to a 'bool'
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:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers