Algorithms and Programming | Quiz 2
Quiz
•
Computers
•
University
•
Practice Problem
•
Hard
Jeremy L
FREE Resource
Student preview

7 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
2 mins • 4 pts
Regina is writing a program to process user-inputted phone numbers. The program relies on multiple operations (left). Here is a snippet of her code (right). What value does the 'usPhone' variable store?
"+1 202-555-0183"
"+1202-555-0183"
"+1 202-555-0183 "
"+1-202-555-0183"
"+1202-555-0183 "
2.
MULTIPLE CHOICE QUESTION
2 mins • 3 pts
Matching Pennies is a game where players are awarded points based on whether their coins match. Here is an algorithm that simulates one round of the game:
1. Randomly set 'coin1' to either "heads" or "tails".
2. Randomly set 'coin2' to either "heads" or "tails".
3. If 'coin1' matches 'coin2', increment 'score1' by 1.
4. Otherwise, increment 'score2' by 1.
Imagine that the algorithm is repeated three times to simulate three rounds of the game. This table shows the values for the coin variables in each round. 'score1' and 'score2' start at 0. What will be the values of 'score1' and 'score2' after the three rounds?
'score1' will be 1 and 'score2' will be 1
'score1' will be 1 and 'score2' will be 2
'score1' will be 2 and 'score2' will be 1
'score1' will be 2 and 'score2' will be 2
3.
MULTIPLE CHOICE QUESTION
2 mins • 4 pts
Jing is working with a game level designer on a new video game. The designer sends them this flow chart. He must implement that logic in code, using the variables 'enemyStrength' and 'playerHealth'. Which of these code snippets implements the logic in that flow chart?
4.
MULTIPLE CHOICE QUESTION
2 mins • 3 pts
Ryland is creating an article about commonly used compression algorithms for an online educational site. He is debating whether to express each algorithm in natural language; diagrams; pseudocode; or C++, a general-purpose programming language. Which of these statements is a good argument for expressing the algorithm in pseudocode?
Pseudocode can run on any computer, so all his readers will be able to run the algorithm themselves.
Pseudocode can express more detail than natural language, diagrams, and C++.
Pseudocode can be understood by anyone without any programming experience.
Psuedocode does not depend on the syntax and subtleties of a particular programming language, so his readers will be able to understand as long as they know at least one language.
5.
MULTIPLE CHOICE QUESTION
2 mins • 4 pts
A visual artist is programming an 8 ⛌ 8 light-emitting diode display. This is their program so far. The code relies on the procedure 'fillPixel(row, column, color)': lights up the pixel at the given 'row' and 'column' with the given 'color' (specified as a string). The top-most row is row 1 and the left-most column is column 1. What will the output of their program look like?
6.
MULTIPLE SELECT QUESTION
2 mins • 8 pts
This program determines if seafood is safe to consume. In which situations will 'rating' be "safe"? There is at least one correct answer.
When 'seafood' is "tuna" and 'daysFrozen' is 3
When 'seafood' is "salmon" and 'daysFrozen' is 7
When 'seafood' is "mollusk" and 'daysFrozen' is 9
When 'seafood' is "mollusk" and 'daysFrozen' is 1
When 'seafood' is "salmon" and 'daysFrozen' is 6
7.
MULTIPLE CHOICE QUESTION
2 mins • 4 pts
This program assigns the variable 'mystery' to a value. 'x' is set to 4 and 'y' to 8. What value will the 'mystery' variable store after running this code?
2
4
8
12
32
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
•
6th - 10th Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
11 questions
How well do you know your Christmas Characters?
Lesson
•
3rd Grade
14 questions
Christmas Trivia
Quiz
•
5th Grade
20 questions
How the Grinch Stole Christmas
Quiz
•
5th Grade
Discover more resources for Computers
26 questions
Christmas Movie Trivia
Lesson
•
8th Grade - Professio...
20 questions
christmas songs
Quiz
•
KG - University
20 questions
Holiday Trivia
Quiz
•
9th Grade - University
15 questions
Holiday Movies
Quiz
•
University
14 questions
Christmas Trivia
Quiz
•
3rd Grade - University
20 questions
Christmas Trivia
Quiz
•
University
8 questions
5th, Unit 4, Lesson 8
Lesson
•
KG - Professional Dev...
20 questions
Disney Trivia
Quiz
•
University