What is the main function of the CPU?
The CPU processes instructions and performs calculations.
What operator is used for addition in Python?
+
What keyword is used to start a while statement in Python?
while
What is abstraction in computer science?
concept of hiding complex implementation details and showing only the essential features of an object
count = 2
while count<3
[indent] print(count)
[indent] count =count +1
What is the variable?
count
Name the component that stores data temporarily while a computer is running.
RAM (Random Access Memory)
How do you perform exponentiation in Python?
the ** operator
What is the output of
count = 3
while count < 5:
[indent] print(count)
[indent] count += 1
3 4
Give an example of a real-world abstraction.
many... ex. a car key; it allows you to start the car without needing to understand the mechanics of the engine.
count = 2
while count<3
[indent] print(count)
[indent] count =count +1
What does count < 3 hold?
a boolean (true or false value)
What is a Boolean data type?
holds values true and false
What is the output of the expression 5+3×2
11
What is the purpose of the 'break' statement in a loop?
The 'break' statement is used to exit a loop prematurely.
How does abstraction help in programming?
Abstraction helps in programming by reducing complexity and increasing efficiency, allowing programmers to focus on higher-level tasks.
count = 2
while count<3
[indent] print(count)
[indent] count =count +1
What is the function being used?
print()
What is machine language?
A low-level language made of binary code directly executed by the CPU
How would you calculate the average of three numbers in Python?
average = (num1 + num2 + num3) / 3
How many times will the loop run in this code?
x = 4
while x < 5:
[indent] print(x)
[indent] x += 1
1 time
Define the term "function" in the context of programming.
a reusable block of code that performs a specific task.
For the following code:
import turtle as trtl
beck = trtl.Turtle()
beck.forward(100)
beck.right(90)
wn = trtl.Screen()
wn.mainloop()
trtl, beck, wn
Explain the difference between hardware and software
Hardware refers to the physical components of a computer, while software refers to the programs and applications that run on the hardware.
What is 8 % 5?
3
How many times will the loop run in this code?
y = 4
while y < 3:
[indent] print(y)
[indent] y += 1
0 times
Why is it important to use functions in programming?
Using functions in programming is important because they promote code reusability, improve readability, and help in organizing code logically.
How many times does it turn left:
def turn_right():
turn_left()
turn_left()
turn_left()
move()
turn_left()
move()
put_ball()
move()
put_ball()
turn_ right()
turn_right()
7