0
0
Intro to Computingfundamentals~20 mins

Variables and data storage in Intro to Computing - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Variable Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
trace
intermediate
2:00remaining
Trace the value of variable after assignments
Consider the following steps where a variable is assigned new values. What is the final value of x after all steps?
Intro to Computing
x = 5
x = x + 3
x = x * 2
x = x - 4
A12
B16
C10
D8
Attempts:
2 left
💡 Hint
Calculate step by step: start with 5, add 3, then multiply by 2, then subtract 4.
🧠 Conceptual
intermediate
1:30remaining
Identify the correct description of variable storage
Which option best describes what happens when a variable stores a value in a computer?
AThe variable changes the value into a picture.
BThe variable sends the value to the screen immediately.
CThe variable deletes the value after storing it.
DThe variable creates a box in memory that holds the value.
Attempts:
2 left
💡 Hint
Think about how a variable keeps information for later use.
Comparison
advanced
2:00remaining
Compare variable types and their storage sizes
Which option correctly orders these variable types from smallest to largest typical storage size?
AInteger, Boolean, String, Floating-point
BString, Boolean, Integer, Floating-point
CBoolean, Integer, Floating-point, String
DFloating-point, Integer, Boolean, String
Attempts:
2 left
💡 Hint
Think about how much space each type usually needs in memory.
identification
advanced
1:30remaining
Identify the error in variable naming
Which variable name is invalid in most programming languages?
Auser_name
B2ndPlace
C_tempValue
DtotalScore
Attempts:
2 left
💡 Hint
Variable names usually cannot start with a number.
🚀 Application
expert
2:00remaining
Determine the output after variable swapping
Given the code below, what is the value of a and b after execution?
Intro to Computing
a = 10
b = 20
a, b = b, a
Aa = 20, b = 10
Ba = 10, b = 20
Ca = 30, b = 0
Da = 20, b = 20
Attempts:
2 left
💡 Hint
Look at how the values are swapped in one line.