Home > Articles > Programming > C#

  • Print
  • + Share This
This chapter is from the book



  1. What are the three primary groups C# types are divided into?
  2. Which predefined type is useful for financial calculations and why?
  3. What is a base type for all the predefined types?
  4. Why is the inclusion of a distinct bool type important?
  5. Is all string and character data stored as Unicode?
  6. What are the implications of strings being immutable?
  7. What is the difference between a prefix increment and a postfix increment operation?
  8. Can the null-coalescing operator (??) be used with reference types and nullable value types?
  9. Explain what happens during a boxing operation.
  10. Can a long be implicitly converted to an int?


  1. Types in C# are divided into reference types, value types, and type parameter types.
  2. The decimal type is useful for financial calculations because it eliminates many representation errors commonly found with other floating-point types.
  3. All the predefined types and everything in C# ultimately derive from the object type.
  4. By including a distinct bool type, C# helps eliminate several common programming errors by eliminating the ambiguity that can arise when using an integer 0 or 1 value.
  5. Yes, all strings and characters in C# are stored as Unicode code units, allowing them to be localized.
  6. Because strings are immutable, they cannot be changed after given a value. This means that any string concatenation operations result in creating an entirely new string object to hold the new value. Performing a large number of these operations in a repetitive fashion over a short period of time can lead to significantly increased memory usage and should be done using a StringBuilder instead.
  7. In a prefix increment operation, the result is the value of the variable before the increment; in a postfix increment operation, the result is the incremented value assigned back to the variable.
  8. Yes, the null-coalescing operator can be used with any type that can contain a null, including objects.
  9. A boxing operation occurs when a value type is used as a reference type and involves creating a new instance to hold the boxed value. Operations on a boxed object do not affect the original value.
  10. No, a long cannot be implicitly converted to an int because it would lose precision; it can, however, be explicitly converted.
  • + Share This
  • 🔖 Save To Your Account