C# - Datatypes Questions and Answers

Practice Mode
Showing 10 of 42 questions
Q31
What is the size of double data type in C#?
  • A 4 bytes
  • B 6 bytes
  • C 8 bytes Explanation: Double occupies 8 bytes in memory.
  • D 16 bytes
Answer: Option C
Explanation: Double occupies 8 bytes in memory.
Q32
Which data type is used to store a sequence of characters?
  • A char
  • B string Explanation: String stores a sequence of characters.
  • C array
  • D object
Answer: Option B
Explanation: String stores a sequence of characters.
Q33
Which of the following is a nullable value type?
  • A int
  • B int? Explanation: Nullable value types are declared using ?.
  • C string
  • D object
Answer: Option B
Explanation: Nullable value types are declared using ?.
Q34
Which data type can store both value types and reference types?
  • A var
  • B dynamic
  • C object Explanation: Object can store any data type in C#.
  • D string
Answer: Option C
Explanation: Object can store any data type in C#.
Q35
What is the default value of a bool variable?
  • A true
  • B false Explanation: Default value of bool is false.
  • C null
  • D 0
Answer: Option B
Explanation: Default value of bool is false.
Q36
Which data type is best suited for memory optimization when storing small numbers?
  • A int
  • B long
  • C byte Explanation: Byte uses only 1 byte of memory.
  • D double
Answer: Option C
Explanation: Byte uses only 1 byte of memory.
Q37
Which data type represents signed 16-bit integers?
  • A short Explanation: Short is a signed 16-bit integer type.
  • B ushort
  • C int
  • D long
Answer: Option A
Explanation: Short is a signed 16-bit integer type.
Q38
Which of the following is an unsigned data type?
  • A int
  • B short
  • C uint Explanation: Uint represents an unsigned integer.
  • D float
Answer: Option C
Explanation: Uint represents an unsigned integer.
Q39
Which data type should be used to store date and time in C#?
  • A datetime
  • B DateTime Explanation: DateTime is used to store date and time values.
  • C time
  • D date
Answer: Option B
Explanation: DateTime is used to store date and time values.
Q40
Which data type stores true, false, or null values?
  • A bool
  • B Boolean
  • C bool? Explanation: Nullable bool can store true, false, or null.
  • D bit
Answer: Option C
Explanation: Nullable bool can store true, false, or null.
Questions and Answers for Competitive Exams Various Entrance Test