100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
APCSP EXAM QUESTIONS AND ANSWERS $11.49   Add to cart

Exam (elaborations)

APCSP EXAM QUESTIONS AND ANSWERS

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

APCSP EXAM QUESTIONS AND ANSWERS...

Preview 2 out of 6  pages

  • October 18, 2024
  • 6
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • apcsp
  • apcsp exam
  • APCSP
  • APCSP
avatar-seller
luzlinkuz
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.

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

Will I be stuck with a subscription?

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

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

80630 documents were sold in the last 30 days

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

Start selling
$11.49
  • (0)
  Add to cart