NEW
Font size
Worksheets2425 Bell FOC Final Exam Review
Total questions: 50
Worksheet time: 25mins
Which command makes the Karrel move forward one space in the grid?
move();
turnLeft();
turnRight();
placeMarker();
Which command makes the Karrel turn 90 degrees to the left?
turnLeft();
move();
turnRight();
collectMarker();
Why are functions useful in programming?
They allow for code to be reused and make programs more organized.
They make the program run faster.
They automatically fix errors in the code.
They are required for Karrel to move.
What does the command turnAround() typically do in the Karrel environment?
Makes the Karrel turn 180 degrees.
Makes the Karrel move backward.
Makes the Karrel face a random direction.
It's not a standard Karrel command.
What is a "while loop" used for in programming?
To execute a block of code repeatedly as long as a certain condition is true.
To execute a block of code a specific number of times.
To define a function.
To store data.
What is an "if statement" used for in programming?
To execute a block of code only if a certain condition is true.
To repeat a block of code.
To define a variable.
To move Karrel forward.
What does if FrontIsClear() evaluate to?
True if there is no obstacle directly in front of the Ball, false otherwise.
The number of markers in front of the Ball
The direction the Ball is facing.
The current position of the Ball.
What does if BallIsPresent() evaluate to?
True if there is at least one Ball current location, false otherwise.
The total number of Balls in the world.
The number of markers Karrel is carrying.
The location of the nearest marker.
What is the purpose of comments in code?
To explain the code to humans.
To make the code easier for the computer to understand.
To make the code run faster.
To automatically fix errors.
How do you call or execute a function that has been defined as myFunction()?
myFunction()
execute myFunction
call myFunction()
myFunction;
What is the purpose of indentation in programming?
To visually structure the code and indicate blocks of code belonging to loops or conditional statements.
To make the code run faster.
To add comments to the code.
To define variables.
What is the process of identifying and fixing errors in computer programs called?
Debugging
Compiling
Executing
Designing
Which of the following programming structures allows for a block of code to be executed repeatedly for a specific number of times?
For loop
If statement
While loop
Function definition
Which of the following commands is a valid Karel command?
move();
move
move;
move()
Why is the following command an invalid Karel command? turnleft();
The l should be a capital L
It should end in a colon rather than a semicolon
It should start with a capital T
This command is correct
In this code, how many times is the dance function called and how many times is it defined?
function start() {
move();
dance();
move();
move();
turnLeft();
dance();
dance();
}
function dance() {
turnLeft();
move();
turnLeft();
turnLeft();
move();
turnLeft();
}
Called 3 times, defined 1 time
Called 1 time, defined 1 time
Called 1 time, defined 3 times
Called 3 times, defined 3 times
What's wrong with this code?
function start() {
move();
go();
go();
}
function go() {
move();
move();
}
function go() {
move();
move();
}
The go function has been defined twice
The go function is called twice
The go function has a syntax error
go is not a command that Karel understands
How many total times will Karel move in this program?
function start() {
move();
for (var i = 0; i < 5; i++) {
move();
putBall();
}
}
6
1
5
7
What is the proper format for a single line comment in Karel?
// This is a comment
/* This is a comment
This is a comment
What does the mystery function do?
function mystery() {
while (noBallsPresent()) {
move();
}
}
Karel moves until it is on a ball
Karel moves once if there is no ball present
Karel moves until it puts down a ball
Karel checks if there is no ball on the current spot and then moves once
Say Karel is on a location with one tennis ball. After the following code runs, how many tennis balls will there be at that location?
for (var i = 0; i < 3; i++) {
if (ballsPresent()) {
takeBall();
} else {
putBall();
putBall();
}
}
1
0
2
6
How can we teach Karel new commands?
Define a new function
For loop
While loop
The start function
Say you want to write a program to have Karel put down 300 tennis balls. Which control structure would you use?
For loop
If statement
While loop
Nested while loop
What is top down design?
Designing your program by starting with the biggest problem and breaking it down into smaller pieces.
Create designs on a computer to put on a web page
Designing your programs starting with the individual commands first
Top down design is a way to use loops and if statements to decompose the problem
What is the purpose of using a for loop in code?
To repeat something a fixed number of times
To do something if a condition is true
To do something while a condition is true
To make programs run faster
In Code.org's Game Lab, what is the coordinate system typically used to position objects on the screen?
Cartesian coordinates (x, y) with the origin at the top-left.
Polar coordinates
Cartesian coordinates (x, y) with the origin at the center.
Spherical coordinates
What is the purpose of the "draw loop" in Game Lab?
To continuously update and redraw the elements on the screen.
To define functions.
To handle user input.
To play sound effects.
What is a "sprite" in the context of game development?
A 2D image or animation that can be manipulated on the screen.
A single frame of an animation.
A sound effect.
A background image ग्रामीण छवि।
Which of the following is a common property of a sprite that can be changed in Game Lab?
The sprite's x and y position.
The computer's operating system.
The user's mouse cursor.
The programming language being used.
What does createSprite(x, y, width, height) do in Game Lab?
It creates a new sprite with the given position and dimensions.
It moves an existing sprite to the specified coordinates.
It changes the background color.
It deletes a sprite.
How can you make a sprite move horizontally in Game Lab?
By changing its x velocity (velocityX).
By changing its y velocity (velocityY).
By using the move() command.
Sprites cannot move in Game Lab.
What does randomNumber(min, max) function do in Game Lab?
Returns a random integer between min (inclusive) and max (inclusive).
Returns a random floating-point number between min and max.
Sets a random seed for the random number generator.
Sorts a list of numbers randomly.
What is "user input" in the context of interactive programs?
Data or commands provided by the person using the program (e.g., keyboard presses, mouse clicks).
The output displayed on the screen.
The code written by the programmer.
The computer's internal processing.
How can you detect if a specific key has been pressed in Game Lab?
Using the keyDown() function.
Using the mouseIsPressed variable.
Using the sprite.isTouching() function.
Using the randomNumber() function.
What does the isTouching() function in Game Lab do?
Checks if two sprites are overlapping.
Checks if the mouse cursor is over a sprite.
Checks if a sprite has gone off the screen.
Changes the color of a sprite when it's touched.
What is a "variable" in programming?
A named storage location that can hold a value.
A type of loop.
A function that returns a random number.
A comment in the code.
Which of the following is a valid variable name in JavaScript (used in Game Lab)?
playerScore
2ndScore
game over
if
What is the term for a sequence of instructions that a computer follows to perform a specific task?
Algorithm
Hardware
Software
Data
What is the purpose of the background() function in the draw loop?
To set the background color of the canvas in each frame.
To draw shapes on the screen.
To load background images.
To clear all sprites from the screen.
How can you create an animation of a sprite in Game Lab?
By loading a series of images and displaying them in sequence.
By changing its color rapidly.
By making it move very fast.
Animations cannot be created in Game Lab.
What is a "conditional statement" used for in game development?
To make decisions in the game based on certain conditions.
To repeat actions.
To define new sprites.
To draw shapes.
Which of the following is a common use of conditional statements in games?
A) Checking if a player's score reaches a certain value.
B) Moving a sprite forward.
C) Creating a new sprite.
D) Setting the background color.
What is a "collision" in the context of games?
When two or more game objects (like sprites) come into contact.
When a sprite moves off the screen.
When the player presses a key.
When the background color changes.
How can you make a sprite bounce off the edges of the screen in Game Lab?
By checking if the sprite's position exceeds the screen boundaries and reversing its velocity.
By using the collide() function.
By using the bounce() function.
Sprites cannot bounce in Game Lab.
What is the purpose of sound effects in games?
To enhance the player's experience and provide feedback.
To make the game run faster.
To display text on the screen.
To control the movement of sprites.
Which function in Game Lab is commonly used to load and play sound files?
loadSound()
playSound()
startSound()
playAudio()
In game development, what is the term for different identifiable stages or modes within a game, such as a menu screen, a gameplay level, or a game over screen?
Game states
Game settings
Game variables
Game functions
How can you typically transition between different game states in a game program?
By using conditional statements to control what is updated and drawn.
By changing the background color.
By creating new sprites.
By increasing the game speed.
What is the fundamental loop structure in many game development environments that continuously updates the game world and renders the graphics?
Draw loop (or game loop)
For loop
While loop
If statement
What is the importance of testing your game or program frequently during development?
To identify and fix bugs or errors early in the process.
To make sure the code is long enough.
To impress other programmers.
To make the program run faster.
