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

31. What is the size of double data type in C#?

  • 4 bytes
  • 6 bytes
  • 8 bytes Explanation: Double occupies 8 bytes in memory.
  • 16 bytes
Show Answer Report

32. Which data type is used to store a sequence of characters?

  • char
  • string Explanation: String stores a sequence of characters.
  • array
  • object
Show Answer Report

33. Which of the following is a nullable value type?

  • int
  • int? Explanation: Nullable value types are declared using ?.
  • string
  • object
Show Answer Report

34. Which data type can store both value types and reference types?

  • var
  • dynamic
  • object Explanation: Object can store any data type in C#.
  • string
Show Answer Report

35. What is the default value of a bool variable?

  • true
  • false Explanation: Default value of bool is false.
  • null
  • 0
Show Answer Report

36. Which data type is best suited for memory optimization when storing small numbers?

  • int
  • long
  • byte Explanation: Byte uses only 1 byte of memory.
  • double
Show Answer Report

37. Which data type represents signed 16-bit integers?

  • short Explanation: Short is a signed 16-bit integer type.
  • ushort
  • int
  • long
Show Answer Report

38. Which of the following is an unsigned data type?

  • int
  • short
  • uint Explanation: Uint represents an unsigned integer.
  • float
Show Answer Report

39. Which data type should be used to store date and time in C#?

  • datetime
  • DateTime Explanation: DateTime is used to store date and time values.
  • time
  • date
Show Answer Report

40. Which data type stores true, false, or null values?

  • bool
  • Boolean
  • bool? Explanation: Nullable bool can store true, false, or null.
  • bit
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test