wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Variables

Total questions: 15

Worksheet time: 10mins

Name
Class
Date
1.

Which of the following is NOT a correct variable name?

a)

a. 3three

b)

b. gender

c)

c. yourFirstname

d)

d. age

2.

Which of the following is NOT a correct variable name?

a)

a. Num1

b)

b. 1stQtr

c)

c. Num_1

d)

d. firstQtr

3.

Which data type is use to store “D”?

a)

a. float

b)

b. character

c)

c. boolean

d)

d. string

4.

Which of the following is NOT part of a variable?

a)

a. name

b)

b. number

c)

c. type

d)

d. value

5.

In C++ program, which one of the following is a correct variable declaration?

a)

a. int name;

b)

b. double 1stnum;

c)

c. float = 2.22;

d)

d. none of the above

6.

Which data type is use to store “HELLO WORLD!”?

a)

a. character

b)

b. integer

c)

c. boolean

d)

d. string

7.

Which of the following is NOT correct about variable?

a)

a. variables are use for storing values.

b)

b. Once a variable is declared, it cannot be changed.

c)

c. a variable is essential in programming

d)

d. a variable should be declared first before it can be used.

8.

What type of data that returns a value either true or false.

a)

a. float

b)

b. integer

c)

c. string

d)

d. boolean

9.

What is the name of this variable?

string sum = “input an integer”;

a)

a. sum

b)

b. string

10.

What is the name of this variable?

string response="input a string";

a)

a. string

b)

b. response

11.

What is a variable?

a)

a. something that cannot be change

b)

b. a storage location with a unique name and a data type.

c)

c. something that can store numbers only.

d)

d. a name that can be used in programming.

12.

A. Based on the program code in Activity 2. What are the values hold by the following variables?

1. variable a.



(a)  

13.

A. Based on the program code in Activity 2. What are the values hold by the following variables?

1. variable b



(a)  

14.

A. Based on the program code in Activity 2. What are the values hold by the following variables?

1. variable number



(a)  

15.

A. Based on the program code in Activity 2. What are the values hold by the following variables?

1. variable c



(a)