C#.NET — What is the default value of the Boolean type (bool)?

Difficulty: Easy

Correct Answer: False

Explanation:


Introduction / Context:
This question checks basic knowledge of default values for built-in types in C#. Knowing defaults helps avoid uninitialized-variable bugs and supports correct struct/class field definitions.



Given Data / Assumptions:

  • We refer to the default value of bool (Boolean) in C#/.NET.
  • Default values apply to fields, array elements, and auto-initialized contexts.


Concept / Approach:
In C#, the default for bool is false. Numeric types default to 0 (or 0.0), reference types to null, and char to the null character. Local variables must be assigned before use, but their theoretical default is not usable without explicit assignment.



Step-by-Step Solution:

Identify type: bool. Recall default mapping: bool → false. Therefore the correct choice is False.


Verification / Alternative check:
Declaring a field in a class bool flag; and printing its value shows False unless explicitly set to true.



Why Other Options Are Wrong:
0/1 are numeric encodings, not the C# literal defaults. True is the opposite of the default. -1 is unrelated to bool.



Common Pitfalls:
Confusing C# with languages where boolean truth values map directly to 0/1 and may be treated as integers.



Final Answer:
False

More Questions from Datatypes

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion