Font size
WorksheetsSem 1 MKPD 3 - T: AP CSP Unit 1 Test (UTeach)
Total questions: 22
Worksheet time: 12mins
Consider the following two algorithms for determining the tallest person in a group.
Algorithm A
Step 1: Everybody stands and lines up against the wall.
Step 2: One person from those who are standing steps forward.
Step 3: One person from those who are standing steps forward.
Step 4: The shorter of these two people who stepped forward sits down.
Step 5: Repeat steps 3 and 4 until only one person is standing.
Step 6: The last person standing is the tallest in the group.
Algorithm B
Step 1: Everybody stands and lines up against the wall.
Step 2: Each standing person pairs up with one other standing person.
Step 3: The shorter member of each pair sits down.
Step 4: Repeat steps 2 and 3 until only one person is standing.
Step 5: The last person standing is the tallest in the group.
Which of the following statements about these two algorithms is true when applied to a group of 32 people?
Algorithm A is never faster than Algorithm B
Algorithm A is rarely faster than Algorithm B
Algorithm A is usually faster than Algorithm B
Algorithm A is always faster than Algorithm B
. Which of the following is a key factor in determining the efficiency of an algorithm?
The machine on which the algorithm is running
The length of the algorithm
The required number of computations required in the algorithm
The amount of computational resources used by the algorithm and the number of times a statement or group of statement executes
Which of the following types of languages is optimized for machine processing and maybe written and expressed as a series of binary digits (e.g., ones and zeros), making it difficult for humans to read and write?
Natural language
Pseudocode
High-level programming language
Low-level programming language – machine language
The local government for a newly developed community would like to begin conducting an annual census to make an accurate count of its current population and gather other relevant demographic information about its residents. The community is currently relatively small and consists of around 500 homes. However, it is growing quickly and expects to have more than 100,000 homes in the next few years.
Which of the following plans would be the most practical and most efficient solution for computing an accurate population count, no matter how large the community grows?
Hire one person to go door-to-door conducting the census. This person will visit
all of the homes in the community once each year.
Hire 100 people to go door-to-door conducting the census. Each of these people
will visit 1% of the homes in the community once each year.
Every year, mail a copy of the census form to every home in the community and
require that each household complete the form themselves and mail it back to a
central office for processing. Then follow up with those that did not.
Conduct the census once for only 100 homes and then estimate the annual
population for all later years based on the relative increase in the number of homes.
Using a Vigenere Cipher with a keyphrase code of BEG, decipher the given hidden message:
kirmc hfet
happy days
knives jump
jelly bean
jumpy jack
Using a Caesar Cipher with an offset of 13, decode the following ciphertext back to plaintext:
znyjner
malware
viruses
cyphers
scratch
Using a Caesar cipher of shift -3, encode the following message:
elevens bench
bibsbkp ybkze
hohyhqv ehqfk
elevens bench
None of the above
According to Moore’s Law, increases in technological performance should approximately double every year. If this holds true, how much can performance be expected to increase over 5 years?
10 times as much
100 times as much
32 times as much
16 times as much
Algorithmic bias exists due to the following:
no concerted effort was made to eliminate it
programmers may intentionally or unintentionally code with personal bias
data sets used exclude certain groups
all of the above
Every task that you deal with on a day-to-day basis, no matter how large or small, requires that you perform a specific set of actions and make a particular set of decisions in very precise ways. These sets of actions and decisions are known as what?
Abstraction
Algorithms
Building Blocks
Processes
A computer programming student has a great idea to correctly calculate the total cost of tickets for a family at a football game. He designs a program that successfully outputs how much money it costs a family of adults and children to attend the game. Adults cost $7 and children cost $3. The program simply asks the family how many adults there are attending and how many children.
Based on those two inputs, with some multiplication and addition, the program then outputs the answer.
- How would we classify how this program scales as the family size increases?
Constant
Logarithmic
Linear
Quadratic
What type of language is used in the below algorithm?
Prompt user for number
if number is greater than or equal to 0
Output “Positive”
else
Output “Negative”
Repeat 4 times
Natural language
Low-level language
High-level language
Pseudocode
An algorithm was developed to keep track of how many baskets a student has made while playing basketball. Which of the following program structures must be added to the old algorithm to create a new algorithm that only keeps track of 3 pt. baskets and not 2 pt. baskets
Iteration
Searching
Sequencing
Selection
Under which of the following conditions is it most beneficial to use a heuristic approach to solve a problem?
When the problem can be solved in a reasonable time and an approximate solution is acceptable
When the problem can be solved in a reasonable time and an exact solution is needed.
When the problem cannot be solved in a reasonable time and an exact solution is needed.
When the problem cannot be solved in a reasonable time and an approximate solution is acceptable
Which of the following is NOT true about high level programming languages?
Select two answers:
Easy for humans to read, write and parse
It is guaranteed to be ambiguous
Easy for machines to parse
All languages are the same in terms of expressing different algorithms
Which of the following algorithms require both selection and iteration?
Select two answers:
An algorithm that, given two integers, displays the greater of the two integers.
An algorithm that, given a list of integers, displays the number of even integers in
the list.
An algorithm that, given a list of integers, displays only the negative integers in
the list.
An algorithm that, given a list of integers, displays the sum of the integers in the
list.
The algorithm below simulates rolling a regular 6-sided die twice. Consider the goal of determining if the sum of the values of the two rolls is odd or even.
Step 1: Using a random number generator, get a value between 1 - 6 inclusively
Step 2: Remember that number
Step 3: Repeat steps 1 and 2
Step 4: Add the two remembered numbers together
Step 5: Divide that sum by 2
What conclusions can be made with regard to what we are trying to determine?
Select two answers:
If the value found in (step 5) is a 1, 3 or 5 then the sum is odd
If the value found in (step 5) is a 1, 2, 3, 4, 5 or 6 then the sum is even
If the value found in (step 5) has a decimal, then the sum is odd
If the value found in (step 5) is a 2, 4, 6, 8, 10 or 12 then the sum is even
In the designing phase of the Development Process, investigation is needed in order to determine a program’s requirements, identify constraints as well as concerns and interest of the people who will use the program. Which of the following are ways to investigate?
Select two answers:
Collecting data through surveys
Creating the program
User testing
Designing the user interface
The table below shows the time a computer system takes to complete a specified task on the customer data of different-sized companies.
Based on the information in the table, which of the following tasks is likely to take the longest amount of time when scaled up for a very large company of approximately 100,000 customers?
Backing up data
Deleting entries from data
Searching through data
Sorting data
. Let a = 10, b = 5 and c = 7. Based on the flowchart below, in what order will the values be outputted at the end of the flowchart?
10, 5, 7
7, 10, 5
10, 7, 5
5, 7, 10
What kind of flow pattern is represented by this portion of a larger flowchart?
Sequence
Selection
Iteration
Sorting
This question references a robot in a grid of squares. The robot is represented by the triangle in the bottom left-hand corner and is facing toward the top.
Based on the following algorithm, what would the robot’s final position be?
Step 1: MOVE_FORWARD
Step 2: MOVE_FORWARD
Step 3: IF (CAN_MOVE(right))
Step 4: ROTATE_RIGHT
Step 5: MOVE_FORWARD
Step 6: MOVE_FORWARD
Step 7: IF (CAN_MOVE(left))
Step 8: ROTATE_LEFT
Step 9: MOVE_FORWARD
Step 10: ROTATE_LEFT
