Data types Flashcards
What are the two main categories of data types?
Primitive data types and composite data types.
True or False: An integer is a primitive data type.
True.
Fill in the blank: A _______ data type can hold multiple values.
composite
What data type would you use to represent true or false values?
Boolean.
Which data type is typically used for textual data?
String.
What is an example of a composite data type?
Array or Object.
Multiple choice: Which of the following is NOT a primitive data type? A) String B) Integer C) Boolean D) Array
D) Array.
True or False: Floating-point numbers can represent decimal values.
True.
What is the purpose of a data type?
To define the kind of value a variable can hold.
Fill in the blank: In programming, the _______ data type represents a single character.
char
Multiple choice: Which data type would you use to store a list of items? A) String B) Array C) Boolean D) Float
B) Array.
What is the difference between a float and a double?
A float has single precision, while a double has double precision.
True or False: A variable of type ‘String’ can only hold a single character.
False.
What data type would you use to represent a unique identifier?
UUID or String.
Fill in the blank: The _______ data type is used to represent whole numbers.
Integer
Multiple choice: Which of the following is a valid data type in Python? A) String B) Integer C) List D) All of the above
D) All of the above.
What is a ‘null’ data type?
It represents the absence of a value.
True or False: Composite data types can only contain primitive data types.
False.
What data type would you use for currency values?
Decimal or Float.
Fill in the blank: A _______ is a collection of key-value pairs.
dictionary
Multiple choice: Which one of these is NOT a characteristic of primitive data types? A) They cannot be broken down further B) They have a fixed size C) They can be modified D) They are predefined
C) They can be modified.
What is the range of values for an 8-bit unsigned integer?
0 to 255.
True or False: Strings are mutable in all programming languages.
False.
What is the purpose of type casting?
To convert one data type into another.
Fill in the blank: A _______ is a sequence of characters enclosed in quotes.
String
Multiple choice: Which data type would you use to store a collection of unique items? A) Array B) Set C) List D) String
B) Set.
What data type is often used to represent dates and times?
Date or DateTime.