Font size
WorksheetsVariables and Data Types
Total questions: 30
Worksheet time: 17mins
What is a variable?
A named storage location for data.
A type of data.
A function in programming.
A keyword in C.
What are the do's of variable naming? (choose 2)
Start with a letter or underscore.
Use numbers in the name.
Use descriptive names.
Use spaces.
What is Snake Case?
A variable naming convention with underscores.
A type of data.
A programming language.
A function.
What is Camel Case?
Subsequent word is capitalized.
A type of data.
A programming language.
A function.
What is Pascal Case?
A variation of camel case.
A type of data.
A programming language.
A function.
What are the int data types primarily used for in C?
To store whole numbers.
To store decimal numbers.
To store characters.
To store strings.
What are the float and double data types primarily used for in C?
To store whole numbers.
To hold real numbers
To store characters.
To store strings.
What are the char types primarily used for in C?
To store a single character.
To store whole numbers.
To store decimal numbers.
To store strings.
What is void in C?
an incomplete type
A single variable.
A function.
A type of data.
You can check the size of a variable using ________ operator.
sizeof()
length
size
len
What is a format specifier?
A placeholder used within formatted input/output functions.
A type of data.
A function.
A variable.
Which of the following is a valid variable name in C?
1st_name
return
user age
annual_earnings
Which of the following are valid variable naming conventions in C? (Choose 3)
Snake Case
Camel Case
Kebab Case
Pascal Case
Which of the following are true about the char data type in C?
It is used to store a single character.
It is typically 6 bits in size.
Cannot store special characters
It is typically 1 bits in size.
What do the format specifiers %d and %i represent in C?
int
string
char
float
What do the format specifiers %f represent in C?
int
char
string
float
What do the format specifiers %lf represent in C?
string
float
double
char
What do the format specifiers %c represent in C?
char
int
float
double
Allows for storage of both positive and negative numbers
unsigned
signed
int
char
Which of the following is a Camel Case variable?
myVar
my_var
MYVAR
MyVar
Which of the following is a Pascal Case variable?
MyVariable
My_Variable
MYVARIABLE
MYVariable
Which of the following is a Snake Case variable?
my_var
_myvar
my-var
my=var
Declare a variable named age with the data type int and assign it the value 18.
(a)
Declare a variable named letter with the data type char and assign it the value 'M'.
(a)
Declare a variable named weight with the data type float and assign it the value 2.5.
(a)
Allows for storage of only positive numbers
unsigned
signed
int
number
Which of the following are considered derived data types? (choose 3)
Int types
Complex types
Enumerated type
bool type
Format Specifiers begin with a _ symbol?
#
!
@
%
It is also known as pothole_case.
Snake Case
Pothole Case
Pascal Case
Camel Case
You can create variables of void type.
True
False
