100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

APCSP EXAM QUESTIONS AND ANSWERS

Rating
-
Sold
-
Pages
6
Grade
A+
Uploaded on
18-10-2024
Written in
2024/2025

APCSP EXAM QUESTIONS AND ANSWERS...

Institution
APCSP
Course
APCSP









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
APCSP
Course
APCSP

Document information

Uploaded on
October 18, 2024
Number of pages
6
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

APCSP EXAM QUESTIONS AND
ANSWERS

Consider the code fragment shown below.

From temp to x, then x to y.

y ← temperature
Based on the code snippet, how would you best describe what the program is
doing with variables x and y? - ANSWER The program swaps the values of x
and y.

Consider the code fragment shown below.

DISPLAY: "What is your name?" name ↑ INPUT () DISPLAY ("Hello").
Display (name)
What happens if the user types "Karel" into the program? - ANSWER What's
your name? Hello, Karel.

Consider the code fragment shown below.

PROCEDURE: Mystery (number) { RETURN ((number MOD 2) = 0) }
Which of the following most accurately defines the Mystery PROCEDURE's
behaviour? - ANSWER Returns whether an integer is even.

The starting values of a and b in the program below are 0 and 1, respectively.

IF (b = 0)
{ IF (b = 1) { DISPLAY ("Karel") } `
ELSE
{ IF (a = 1) { DISPLAY ("Tracy") }
ELSE
{ DISPLAY ("Dog") } DISPLAY ("Turtle")
What appears as a result of executing this program? - ANSWER: Dog Turtle

, Consider the code fragment shown below.

PROCEDURE Mystery (number) { DISPLAY ("WOW").
REPEAT NUMBER OF TIMES { DISPLAY ("!") } `
What happens when you call the Mystery procedure with an input of 3? -
ANSWER: WOW!!

Consider the code fragment shown below.

X = RANDOM (1, 10)
Y = RANDOM (10, 20)
DISPLAY (x=y)
Which of the following most accurately reflects the code's behavior? -
ANSWER The software may display either true or false.

Consider the code fragment shown below.

PROCEDURE: Mystery (word, list).
{ For each item in the list.
{ IF (item = word) { RETURN (true) } } RETURN (false) `
Which of the following most accurately defines the Mystery PROCEDURE's
behavior? - ANSWER Return whether a word is in the list.

Consider the code fragment shown below.

PROCEDURE: Mystery (word, list).
{` x ← 0 y ← 0 FOR EACH ITEM IN LIST { IF (item = word) { x ← x + 1 }
ELSE { x ← 0 }

IF (x > y)
{y←x}}
RETURN (y);
What is the value of?

Mystery("karel"); ["karel", "karel", "tracy", "karel", "karel", "karel", "tracy"] -
Answer three.

Consider the code fragment shown below.

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
luzlinkuz Chamberlain University
View profile
Follow You need to be logged in order to follow users or courses
Sold
1427
Member since
4 year
Number of followers
849
Documents
27650
Last sold
2 days ago

3.7

303 reviews

5
131
4
61
3
54
2
17
1
40

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions