100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
APCSP AP EXAM Questions & Answers $15.99
Add to cart

Exam (elaborations)

APCSP AP EXAM Questions & Answers

 1 view  0 purchase
  • Course
  • APCSP
  • Institution
  • APCSP

We want to create an algorithm called swapValues. Given two variables x and y the result should have the values of x and y swapped. Which of the following algorithms correctly swaps the values of x and y? y ← x temp ← x x ← y x ← y y ← x temp ← x x ← y y ← temp te...

[Show more]

Preview 4 out of 33  pages

  • January 6, 2025
  • 33
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • apcsp ap exam
  • apcsp
  • APCSP
  • APCSP
avatar-seller
shantelleG
APCSP AP EXAM Questions & Answers
We want to create an algorithm called swapValues. Given two variables x and y the
result should have the values of x and y swapped. Which of the following algorithms
correctly swaps the values of x and y?


y←x
temp ← x
x←y

x←y
y←x

temp ← x
x←y
y ← temp

temp ← x
y ← temp
y ← x - ANSWER temp ← x
x←y
y ← temp

The figure below represents a network of physically linked computers labeled A through
F. A line between two computers indicates that the computers can communicate directly
with each other. Any information sent between two computers that are not directly
connected must go through at least one other computer. For example, information can
be sent directly between computers A and B, but information sent between computers A
and C must go through other computers.

Which of the following statements are true about this network:

I - The network is fault tolerant. If a single connection fails, any two devices can still
communicate.
II - Computers B and F need to first communicate with at least one other device in order
to communicate with each other.


I only


II only

,I and II


Neither I nor II - ANSWER I and II

Computers are often used to search through large sets of data to find useful patterns in
the data.

Which of the following tasks is an example where searching for patterns is needed to
produce useful information?


A high school searching over student GPAs to identify the student with the highest GPA


A grocery store searching over its inventory to determine which items are running low


A music application searching over a user's library to determine if a particular song
exists


An online retail store analyzing customers' viewing habits to suggest other products
based on the purchasing history of other customers - ANSWER An online retail store
analyzing customers' viewing habits to suggest other products based on the purchasing
history of other customers

A bank uses a computer program during the night to tell if the alarm should be rung.
Sensors in the bank set the following Boolean variables:

vaultClosed: set to true if the bank vault is closed; otherwise false
heardNoise: set to true if a microphone heard noise; otherwise false
sawMovement: set to true if a camera saw movement in the bank; otherwise false

The automatic alarm should notify the police if there is noise and movement in the bank,
or if the bank vault is open. Which of the following boolean expressions can be used in
a selection statement to ring the alarm?


NOT vaultClosed OR (heardNoise AND sawMovement)


heardNoise AND vaultClosed


NOT vaultClosed AND sawMovement

,heardNoise AND sawMovement - ANSWER NOT vaultClosed OR (heardNoise AND
sawMovement)

Consider the code segment below.

PROCEDURE Mystery (word, list)
{
FOR EACH item IN list
{
IF (item = word)
{
RETURN (true)
}
}
RETURN (false)
}
Which of the following best describes the behavior of the Mystery PROCEDURE?


Return whether or not word is in list


Return the index of word in list


Display true for each occurrence of word in list


Display the index of word in list - ANSWER Return whether or not word is in list

Biologists are researching the migration patterns of birds. They have attached tracking
collars to several wild birds.

For each bird, the following geolocation data is collected at frequent intervals.

The time
The date
The location of the bird
Which of the following questions about the group of tracked birds COULD be answered
using only the data collected from the tracking collars?


How many new birds were born into the group during the month of July?

, In what month do the birds tend to travel the farthest?


Do the migration patterns of the birds vary according to weather?


What is the most common cause of death for this group of birds?q - ANSWER

A program is expressed in a programming language. Which of the following is true of
the program?


The program can also be expressed as binary code, but this increases the likelihood of
errors


The program can also be expressed as binary code, which is what the program will be
translated to in order to execute on the computer


The program cannot be expressed as binary code


Which of the following statements are true about using a high-level programming
language instead of a lower-level language?

I - Some algorithms can only be expressed in low-level languages, and cannot be
expressed in any high-level languages
II - Code in a high-level language is often translated into code in a lower-level language
to be executed on a computer


I only


II only


I and II


Neither I nor II - ANSWER II only

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

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

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

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 shantelleG. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $15.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

50990 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 15 years now

Start selling
$15.99
  • (0)
Add to cart
Added