C# - Datatypes Questions and Answers
Practice ModeShowing 10 of 42 questions
Q21
Which of the following is a reference data type?
Answer: Option D
Explanation: String is a reference type in C#.
Q22
What is the size of int data type in C#?
Answer: Option B
Explanation: An int occupies 4 bytes in C#.
Q23
Which data type can store decimal values with high precision?
Answer: Option C
Explanation: Decimal provides higher precision, mainly used in financial calculations.
Q24
Which keyword is used to define a user-defined data type in C#?
Answer: Option D
Explanation: Struct, enum, and class all define user-defined data types.
Q25
What is the size of char data type in C#?
Answer: Option B
Explanation: Char stores Unicode characters and occupies 2 bytes.
Q26
Which data type should be used to store a large whole number?
Answer: Option C
Explanation: Long is used for storing large integer values.
Q27
Which of the following is NOT a built-in data type in C#?
Answer: Option D
Explanation: Variant is not a data type in C#.
Q28
Which data type is the base type of all data types in C#?
Answer: Option B
Explanation: Object is the base class for all types in C#.
Q29
Which keyword allows implicit type inference in C#?
Answer: Option C
Explanation: var lets the compiler infer the type at compile time.
Q30
Which data type stores a single Unicode character?
Answer: Option B
Explanation: Char represents a single Unicode character.