wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Variables and Data Types

Total questions: 30

Worksheet time: 17mins

Name
Class
Date
1.

What is a variable?

a)

A named storage location for data.

b)

A type of data.

c)

A function in programming.

d)

A keyword in C.

2.

What are the do's of variable naming? (choose 2)

a)

Start with a letter or underscore.

b)

Use numbers in the name.

c)

Use descriptive names.

d)

Use spaces.

3.

What is Snake Case?

a)

A variable naming convention with underscores.

b)

A type of data.

c)

A programming language.

d)

A function.

4.

What is Camel Case?

a)

Subsequent word is capitalized.

b)

A type of data.

c)

A programming language.

d)

A function.

5.

What is Pascal Case?

a)

A variation of camel case.

b)

A type of data.

c)

A programming language.

d)

A function.

6.

What are the int data types primarily used for in C?

a)

To store whole numbers.

b)

To store decimal numbers.

c)

To store characters.

d)

To store strings.

7.

What are the float and double data types primarily used for in C?

a)

To store whole numbers.

b)

To hold real numbers

c)

To store characters.

d)

To store strings.

8.

What are the char types primarily used for in C?

a)

To store a single character.

b)

To store whole numbers.

c)

To store decimal numbers.

d)

To store strings.

9.

What is void in C?

a)

an incomplete type

b)

A single variable.

c)

A function.

d)

A type of data.

10.

You can check the size of a variable using ________ operator.

a)

sizeof()

b)

length

c)

size

d)

len

11.

What is a format specifier?

a)

A placeholder used within formatted input/output functions.

b)

A type of data.

c)

A function.

d)

A variable.

12.

Which of the following is a valid variable name in C?

a)

1st_name

b)

return

c)

user age

d)

annual_earnings

13.

Which of the following are valid variable naming conventions in C? (Choose 3)

a)

Snake Case

b)

Camel Case

c)

Kebab Case

d)

Pascal Case

14.

Which of the following are true about the char data type in C?

a)

It is used to store a single character.

b)

It is typically 6 bits in size.

c)

Cannot store special characters

d)

It is typically 1 bits in size.

15.

What do the format specifiers %d and %i represent in C?

a)

int

b)

string

c)

char

d)

float

16.

What do the format specifiers %f represent in C?

a)

int

b)

char

c)

string

d)

float

17.

What do the format specifiers %lf represent in C?

a)

string

b)

float

c)

double

d)

char

18.

What do the format specifiers %c represent in C?

a)

char

b)

int

c)

float

d)

double

19.

Allows for storage of both positive and negative numbers

a)

unsigned

b)

signed

c)

int

d)

char

20.

Which of the following is a Camel Case variable?

a)

myVar

b)

my_var

c)

MYVAR

d)

MyVar

21.

Which of the following is a Pascal Case variable?

a)

MyVariable

b)

My_Variable

c)

MYVARIABLE

d)

MYVariable

22.

Which of the following is a Snake Case variable?

a)

my_var

b)

_myvar

c)

my-var

d)

my=var

23.

Declare a variable named age with the data type int and assign it the value 18.

(a)  

24.

Declare a variable named letter with the data type char and assign it the value 'M'.

(a)  

25.

Declare a variable named weight with the data type float and assign it the value 2.5.

(a)  

26.

Allows for storage of only positive numbers

a)

unsigned

b)

signed

c)

int

d)

number

27.

Which of the following are considered derived data types? (choose 3)

a)

Int types

b)

Complex types

c)

Enumerated type

d)

bool type

28.

Format Specifiers begin with a _ symbol?

a)

#

b)

!

c)

@

d)

%

29.

It is also known as pothole_case.

a)

Snake Case

b)

Pothole Case

c)

Pascal Case

d)

Camel Case

30.

You can create variables of void type.

a)

True

b)

False