wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

LA3.C3: Variables

Total questions: 16

Worksheet time: 8mins

Name
Class
Date
1.

What is the purpose of the line 'name = TextWindow.Read()' in the program?

a)

To display a greeting

b)

To define a variable

c)

To print the user's name

d)

To store the user's input

2.

Which of the following is a valid variable name?

a)

1stVariable

b)

if

c)

variable-name

d)

variable_name

3.

What will be the output of 'TextWindow.WriteLine(number3)' if number1 is 10 and number2 is 20?

a)

200

b)

10

c)

20

d)

30

4.

What does the operation 'TextWindow.Write()' do?

a)

Writes text to a new line

b)

Writes text on the same line

c)

Reads user input

d)

Displays an error message

5.

Which symbol is used for division in the program?

a)

-

b)

*

c)

/

d)

+

6.

What is the result of 'number3 = number1 * number2' if number1 is 10 and number2 is 20?

a)

200

b)

30

c)

10

d)

20

7.

What is the first step in the temperature conversion program?

a)

Display the temperature in Celsius

b)

Get temperature in Fahrenheit from the user

c)

Convert Celsius to Fahrenheit

d)

Calculate the average temperature

8.

What does the parentheses in 'celsius = 5 * (fahr - 32) / 9' indicate?

a)

To perform division first

b)

To perform multiplication first

c)

To perform subtraction first

d)

To perform addition first

9.

Which of the following is NOT a rule for naming variables?

a)

A name can contain letters and digits

b)

A name must start with a letter

c)

A name can contain underscores

d)

A name can be the same as a keyword

10.

What will the output be if the user inputs 'Alice' in the program?

a)

Hello

b)

Hello World

c)

Hello Alice

d)

Alice

11.

What is the purpose of a variable in programming?

a)

To read user input

b)

To display output

c)

To define functions

d)

To store values temporarily

12.

What will 'TextWindow.WriteLine("Hello " + name)' do?

a)

Stores the user's name

b)

Asks for the user's name

c)

Prints 'Hello' followed by the user's name

d)

Prints 'Hello World'

13.

Which operation is used to read a number from the user?

a)

TextWindow.Write()

b)

TextWindow.ReadNumber()

c)

TextWindow.WriteLine()

d)

TextWindow.Read()

14.

What will happen if you run the program multiple times?

a)

It will crash

b)

It will ask for the user's name each time

c)

It will remember the previous name

d)

It will display an error

15.

What is the output of 'number3 = number1 + number2' if number1 is 15 and number2 is 25?

a)

40

b)

15

c)

25

d)

30

16.

What will the output be if the user inputs 'Bob' in the program?

a)

Hello

b)

Hello Bob

c)

Hi Bob

d)

Welcome Bob