No student devices needed. Know more
132 questions
Used in public key encryption, ____________________ Encryption is a scheme in which the key to encrypt data is different from the key to decrypt.
Private Key
Asymmetric
Public Key
Symmetric
Encode the message using a Caesar cipher with shift 9.
Is cereal a soup
Different ____________ can be written to implement the same algorithm.
problems
algorithms
code
lines
Different algorithms can be developed to solve the same problem.
True
False
An algorithm will be used to calculate the difference between the smallest and largest values in a list. For the list of [10, 3, 5, 6], it should calculate a difference of 7.
There are two proposals for the algorithm:
Algorithm 1:
Set minVal to the first value in the list and maxVal to the last value in the list.
Iterate through each number in the list.
If the number is greater than maxVal, store it in maxVal.
If the number is less than minVal, store it in minVal.
After loop, set maxDiff to the difference between maxVal and minVal.
Algorithm 2:
Set minVal to 1000 and maxVal to 0.
Iterate through each number in the list.
If the number is greater than maxVal, store it in maxVal.
If the number is less than minVal, store it in minVal.
After loop, set maxDiff to the difference between maxVal and minVal.
Which of these statements are true about these algorithms?
I. Algorithm 1 does not work on lists where the smallest value is at the start of the list or the largest value is at the end of the list.
II. Algorithm 2 does not work on lists that contain all negative numbers or all numbers over 1000.
I only
II only
I and II only
Neither I nor II
The flow chart above visualizes an algorithm to generate the "hailstone sequence", an interesting series of numbers.
If the variable n starts off as 5, what would be displayed as a result of executing this algorithm?
*MOD means the remainder
16 8 4 2 1
1
5 16 8 4 2
5 4 3 2
31
"______ encryption is a method of encryption involving one key for both encryption and decryption."
Private Key
Symmetric
Asymmetric
Public Key
Which of the following describe an algorithm?
👁️Note that there may be multiple answers to this question.
Choose all answers that apply:
A group of ideas that could solve a problem
A list of steps to solve a problem
A program
A typed document that explains things
Which of the following best describes an algorithm?
👁️Note that there may be multiple answers to this question.
Choose all answers that apply:
Creating an efficient working code solution for an algorithm may help solve larger versions of the problem later if the code can be scaled for the larger problem.
Most algorithms can only be written in only one language for only one specific problem.
There may be several algorithms and programming language solutions for a problem with run times that vary greatly.
None of these
The flow chart below visualizes an algorithm to generate the Fibonacci numbers, a famous mathematical sequence.
If the variable max is set to 5, what would be displayed as a result of executing this algorithm?
1 2 3 5 8
1 1 2 3 5 8
1 1 2 3 5
1 1 2
____________ is the repetition part of an algorithm until a condition is met or for a specified number of times.
Selection
Looping
Sequencing
Conditioning
____________ is the application of each step of an algorithm in the order in which the statements are given.
Sequencing
Selection
Iteration
Branching
Choose the answer that is NOT a feature of Public Key Cryptography:
Using public key guarantees that only the intended recipient can decrypt the message
A Public Key database ensures 3rd party accountability of security
Allows secure communication without establishing a *shared* encryption key ahead of time.
A key for decrypting is never made public
A programmer wants to present their idea for an algorithm at a company meeting. They're debating whether to express the algorithm in flow charts, pseudocode, or a programming language.
Which of these is a good argument for expressing the algorithm in a flow chart at the company meeting?
Flow charts can express more detail than expression in pseudocode or a programming language.
Flow charts can express any algorithm, while pseudocode and programming languages can only express a subset of algorithms.
Programming languages can automatically turn flow charts into code, so their colleagues can run the flow chart in the language of their choice.
Flow charts can require less technical knowledge to understand than pseudocode or programming languages.
The following algorithm computes the maximum score for a list of final exam scores.
Initialize a variable max to the first score in the list.
For each score in the list, compare the score to max.
If score is greater than max, store score in max
Return max.
Which building blocks are involved in this algorithm?
Selection
Iteration
Sequencing
None of these
The flow chart above visualizes the steps of an algorithm:
What would be displayed as a result of executing this algorithm?
4 7 9 10
10
0
15
5 9 12 14 15
Ryland is creating an article about commonly used compression algorithms for an online educational site.
He's debating whether to express each algorithm in natural language, flow charts, pseudocode, or C++, a general-purpose programming language.
Which of these 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 doesn't depend on the syntax and subtleties of a particular programming language, so his readers will be able to understand it as long as they know at least one language.
Pseudocode can express more detail than natural language, flow charts, and C++.
Pseudocode can be understood by anyone, even those without any programming experience
If an algorithm was written in one the following, which would typically make reading the algorithm the easiest?
C
natural language
Scratch
python
pseudocode
The algorithm below determines whether a given year is a leap year.
If year is not divisible by 4, set leap_year to false
Else if year is not divisible by 100, set leap_year to true
Else if year is not divisible by 400, set leap_year to false
Else, set leap_year to true.
Which of these tables correctly shows the results of this algorithm on the given values of year?
__________________ is used prevalently on the web, it allows for secure messages to be sent between parties without having to agree on, or share, a secret key. It uses an encryption scheme in which the encryption key is made public, but the decryption key is kept private.
SSL
Asymmetric Encryption
Private key
Public key
Symmetric Encryption
Algorithms with a polynomial efficiency or slower (constant, linear, square, cube, etc.) are said to run in a ______ amount of time.
Which of the following best describes high-level computing languages?
They are easy for machines to understand and parse
They are not ambiguous
Difficult for humans to read
They evolve naturally over time
Matching pennies is a game where players are awarded points based on whether their coins match.
Here's an algorithm that simulates one round of the game:
Randomly set coin1 to either "heads" or "tails" Randomly set coin2 to either "heads" or "tails" If coin1 matches coin2, increment score1 by 1 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 will be 2 and score2 will be 2
score1 will be 2 and score2 will be 1
score1 will be 1 and score2 will be 2
score1 will be 1 and score2 will be 1
Which of the following best describes the need for using cryptography in data communications?
Cryptography prevents third parties from accessing personal accounts.
Cryptography ensures data is decipherable by the recipient, but not accessible by a third party.
Data is easier to access when it is encrypted.
Cryptography allows data to be sent over the internet.
Moore’s Law describes the rate at which the number of transistors on a single chip doubles over time. Which of the following assumptions CANNOT be inferred as a direct consequence of this rate of doubling?
Five years from now, electronic components can be made smaller than today’s equivalent electronic components.
Five years from now, top-of-the-line computers will have faster processors (CPUs) than today’s top-of-the-line computers.
Five years from now, web pages will require less memory (RAM) than today’s web pages.
Five years from now, computer programs will be able to solve complex problems faster than today’s computer programs.
Consider a robot that is initially facing north in a 5-by-5 grid, as shown in the diagram above. A program segment has been written to move the robot to the upper-right corner where it should face west.
The following program segment is intended to move a robot from the starting position to the ending position as shown above. However, the program segment does not work correctly.
Which 2 lines of code in the segment above must be switched in order for the program to correctly move a robot from the starting position to the ending position?
The code snippet is the first answer choice btw
Line 6
Line 2
Line 4
Line 7
Whenever you generalize a variety of related problems and develop a common solution that can be applied to solve any of them, you are using the technique called:
Abstraction
Free Thinking
Creativity
Programming
Which is true about a linear search?
Does not work on unsorted data sets.
Should not be used to sort complicated data sets.
Works sometimes on large data sets.
Does not work well on small data sets.
Will search any data set.
Which of the following statements best describes the properties of public key encryption?
Public key encryption is an encryption method which relies on separate keys for encrypting and decrypting information.
Public key encryption is a highly secure encryption scheme that in which a single shared key is used by both the sender and receiver of the message.
Public key encryption makes use of mathematical problems which no algorithm can be used to solve.
Public key encryption makes use of certain types of problems which are easier for humans to solve than computers.
When taking a natural language or pseudocode algorithm and translating it into programming language code, which of the following is true?
Some languages add more detail to the final programming language solution.
Some languages are easier to read than others.
Some languages may simplify the code as they may have features that make the code writing easier.
All of these
Which is true about a binary search?
Does not work well on small data sets.
Will search any data set.
Works sometimes on large data sets.
Should not be used to sort complicated data sets.
Does not work on unsorted data sets.
Used in public key encryption, ____________________ Encryption is a scheme in which the key to encrypt data is different from the key to decrypt.
Asymmetric
SSL
Symmetric
Public key
Which of the following is a phase of the Development Process?
Designing
Investigating and Reflecting
Testing
All of these
Using the flowchart above, what value when entered for Y will generate a mathematical error and prevent our flowchart from being completely executed?
1
3
0
None of these values will produce a mathematical error
A standard deck of playing cards contains 52 cards, with each card being one of four
suits: SPADES, HEARTS, CLUBS, and DIAMONDS. Each suit is represented by 13 cards whose
values include ACE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, QUEEN,
and KING. Consider the following two algorithms that are intended to find the card representing
the "TEN of HEARTS" in a randomly shuffled deck and separate it from the other 51 cards in the
deck.
Algorithm A
Step 1:Pick up the shuffled deck of cards.
Step 2:Look at the topmost card in your hands.
Step 3:If the card's suit is a HEART, place the card on top of the pile to your left.
Step 4:Otherwise, place the card on top of the pile to your right.
Step 5:Repeat steps 2 through 4 until you are no longer holding any cards.
Step 6:Pick up the cards in the pile to your: left.
Step 7:Look at the topmost card in your hands.
Step 8:If the card's value is a TEN, place all other cards in your hands on top of the pile to your right.
Step 9:Otherwise, place the card on top of the pile to your right.
Step 10:Repeat steps 7 through 9 until you are holding only one card.
Step 11:The only card in your hand is the TEN of HEARTS.
Algorithm B
Step 1:Pick up the shuffled deck of cards.
Step 2:Look at the topmost card in your hands.
Step 3:If the card's suit is a HEART or the card's value is a TEN, place all other cards in your hands on top of the pile to your right.
Step 4:Otherwise, place the card on top of the pile to your right.
Step 5:Repeat steps 2 through 4 until you are holding only one card.
Step 6:The only card in your hand is the TEN of HEARTS.
Only Algorithm A will always work as intended.
Neither Algorithm A nor Algorithm B will ever work as intended.
Both Algorithm A and Algorithm B will always work as intended.
Only Algorithm B will always work as intended.
A network of tiny electrical switches is called a _______________
silicon
transistor
computer chip
nano-meter
Which of the following best describes an undecidable problem?
An algorithm that runs really slowly for all data set sizes.
An algorithm that solves some instances of a problems for some data set sizes.
An algorithm that solves some instances of a problem for all data set sizes.
An algorithm that solves all instances of a problem for all data set sizes.
To determine the best route to take on a recent trip, a maps application gave the user three options based on traffic patterns, road construction, and roadways. Choosing the best alternative among the three possible routes is considered which of the following?
Undecidable problem
Heuristic solution
Moore's Law
Algorithmic Bias
A standard deck of playing cards contains 52 cards, with each card being one of four suits: SPADES, HEARTS, CLUBS, and DIAMONDS. Each suit is represented by 13 cards whose values include ACE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, and KING. Consider the following two algorithms that are intended to find the card representing the “TEN of HEARTS” in a randomly shuffled deck and separate it from the other 51 cards in the deck.
Algorithm A
Step 1: Pick up the shuffled deck of cards. Step 2: Look at the topmost card in your hands. Step 3: If the card suit is a HEART, place the card on top of the pile to your left. Step 4: Otherwise, place the card on top of the pile to your right. Step 5: Repeat steps 2 through 4 until you are no longer holding any cards. Step 6: Pick up the cards in the pile to your: left. Step 7: Look at the topmost card in your hands. Step 8: If the card value is TEN, place all other cards in your hands on top of the pile to your right. Step 9: Otherwise, place the card on top of the pile to your right. Step 10: Repeat steps 7 through 9 until you are holding only one card. Step 11: The only card in your hand is the TEN of HEARTS.
Algorithm B
Step 1: Pick up the shuffled deck of cards. Step 2: Look at the topmost card in your hands. Step 3: If the card suit is a HEART or the card's value is a TEN, place all other cards in your hands on top of the pile to your right. Step 4: Otherwise, place the card on top of the pile to your right. Step 5: Repeat steps 2 through 4 until you are holding only one card. Step 6: The only card in your hand is the TEN of HEARTS.
Both Algorithm A and Algorithm B will always work as intended.
Neither Algorithm A nor Algorithm B will ever work as intended.
Only Algorithm A will always work as intended.
Only Algorithm B will always work as intended.
Which of the following is the most important thing to consider when picking the language to be used to turn an algorithm into a computer program?
Some languages should never be used for algorithms.
Some languages should be used for all algorithms.
Some languages are better suited for some algorithms as they have features that simplify the algorithm.
Most languages are hard to read as code is hard to read.
No languages are hard to read as most all read like english.
The following set of instructions represent what kind of flow pattern?
Dump cereal in bowl
Pour milk in bowl
Eat cereal and milk
Place spoon and bowl in dishwasher
Selection
Sequence
Iteration
Sorting
If score starts out as 10 at the beginning of a program, according to the flowchart, what will score be at the end?
11
10
13.5
10.5
Consider constructing an algorithm for a robot that can only perform the following three pre-defined operations.
MOVE_FORWARD(): The robot moves one square forward in the direction it is facing.
ROTATE_LEFT(): The robot rotates in place 90 degrees counterclockwise (i.e., makes an in place left turn).
ROTATE_RIGHT(): The robot rotates in place 90 degrees clockwise (i.e., makes an in-place right turn).
Which of the following algorithms will successfully cause the robot to trace out a square-shaped path, with the robot ending up in its original position and facing in its original direction?
A(n) _______ problem is a decision problem for which an algorithm can be written to produce a correct output for all inputs (e.g., “Is the number even?”).
Laquan is writing a program to calculate the perimeter of a rectangle, based on this formula:
P = 2l + 2w
P=2l+2w
P, equals, 2, l, plus, 2, w
The program starts with this code:
length ← 120
width ← 13
Which lines of code successfully calculate the perimeter?
👁️Note that there may be multiple answers to this question.
Choose all answers that apply:
Choose all answers that apply:
perimeter ← (2length) + (2width)
perimeter ← 2 * length + 2 * width
perimeter ← 2 * (length + 2) * width
perimeter ← 2length + 2width
perimeter ← (2 * length) + (2 * width)
A(n) ______is a collection of program statements that are part of a program
What is the output of the code above?
7
14
3
28
21
Nikki read that it's healthy to take 10,000 steps every day. She's curious how many steps that'd be per minute, walking from 10AM to 10PM, and is writing a program to figure it out.
The program starts with this code:
stepsPerDay ← 10000
hoursAwake ← 12
Which lines of code successfully calculate and store the steps per minute?
👁️Note that there may be multiple answers to this question.
Choose all answers that apply:
Choose all answers that apply:
stepsPerMin <- (stepsPerDay / hoursAwake) / 60
stepsPerMin <- hoursAwake / stepsPerDay / 60
stepsPerMin <- (hoursAwake / stepsPerDay) / 60
stepsPerMin <- stepsPerDay / hoursAwake / 60
stepsPerMin <- stepsPerDay / hoursAwake % 60
_________ should also be added to any blocks of code that may be ambiguous or hard to understand and need further explanation.
data
abstraction
comments
variables
What is output from the code above?
-12
-11.50
-3
11
-10
What is the output?
10
13
12
11
16
A(n) ____ is associated with an action and supplies input data to a program.
_____ is data sent from a program to a device.
What is the output of the code?
A variable
can only be a numeric value.
does not ever change its value.
stores any value that the user has typed.
all of these
none of these
What is the output of the code above?
Do you want flavor1 or flavor2 pie?
Do you want chocolate or cherry pie?
Do you want pie?
Do you want flavor2 or flavor1 pie?
Do you want cherry or chocolate pie?
Data sent to a computer for processing by a program is called ________.
a process
output
input
state
storage
What type of input asks the user for information, provides an avenue for the user to type, called a text box, and waits for the user to type the information?
visual
tactile
text
audio
Combining multiple join blocks allows for ______ several strings of text together with one statement.
What will be displayed?
2 4 6 8
2 4 6
6
7
1 3 5
What is output by the following pseudocode?
set a to -14
repeat 3 times
change a by 12
say a
20
36
12
22
34
How are the statements in a program processed?
from the last statement back to the first
the computer picks statements and executes them in random order
in sequential order from the first statement to the last
none of these
j >= 6
j > 7
j = 7
j = 6
What is output by the following pseudocode?
set d to 100
repeat until d < 71
change d by -7
say d
60
73
86
65
93
What is output by the following pseudocode?
set a to 63
repeat 4 times
change a by -7
say a
56
35
63
49
42
What is output by the code below?
set x to 65
say (x > 30 and x < 90)
90
65
True
30
False
What is output by the following pseudocode?
set c to 1
repeat until c > 49
change c by 8
say c
17
1
57
33
49
What is output by the following pseudocode?
set e to 150
set count to 0
repeat until e < 75
if e > 100
change e by -20
else
change e by -5
change count by 1
say count
5
7
6
9
8
What is ouptut by the following psuedoccode?
set a to 100
if a > 99
say "abc"
say "def"
abcabc
abc
99
abcdef
def
What is output by the code below?
say("left" = "right" OR False = False)
left right False
left
False
True
right
What is output by the following pseudocode?
set f to 1
set g to 0
repeat until f > 16
change g by f
change f by 7
say g
24
25
8
46
1
Convert 7510 to a binary number.
The answer is _____ base 2.
Convert 8410 to binary.
84 = ________
How many outcomes are in a byte?
There are _____ outcomes in a byte.
Convert 4710 to a binary number.
The answer is _____ base 2
How many outcomes are in a nibble? (Hint: a nibble has 4 bits)
A nibble has _____ outcomes.
Convert 1011012 to a decimal based number.
A popular music streaming service keeps count of how many times a certain song is played since the service had started. The counter updates immediately after a song is played. On one occasion, a negative 3 digit number was showing for the total times a certain song was played, while all the others were showing correct. Which selection below best explains what probably occured?
The streaming service software failed to tally the number of songs played due to overuse.
The number for the song's total played was larger than the maximum value assigned to represent that number.
The streaming service software had not been updated properly.
A round-off error occurred when completing the mathematical operation.
Which of the following is an example of a nibble?
10
10110
101
1011
A bit is 1 binary value, a nibble is 4 bits, and 8 bits makes a byte. What is the largest number you can make with a nibble?
decimal: 8; binary: 1000
decimal: 15; binary: 1111
decimal: 16; binary: 1000
decimal: 16; binary: 1111
Select the best description of a binary digit.
Any value from 0-1
Any value from 0-9
An ordered pair, like (3,5)
A series of computer commands.
Convert 0011 10002 to a base ten number.
The answer is _____ base 10
Convert 9310 to a binary number.
The answer is _____ base 2
Blender is a free application for creating 3D computer graphics and animations.
Here's an example of a modeling project:
Screenshot of Blender
Blender is released under the GNU General Public License, an open source license. Here is their website's description of that license:
This license grants people a number of freedoms:
You are free to use Blender, for any purpose
You are free to distribute Blender
You can study how Blender works and change it
You can distribute changed versions of Blender
The GPL strictly aims at protecting these freedoms, requiring everyone to share their modifications when they also share the software in public.
What is an implication of Blender's open source license?
A software engineer can use the Blender codebase to create a slightly modified version of Blender and allow others to legally download it
Students can look at the Blender codebase to learn how to make computer graphics applications, but industry professionals cannot
Any artwork created in the Blender application can be freely used and distributed by anyone
If you create a movie using Blender, you must allow other people to view that movie for free
A programmer is designing a computer program for a weather application that will use a variety of data sources. They want to understand which data sources are analog so that they can think carefully about the process of converting the analog data into digital data.
Which of these data sources is analog? Choose 1 answer:
Thirty seconds of sounds from a thunderstorm in Miami, Florida
Two years of weekly high temperatures for Houston, Texas
The daily time of sunrise and sunset in Detroit, Michigan
The predicted inches of snowfall on a winter day for each city in New York
A math student is writing code to verify their project answers:
sideLength ← 6
area ← (SQRT(3) / 4) * (sideLength * sideLength)
That code relies on a built-in procedure SQRT() that calculates the square root of a number. After running the code, area stores 15.588457268119894.
Their classmates runs the same calculation on their own computer. Their program results in an area of 15.58845726804.
The two values are very close, but not quite the same.
Which of these is the most likely explanation for the difference?
Choose 1 answer:
One computer used an integer representation for the result of SQRT(3) while the other computer used the more accurate floating-point representation.
One of the computers has a bug in its mathematical operations.
One of the computers experienced an integer overflow error when calculating the result.
The two computers executed the arithmetic operations using a different order of operations.
The two computers represent the result of SQRT(3) with a different level of precision, due to their rounding strategy or size limitations.
Convert 10710 to a binary number.
The answer is ______ base 2
TIS-620 is a character encoding that can encode Thai text files. The encoding is based on the ASCII standard but includes mappings for the letters of the Thai alphabet.
This table shows the mapping for five of the letters:
According to TIS-620 , what is the binary encoding of the Thai word "พนา"?
Note that the Thai language is written from left to right, like the English language.
111010010010
101110111101
101011101010100110100010
101001111101001010100001
You're playing around with an old computer that only accepts binary numbers as input.
How would you enter the decimal number 73 into the old computer?
Type the binary number with a space between nibbles and leading zeros.
Nuru writes this code to calculate the final cost of an item with a discount applied:
price ← 0.7
discount ← 0.2
final ← price - discount
They're surprised to see that final stores the value 0.49999999999999994 instead of 0.5.
What is the best explanation for that result?
The arithmetic operations on floating-point numbers resulted in a round-off error.
The computer stored the result with floating-point representation instead of integer representation
The result was too large of a number to be stored in floating-point representation
An integer overflow error occurred.
Convert 15610 to a binary number.
The answer is _____ base 2
Consider a computer that uses 4 bits to represent positive integers and uses all 4 bits to represent the value.
Which of the following operations would result in integer overflow?
👁️Note that there may be multiple answers to this question.
4 × 4
1 + 14
3 x 3
15 + 1
15 x 1
Railways have devices called "axle counters" that count up how many train axles have passed by, and helps decide if a train has fully passed part of a track.
However, because of a bug in the design of the axle counter logic, a train that has exactly 256 axles will result in a count of 0, and its existence will be ignored. Thus, trains that run on these buggy railways must have less than 256 axles.
What is the most likely cause of this bug?
Incorrect use of integer instead of floating-point representation
Integer overflow error
Limited precision of floating-point numbers
Round-off error in floating-point arithmetic
A programmer is writing the code for a sports website that will use a variety of data sources. They want to understand which data sources are analog so that they can think carefully about the process of converting the analog data into digital data.
Which of these data sources is analog?
A list of teams competing in a lacrosse tournament
The final scores of ten basketball games
A swimmer's position in the pool as they swim from one end to the other
The number of players sitting on the bench during a basketball game
Which of the following decimal (base-10) values is equivalent to the binary (base-2) value 101001?
22
37
41
82
The owner of a pet store wants to determine how many fish she can keep in a given aquarium before the population becomes too overcrowded for the fish to survive. Rather than risking the lives of actual fish, she decides to simulate an aquarium with a program in order to determine its maximum capacity. Which of the following would NOT be a useful factor to include when modeling the properties of the simulated tank and fish population?
The amount of food in the tank
The color of the fish
The size of the tank
The size of the fish
What value does the code segment display?
17
36
53
No value is ever displayed because the algorithm repeats the REPEAT UNTIL block indefinitely.
Sometimes we care about the order of a list, and need to reorder the items according to a condition (alphabetical, numerical, etc). An algorithm finds the minimum value in the list and swaps it with the value in the first position, then repeats these steps for the remainder of the list, swapping with the second position, then the third position and so forth. What type of sorting is this?
selection
bubble
insertion
swapping
The procedure check is called in a program after each time a True or False question is answered. If the user types in True True False True as their answers for four questions on a quiz, what should their overall score be?
25%
50%
75%
100%
Assuming that the list newAnimals has the beginning values of beaver cat snake, what would the newAnimals list contain after the following code segment is run?
[eagle, beaver, duck, cat, dog, snake]
[beaver, cat, snake]
[eagle, duck, dog]
[dog]
The list mine is initialized with the values – green, red, blue, purple, yellow, black– and the list yours is initialized with the values – green, red, black, blue. What will be displayed after the following code segment runs?
There are 0 duplicates
There are 2 duplicates
There are 3 duplicates
Partway through, an error message is produced and the program terminates
ASCII is a character-encoding scheme that uses 7 bits (8 bits if you are using the extended ASCII table) to represent each character. The decimal (base 10) values 65 through 90 represent the capital letters A through Z, as shown in the table:
Which ASCII character is represented by the binary (base 2) number 1000001?
A
B
C
D
While running this code segment, the user enters the following values when prompted: pizza yes bread no. What is stored in the list called grocery after the block of code is executed?
[milk, eggs, cheese, pizza, bread]
[milk, pizza, eggs, cheese]
[milk, bread, pizza, eggs, cheese]
[milk, pizza, bread, eggs, cheese]
If the procedure check is supposed to compare the two provided numbers, value1 and value2, what change needs to be made for the procedure to work as intended?
Swap the two DISPLAY blocks
The IF part of the IF/ELSE block should use the symbol ≤ instead of <
Add another IF/ELSE block, nested in the ELSE section to check for equality
Send 3 values to the procedure instead of two
Consider the following:0110 1011 0010 1011
This sequence represents (choose the best option)
a number
data
instructions for the computer
something that depends on the context in which it is used
Using the table given below, determine the ASCII to binary code conversion for the word science.
01110011 01100011 01101001 01101110 01100011 01100101 01100101
01110011 01100011 01101001 01100011 01100101 01101110 01100101
01110011 01100011 01101001 01100101 01101110 01100101 01100011
01110011 01100011 01101001 01100101 01101110 01100011 01100101
What is the binary equivalent to the decimal number of 78?
1100110
1001110
1001100
1110001
The block of code is in a video game to keep track of the name of the high scorer. What needs to be changed in the code so that it works as intended, assuming number is the score of a person at the end of the game, highscore is the previous high score, scoreboard is the list that contains the results and index 1 contains the name of the person that previously scored the high score?
Swap the REMOVE block and the INPUT blocks
Move the INSERT block ahead of the REMOVE block
Change the symbol in the IF condition to ≠
The code works perfectly fine, nothing needs to be changed
Assume that x is 6 at the beginning of the loop. How many times will the loop iterate?
3
0
1
2
What type of programming structure is being used in the section of code marked with an arrow?
Sequence
Algorithm
Selection
Iteration
Which of the following is a programming situation where a fixed-point representation would be a better choice than a floating-point representation? Select two answers:
When adding a feature to a program for how many “lives” a character has on a certain level
When calculating how much of a specific chemical is needed to create a proper reaction in a chemistry class
When providing an approximation of how many miles Point A is from Point B on a map
When creating a program that will calculate how much change you will get from purchasing a particular item at a store
The Special Pets Adoption Agency has hired your programming team to write a program that will keep track of all of the pets they have ever placed into adoption. Each pet is given a classification of type of animal, gender, age and color. What could be a benefit of storing these animals and their classifications as lists in the program you create instead of individual variables?
Select two answers.
Storing the animals and their classifications to lists will allow us to easily sort animals by “type”
A list can never be altered, so therefore the data stored to it cannot be accidentally deleted or changed
We are limited (in our program) to how many unique variables we can create, so by using lists, we are allowing for potentially more animals to be classified
Storing the animals and their classifications to lists will allow us to do a binary search of the animal by age
Which of the following decimal values, when converted to binary (ignore leading zeros) have exactly 3 zeros in them?
Select two answers.
50
20
30
40
Chad has written the majority of his code in Scratch and is ready to start thinking of test cases to make sure that his program functions properly, and when issues arise, fix them. Chad is also going to show his program to his classmate and ask for any feedback or changes he could add to make his program better. This process is known as what?
Program detection
Iterative development process
Debugging
Pseudocode
Which of the below options would be the best set of instructions to give for a program designed in Scratch?
Click on the GREEN flag. Once the game starts, use the arrow keys to navigate your way through the maze. In your travels, collect the “hearts” for more lives and avoid being eaten by zombies.
Make your way through the maze! Avoid the brain-eating zombies and be sure to collect the “hearts” for extra lives. Good Luck!
Dodge zombies, gain lives, all while trying to make it through the maze! Click start to begin your exciting adventure.
Ready, set, RUN!!! Use your skills and intelligence to weave your way through the maze, avoiding obstacles and prove that you’ve got what it takes to survive!
Which of the following would be the most appropriate name for a variable?
time_left
variable1
t
amountOfTimeRemainingInTheGame
Which of the following values is displayed if the user inputs the following list of values for each prompt:
1 2 3 4 5 6 7 8 9 15
3
4
5
6
Assuming that before this code is run, x = 1. What would be displayed at the end?
16
8
1
2^10 (2 to the power of 10)
What is output by the following pseudocode?
set a to 60
repeat 2 times
change a by 10
say a
Lillie is writing a program that calculates geometry formulas.
Her procedure calcDistance should return the distance between two points, based on the Pythagorean distance formula:
This is the code of the procedure with line numbers:
PROCEDURE calcDistance (x1, y1, x2, y2) { xDiff ← x2 - x1 yDiff ← y2 - y1 sum ← POW(xDiff, 2) + POW(yDiff, 2) distance ← SQRT(sum) }
The procedure relies on two provided functions, POW which returns a number raised to an exponent, and SQRT which returns the square root of a number.
This procedure is missing a return statement, however.
RETURN d
RETURN x1
RETURN distance
RETURN SQRT(sum)
What is output by the following code? (Or write the word error , if a problem exists.)
define getChange(cost, paid){
DISPLAY(paid – cost);
}
paid = 5.00;
price = 2.35;
getChange()
The output is
Phoebe is holding a pie eating party and is writing a program to help her determine what ice cream to pair with each pie.
IF (pie = "apple")
{
iceCream ← "caramel"
}
ELSE
{
IF (pie = "razzleberry")
{
iceCream ← "cinnamon"
}
ELSE
{
IF (pie = "peach")
{
iceCream ← "nutmeg"
}
ELSE
{
IF (pie = "plum")
{
iceCream ← "honey"
}
ELSE
{
iceCream ← "vanilla"
}
}
}
}
Which of these tables shows expected values for iceCream after running this program with a variety of values for pie?
Consider the pseudocode segments below. Which statement should be used in place of <missing code> such that the alarm is set to 9:00 am on weekends, and 6:30 am on weekdays.
ask ( What day is it tomorrow?)
day = answer
if ( <missing code> )
setAlarm = 9:00am
else
setAlarm = 6:30am
(day = Saturday) AND (day = Sunday)
(day = Saturday) OR (day = Sunday)
day = Saturday
day = Sunday
NOT (day = Monday)
Which of the following is the output of the code?
Team B
Team C
Team A
Team D
Which of the following can replace the missing statement in the “REPEAT UNTIL” block so that the user will be required to enter the correct password of “swordfish” before they can continue on with the rest of the program?
userPassword = “swordfish”
userPassword ← INPUT
“swordfish”
userPassword ≠ “swordfish”
The output for the code is
Simone is writing a program to report on her daily moods.
Here's her program for the first week:
DISPLAY ("Monday: I feel happy!")
DISPLAY ("(•‿•)")
DISPLAY ("Tuesday: Sigh, annoyed")
DISPLAY ("ಠ_ಠ")
DISPLAY ("Wednesday: Feeling happy again")
DISPLAY ("(•‿•)")
DISPLAY ("Thursday: Kind of confused")
DISPLAY ("(⊙_☉)")
DISPLAY ("Friday: TGIF! Whee!")
DISPLAY ("(•‿•)")
After writing that code, Simone finds a new way to draw the happy face:
DISPLAY ("。◕‿◕。")
How many lines of code will Simone need to update?
Which of the following could be considered part of the beginning “state” of a Scratch program?
Visibility of sprites
The value of a variable
The background image
All of these
define sayStuff() {
DISPLAY("Hello")
}
DISPLAY("World")
sayStuff()
The output for the code above is
What is output by the following pseudocode?
set f to 1
set g to 0
repeat until f > 16
change g by f
change f by 7
say g
24
8
25
46
1
What is output by the code below?
gradeLvl = 9;
IF ( gradeLvl > 8 )
DISPLAY("High School");
IF ( gradeLvl > 5 )
DISPLAY("Middle school");
ELSE
DISPLAY("Elementary school");
Middle School
High School
Elementary School
High School
Elementary School
High School
Middle School
Explore all questions with a free account