Comp Sci Principles Semester 1 Final Exam with 100%
Correct Solutions 2024-2025
(open the link for diagrams)
Below is a circuit that involves two logic gates, one identified as an OR gate and the
other identified as an AND gate. Each of the gates takes two inputs and gives just one
output.
Which of the following bits of code would send the robot to the grey square following the
path above represented by the arrows?
C.
The following question includes a simple robot operating in a grid of squares. It is
represented as a triangle within the middle square, oriented towards the top of the grid.
A grayed square shows one possible ending position of the robot after the code
segment is executed. Which of the following illustrates all the possible ending locations
for the robot?
B.
The following grid has a robot which is an triangle and is initially facing to right.
The following code snippet is suppose to move the robot into the gray square.
<MISSING STATEMENT>
{
REPEAT 4 TIMES
{
,MOVE_FORWARD()
ROTATE_RIGHT()
}
ROTATE_LEFT()
MOVE_FORWARD()
ROTATE_RIGHT()
}
Which of the following could be inserted for <MISSING STATEMENT> so that the code
snippet works correctly?
B. REPEAT 2 TIMES
We have a sorted list of numbers containing 200 elements.
Which of the following is closest to the maximum number of list elements that must be
examined when performing a binary search for a particular value in the list?
B. 8
A video game character can face toward one of four directions: north, south, east, and
west. Each direction is stored in memory as a sequence of four bits. A new version of
the game is created in which the character can face toward one of eight directions by
adding northwest, northeast, southwest, and southeast to the original four possibilities.
Which of the following statements is true about how the eight directions must be stored
in memory?
D. The eight directions can be represented using four bits.
Consider the following program.
, Of the following, which best describes what the above program prints out?
B. The program above prints the sum of all even integers from 2 to 20.
For which of the following applications would you most want to use lossy compression
rather than lossless compression?
C. A smartphone can store a certain amount of music files. The goal is to maximize the
number of songs the phone will hold.
A student is creating an algorithm that demonstrates the distance between two
numbers, num1 and num2, on a number line. The table below shows the distances for
several different values.
Which of the following algorithms demonstrates the correct distance for all possible
values of num1 and num2?
B.
Step 1:
Take num2 - num1 and put the result in variable diff.
Step 2:
Take the abs of the value diff and print that value.
From this procedure the argument Let x be an integer .
Which of the following best describes what the procedure does?
C. It prints true if x is less than zero and it prints nothing if otherwise.
ASCII is a character-encoding scheme. It uses 7 bits to represent each character. In
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller Stetson. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $9.99. You're not tied to anything after your purchase.