NEW
Font size
Worksheets🌟CodeHS Unit 2 {Review Quiz}🌳
Total questions: 41
Worksheet time: 21mins
🌟Which of the following commands is a valid Karel command?
move
move;
move();
move()
🌟🌟What makes the following command an invalid Karel command? turnleft();
It should end in a colon rather than a semicolon
The l should be a capital L
It should start with a capital T
This command is correct
🌟Which of the following is the correct way to define a turnRight function in Karel?
function turnRight() { turnLeft(); turnLeft(); turnLeft(); }
function turnRight() { turnLeft(); turnLeft(); }
function turnRight() { turnLeft(); turnLeft(); turnLeft(); turnLeft(); }
function turnRight() { turnLeft(); turnLeft(); turnLeft(); turnLeft(); turnLeft(); }
🌟Why do we use functions in Karel programs?
Break down our program into smaller parts
Avoid repeating code
Make our program more readable
All of the above
🌟If Karel starts at Street 1 and Avenue 1, facing East, where will Karel be, and what direction will Karel be facing after running the following code? (Assume the world is 10x10 in size)
Street 3, Avenue 1, Facing North
Street 1, Avenue 4, Facing North
Street 1, Avenue 3, Facing South
Street 1, Avenue 3, Facing North
🌟If Karel starts at Street 1 and Avenue 1, facing East, where will Karel be, and what direction will Karel be facing after running the following code? (Assume the world is 10x10 in size) move(); turnLeft(); putBall(); turnLeft(); turnLeft(); turnLeft(); move(); turnLeft();
A) Street 2, Avenue 1, Facing West
B) Street 3, Avenue 1, Facing North
C) Street 1, Avenue 2, Facing South
D) Street 3, Avenue 2, Facing East
🌟In this code, how many times is the dance function called and how many times is it defined?🌟
Called 1 time, defined 1 time
Called 1 time, defined 3 times
Called 3 times, defined 1 time
Called 3 times, defined 3 times
🌟What’s wrong with this code?
The go function is called twice
The go function has a syntax error
The go function has been defined twice
go is not a command that Karel understands
🌟How many total times will Karel move in this program?
1
5
6
7
🌟What is wrong with this for loop?
A. The for loop uses commas instead of semicolons
B. It should say i++ instead of i + 1
A
B
A and B
The for loop is correct
🌟What is the proper format for a single line comment in Karel?
This is a comment
// This is a comment
/* This is a comment
This is a comment
🌟What does the mystery function do?
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
🌟Which of the following is not a valid condition to go in an if statement for Karel?
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
I🌟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?
0
1
2
6
🌟What condition should be used in this while loop to get Karel to pick up all the tennis balls on the current location?
noBallsPresent()
ballsPresent()
frontIsClear()
takeBall()
🌟Why does a programmer indent their code?
Helps show the structure of the code.
Easier for other people to understand.
A key part of good programming style!
All of the above
🌟How can we teach Karel new commands?
For loop
While loop
Define a new function
The start function
🌟Say you want to write a program to have Karel put down 300 tennis balls. Which control structure would you use?
If statement
While loop
For loop
Nested while loop
🌟Super Karel starts at Street 1, Avenue 1, facing East in a 5x5 world. What will happen after this code runs?
Karel ends on street 1, avenue 3
Karel ends on street 2, avenue 3
This code won’t run because of a syntax error
Karel will crash into a wall
🌟Karel starts at Street 1, Avenue 1, facing East in a 5x5 world. What will happen after this code runs?
Karel will end on Street 1, Avenue 2
Karel will end on Street 1, Avenue 7
This code won’t run because of a syntax error
Karel will crash into a wall
🌟What is top down design?
Top down design is a way of designing your program by starting with the biggest problem and breaking it down into smaller and smaller pieces that are easier to solve.
Top down design is a way that you can create designs on a computer to put on a web page
Top down design is a way of 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
🌟🌟How can we improve the following program?
Break down this program into more functions
Use a for loop to repeat the move command
Use a while loop to repeat the move command
Fix the indentation of this program
🌟In the following code below from the Cleanup Karel example, what is the purpose of If Statement #2?
To move the last time
To pick up the ball that is in the last spot
To pick up the ball that is in the last spot, if there is one
To take the ball from all of the positions that have a ball on them
🌟In the following code, what would be a good Postcondition to write?
Karel is on a spot with a tennis ball facing north
Karel ends one spot above a tennis ball facing East.
Karel is on the same position but on top of a ball.
Karel is facing East.
What type of loop is used to repeat a block of code a specific number of times?
For loop
Nested while loop
🌟What is the purpose of using a for loop in code?
To do something if a condition is true
To do something while a condition is true
To repeat something a fixed number of times
To make programs run faster.
In computer programming, what is a variable?
A problem in the software
A sequence of instructions
An instruction that does not change
A placeholder for a piece of information that can change
In computer programming, what is an algorithm?
A problem in the software
A sequence of instructions
A computer programming language
A solution to a programming problem
All programming languages:
Are text-based
Are block-based
Share the same syntax
Share coding concepts such as looping
Which of the following could be TRUE for Artificial Intelligence?
I. It’s the capability of a machine to imitate intelligent human behavior.
II. It can easily be used to mimic human emotions.
III. It’s a branch of computer science dealing with the simulation of intelligent behaviors in computers.
IV. It can be easily used to detect irony or sarcasm in a story.
V. It can be easily used to read body language.
I, II, III, IV, and V
II, IV, and V
I and III
I, II, III, and IV
Which college degree has an average starting salary higher than computer science?
Social Work
Education
Business
Engineering
Which of the following best explains what happens when a new device is connected to the Internet?
A device driver is assigned to the device.
An Internet Protocol (IP) address is assigned to the device.
A packet number is assigned to the device.
A Web site is assigned to the device.
Which of the following is not a main method for sending information from one computer to another?
Electricity
Light
Molecules
Radio
Fiber optic cables transfer data at the speed of light, so they have the _______________ latency. This results in the __________ connection.
lowest, slowest
lowest, fastest
highest, slowest
highest, fastest
Which of the following is considered an unethical use of computer resources?
Downloading file sharing software on your home computer.
Searching online for the answers to CodeHS exercises and quizzes.
Purchasing an app from an app store and downloading it directly to a mobile device.
Searching online for an electronic version of a textbook.
Which of the following best describes the basic purpose of the internet?
The internet protects the privacy of sensitive information.
The internet sends information from one computer to another.
The internet stores data.
The internet connects input and output devices to a computer.
Consider this network diagram:
Each box represents a device connected to the network, each line represents a direct connection between two devices.
Which of the following statements are true about this network:
- The network is fault tolerant. If one connection fails, any two devices can still communicate.
- Computers C and E need to first communicate with at least one other device in order to communicate with each other.
I only
II only
I and II
Neither I nor II
True or False: As long as you cite your source, it is legal to use or share any kind of media you find on the Internet.
True
False
Who created the first "robot" and when did it happen?
Archytas of Tarentum, ~400 BCE
Yah Shi, 3rd Century BCE
Ismail al-Jazari, 1206
Jacques de Vaucanson, 1738
Nikola Tesla, 1898
ARPANET was built to help people do things like:
Move troops around the country
Sort through census data
Track the movement of distant galaxies
Connect with friends all over the world
Which of the following people can access your digital footprint?
I. Teachers, colleges, and scholarship committees
II. Potential employers
III. Family, friends, and acquaintances
I only
I and II only
III only
I-III All
