0% found this document useful (0 votes)
33 views3 pages

Programming Variables Quiz and Exercises

The document contains multiple choice questions, fill-in-the-blank exercises, true or false statements, and writing prompts related to variables in programming. It covers topics such as the definition of variables, data types, operations, and their usage in programming environments like Scratch. Additionally, it includes a debugging challenge to identify an error in a Scratch code snippet.

Uploaded by

sixthbit
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views3 pages

Programming Variables Quiz and Exercises

The document contains multiple choice questions, fill-in-the-blank exercises, true or false statements, and writing prompts related to variables in programming. It covers topics such as the definition of variables, data types, operations, and their usage in programming environments like Scratch. Additionally, it includes a debugging challenge to identify an error in a Scratch code snippet.

Uploaded by

sixthbit
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd

Unit 4: Variables in Programming –

Multiple Choice Questions

1. What is a variable in programming?


a) A fixed value that never changes
b) A container that stores data which can change
c) A type of computer hardware
d) A programming language

2. Which data type would store a student's name (e.g., "Alice")?


a) Integer
b) String
c) Boolean
d) Character

3. What symbol is used for multiplication in programming?


a) `+`
b) `-`
c) `*`
d) `/`

4. In Scratch, where do you create a new variable?


a) **Looks** block
b) **Variables** block
c) **Sound** block
d) **Events** block

5. What is the output if `Num1 = 5` and `Num2 = 3` after running `Result = Num1 - Num2`?
a) `2`
b) `8`
c) `15`
d) `53`

Fill in the Blanks

1. A variable can store different types of data, such as __________ (whole numbers) or __________
(text).
2. In Scratch, the `__________` block is used to change a variable’s value.
3. The `__________` operator is used to divide two numbers.
4. A single letter (e.g., ‘A’) is stored as a __________ data type.
5. To display a variable’s value in Scratch, use the `__________` block.

True or False
1.A variable named "Score" can store both numbers and text at the same time. ( )
[Link] `=` symbol is used to compare two values in programming. ( )
[Link] Scratch, variables can only be used by one sprite. ( )
4. Answer = Num1 + Num2` will add the values of `Num1` and `Num2`. ( )
5. A "String" data type can include numbers and symbols (e.g., "Room#202"). ( )
Writing Questions

1. Define a variable and give an example of how it could be used in a game.

___________________________________________________________________________________

___________________________________________________________________________________

___________________________________________________________________________________

2. What is the difference between an integer and a string Provide examples.


___________________________________________________________________________________

___________________________________________________________________________________

___________________________________________________________________________________

3. Write a simple Scratch algorithm that:


- Asks the user for their age.
- Stores it in a variable.
- Displays "You are [age] years old!"

___________________________________________________________________________________

___________________________________________________________________________________

___________________________________________________________________________________

__________________________________________________________________________________

___________________________________________________________________________________

___________________________________________________________________________________

4. Why are variables useful in programming?

___________________________________________________________________________________

___________________________________________________________________________________

___________________________________________________________________________________
5. Predict the output of this code if `A = 10` and `B = 4`:
`
Result = (A * 2) - B

___________________________________________________________________________________

___________________________________________________________________________________

___________________________________________________________________________________

[Link] Challenge

Find the error in this Scratch code:

when green flag clicked


set [Score] to [0]
ask [What is your score?] and wait
change [Score] by [answer]
say [Your score is] + [Score] for [2] seconds
`
*Hint: There’s a missing block!*

You might also like