Data types and variables Flashcards
What is a variable in programming?
A variable is a storage location identified by a name that can hold a value which may change during the execution of a program.
True or False: A variable can only store one data type at a time.
True
What are the four main data types in programming?
Integer, Float, String, Boolean
Fill in the blank: An _____ is a type of variable that can only hold two values: true or false.
Boolean
What data type would you use to store a person’s name?
String
Which data type is used for decimal numbers?
Float
What is the purpose of a constant in programming?
A constant is a value that cannot be changed during the execution of a program.
True or False: Strings can be concatenated in programming.
True
What is the result of ‘5’ + 3 in a programming language that uses type coercion?
‘53’
What is type casting?
Type casting is the conversion of a variable from one data type to another.
Multiple Choice: Which of the following is NOT a data type? A) Integer B) Array C) Function D) Variable
D) Variable
Fill in the blank: The _____ operator is used to assign a value to a variable.
assignment
What is an array?
An array is a collection of variables that can hold multiple values of the same data type.
True or False: A variable name can start with a number.
False
What does ‘immutable’ mean in the context of data types?
Immutable means that the value of a data type cannot be changed after it is created.