100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
APCSP 2 Questions and Answers £10.89
Add to cart

Exam (elaborations)

APCSP 2 Questions and Answers

 2 views  0 purchase
  • Module
  • PTS
  • Institution
  • PTS

APCSP 2 Questions and Answers Using the flowchart below, what value when entered for Y will generate a mathematical error and prevent our flowchart from being completely executed? None of these values will produce a mathematical error In a flowchart, a typical decision symbol has what type...

[Show more]

Preview 2 out of 13  pages

  • January 4, 2025
  • 13
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • PTS
  • PTS
avatar-seller
APCSP 2 Questions and Answers
Using the flowchart below, what value when entered for Y will generate a mathematical
error and prevent our flowchart from being completely executed? - answer None of
these values will produce a mathematical error

In a flowchart, a typical decision symbol has what type of output? - answer boolean
(true/false)

Which is NOT true about comments in programs? - answer All published programs
have their comments available.

Which of the following best describes the type of language used in the below algorithm?
Prompt user for number if number is greater than or equal to 0 Output "Positive" else
Output "Negative" Repeat 4 times - answer Pseudocode

Consider the given code using variables a, b, and c. What will be the output of this
code?

a ← 2 b ← 6 c ← 12 a ← b b ← c DISPLAY(a) DISPLAY(c) - answer 6 12

Consider the following code:

n ← 4 x ← -2.5 IF(n < 3) { DISPLAY("Team A") } ELSE { IF(n < 2) { DISPLAY("Team B")
} ELSE { IF(x > -2) { DISPLAY("Team C") } ELSE { DISPLAY("Team D") } } } - answer
Team D

Sam and Emma are creating a multiplayer tic-tac-toe game. Below is a segment of their
code that is used so that the Sprite on screen can tell the user whose turn it is.

Before each user's turn, this set of code is run. What would condition 1 need to be so
that this part of the program runs correctly? The variable turn is initialized as 0 at the
start and player 1 always goes first. - answer turn MOD 2 = 1

A student developed a program that outputs the name of a fruit that begins with a letter,
dependent upon the variable keyPressed, which stores the letter (from A to Z only) a
user types on the keyboard. Below is a section of code from her program:

Which of the following descriptions below would be a way that this student might have
written the rest of her code so that it executes as intended? Select two answers. -
answer Use 25 nested IF/ELSE blocks where the IF portion is formatted like the
code segment above (changing the letters of the alphabet and fruits) and the else
simply holding the next IF portion until the last ELSE, which displays a fruit that begins
with Z.

, Use 26 IF blocks formatted similarly to the one above (changing the letters of the
alphabet and fruits).

The following program segment is intended to move a robot from the starting position to
the ending position as shown above. However, the program segment does not work
correctly.
Line 1: MOVE_FORWARD () Line 2: MOVE_FORWARD () Line 3: IF(CAN_MOVE
(right)) Line 4: { Line 5: MOVE_FORWARD () Line 6: MOVE_FORWARD () Line 7:
ROTATE_RIGHT () Line 8: } Line 9: ROTATE_LEFT () Line 10: ROTATE_LEFT ()

Which 2 lines of code in the segment above must be switched in order for the program
to correctly move a robot from the starting position to the ending position? Select two
answers. - answer Line 7
Line 5

Consider the code segment below.

Line 1: IF (b ≠ 0) Line 2: { Line 3: a ← a/b Line 4: } Line 5: ELSE Line 6: { Line 7: a ←
a*b Line 8: }

Which of the following changes will NOT affect the results when the code segment is
executed? - answer Changing line 7 to a ← 0

Which of the following is used in the instructions below to determine how the task of
"having breakfast" will be performed?
Dump cereal in bowl Pour milk in bowl Eat cereal and milk Place spoon and bowl in
dishwasher
Sequencing
Selection
Iteration - answer I only

Consider the following code segments designed to find the area of a triangle using the
formula A = ½ bh.
Program A
Program B
Which of the following statements about the above programs is true? - answer Both
programs will work as intended, but Program B is more readable.

What will be displayed when the code segment below, using the variables a, b, and c, is
run? - answer 20

Consider the following code segment that is intended to accept two integers, x and y, as
input, and then display "yes" if and only if x is greater than y and y is less than or equal
to 20. Otherwise, it should display "no".

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

Will I be stuck with a subscription?

No, you only buy these notes for £10.89. 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 revision notes and other study material for 15 years now

Start selling
£10.89
  • (0)
Add to cart
Added