AP Computer Science Principe’s AP Exam #1 (Practice Questions) BETTER VERSION with correct Answers
Which of the following expressions represents the value stored in the variable x as a result of executing the program?
C: 2 3 3 3 3
A small team of wildlife researchers is working on a project that uses motion-activated field cameras to capture images of animals at study sites. The team is considering using
a "citizen science" approach to analyze the images. Which of the following best explains
why such an approach is considered useful for this project?
D: The image analysis is likely to take a longer time for the research team than for a distributed group of individuals.
An algorithm is intended to display the following output.
{red red blue red red blue red red blue}
Which of the following code segments can be used to display the intended output?
C:
In a certain computer program, two positive integers are added together, resulting in an overflow error. Which of the following best explains why the error occurs?
C: The program can only use a fixed number of bits to represent integers; the computed
sum is greater than the maximum representable value.
The diagram below shows a circuit composed of three logic gates. Each gate takes two inputs and produces a single output.
C: A = false, B = true, C = true, D = true The question below uses a robot in a grid of squares. The robot is represented as a triangle, which is initially in the bottom left square of the grid and facing right.
The following programs are each intended to move the robot to the gray square. Program II uses the procedure GoalReached, which returns true if the robot is in the gray square and returns false otherwise.
Which of the following statements best describes the correctness of the programs?
C: Both program I and program II correctly move the robot to the gray square.
Flight simulation software, which imitates the experience of flying, is often used to train airline pilots. Which of the following is LEAST likely to be an advantage of using flight simulation software for this purpose?
C: Flight simulation software provides a more realistic experience for pilots than actual training flights.
Which of the following actions are generally helpful in program development?
Consulting potential users of the program to identify their concerns
Writing and testing small code segments before adding them to the program
Collaborating with other individuals when developing a large program
D: I, II, and III
An Internet user has a need to send private data to another user. Which of the following provides the most security when transmitting private data?
C: Sending the data using public-key encryption
A programmer is creating an algorithm to display the cost of a ticket based on the information in the table. The programmer uses the integer variable age for the age of the ticket recipient. The Boolean variable includesTour is true when the ticket is for a guided tour and is false when the ticket is for general admission.
Which of the following code segments correctly displays the cost of a ticket?
B: cost ← 6
IF (age > 12)
{
cost ← cost + 2
}
IF (includesTour)
{
cost ← cost + 2 }
DISPLAY (cost)
A color in a computing application is represented by an RGB triplet that describes the amount of red, green, and blue, respectively, used to create the desired color. A selection of colors and their corresponding RGB triplets are shown in the following table.
Each value is represented in decimal (base 10).
According to information in the table, what color is represented by the binary RGB triplet
(11111111, 11111111, 11110000)?
A: Ivory
A color in a computing application is represented by an RGB triplet that describes the amount of red, green, and blue, respectively, used to create the desired color. A selection of colors and their corresponding RGB triplets are shown in the following table.
Each value is represented in decimal (base 10).
What is the binary RGB triplet for the color indigo?
C: (01001011, 00000000, 10000010)
A library system contains information for each book that was borrowed. Each time a person borrows or returns a book from the library, the following information is recorded in a database.
-Name and the unique ID number of the person who was borrowing the book
-Author, title, and the unique ID number of the book that was borrowed
-Date that the book was borrowed
-Date that the book was due to be returned
-Date that the book was returned (or 0 if the book has not been returned yet)
Which of the following CANNOT be determined from the information collected by the system?
B: The total number of books that were never borrowed in a given year
The following algorithm is intended to take a positive integer as input and display its individual digits in order from right to left. For example, if the input is 512, the algorithm should produce the output 2 1 5. Step 3 of the algorithm is missing.
Step 1: Input a positive integer from the user and store it in the variable number.
Step 2: Divide number by 10 and record the integer quotient and the remainder. The integer quotient is the quotient with any part after the decimal point dropped. For example, when 127 is divided by 10, the quotient is 12.7, the integer quotient is 12 and the remainder is 7.
Step 3: (missing step)
Step 4: Repeat steps 2 and 3 until number is 0.
Which of the following can be used as step 3 so that the algorithm works as intended?
B: Step 3: Display the remainder of number divided by 10 and store the integer quotient in number.
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 millyphilip. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $12.49. You're not tied to anything after your purchase.