C# - Datatypes Questions and Answers

Take Exam

The C# Datatypes questions with answers section is designed for programmers preparing for interviews and coding tests. These programming questions and answers focus on understanding how data types are defined, declared, and managed in C#. Top recruiters like TCS, Wipro, and Accenture often include datatype-based MCQs to assess logical and memory management skills. By exploring C# programming interview questions with answers, candidates can strengthen their foundational knowledge of variables, value types, reference types, and data conversions. This topic is ideal for learners seeking to master .NET concepts for competitive programming and job interviews.

Understand data types available in C programming. Also check C structures and C dynamic memory allocation

C# - Datatypes

Showing 10 of 42 questions

21. Which of the following is a reference data type?

  • int
  • double
  • char
  • string Explanation: String is a reference type in C#.
Show Answer Report

22. What is the size of int data type in C#?

  • 2 bytes
  • 4 bytes Explanation: An int occupies 4 bytes in C#.
  • 8 bytes
  • Depends on system
Show Answer Report

23. Which data type can store decimal values with high precision?

  • float
  • double
  • decimal Explanation: Decimal provides higher precision, mainly used in financial calculations.
  • long
Show Answer Report

24. Which keyword is used to define a user-defined data type in C#?

  • struct
  • enum
  • class
  • All of the above Explanation: Struct, enum, and class all define user-defined data types.
Show Answer Report

25. What is the size of char data type in C#?

  • 1 byte
  • 2 bytes Explanation: Char stores Unicode characters and occupies 2 bytes.
  • 4 bytes
  • 8 bytes
Show Answer Report

26. Which data type should be used to store a large whole number?

  • int
  • short
  • long Explanation: Long is used for storing large integer values.
  • byte
Show Answer Report

27. Which of the following is NOT a built-in data type in C#?

  • float
  • string
  • object
  • variant Explanation: Variant is not a data type in C#.
Show Answer Report

28. Which data type is the base type of all data types in C#?

  • string
  • object Explanation: Object is the base class for all types in C#.
  • dynamic
  • var
Show Answer Report

29. Which keyword allows implicit type inference in C#?

  • dynamic
  • object
  • var Explanation: var lets the compiler infer the type at compile time.
  • auto
Show Answer Report

30. Which data type stores a single Unicode character?

  • string
  • char Explanation: Char represents a single Unicode character.
  • byte
  • bool
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test