Professional Documents
Culture Documents
CSP Study Guide 99
CSP Study Guide 99
verflow error: Error that results when the numberof bits is not enough to represent the
o
number (like a car’s odometer “rolling over”).Learnmore inNumber limits, overflow, and
round-off.
r oundoff: Error that results when the number of bitsis not enough to represent the
number with full precision (like using 3 digits to represent as 3.14).Learn more inNumber
limits, overflow, and roundoff.
nalog data: Values that change smoothly, rather thanin discrete intervals, over time. For
a
example, the pitch and volume of a live concert.Learnmore fromanalog to digital data.
l ossless: Compressing data in a way that preservesall data away and allows full recovery
of the original.Learn more inData compression.
l ossy: Compressing data in a way that discards somedata and makes it impossible to
recover the original.Learn more inData compression.
metadata: Data about data, like descriptive informationabout a file or a row in a database.
i teration: The repetition of steps in an algorithmor program for a certain amount of times
or until a certain condition is met.Learn more inThe building blocks of algorithmsand
Repetition.
l inear search: An algorithm that iterates througheach item in a list until it finds the target
value.Learn more inMeasuring an algorithm's efficiency.
inary search: An algorithm that searches asortedlist for a value by repeatedly splitting
b
the list in half.Learn more inMeasuring an algorithm'sefficiency.
r easonable time: A run time for an algorithm thatdoesn't increase faster than a
polynomial function of the input size (like etc). An unreasonable run time would increase
superpolynomial (like or).Learn more inCategorizingrun time efficiency.
euristic: A technique that helps an algorithm finda good solution in a hard problem (like
h
always walking toward the north star when you are stuck in a forest).Learn more inUsing
heuristics.
ndecidable: A problem that is so logically difficult,we can’t ever create an algorithm that
u
would be able to answer "yes or "no" for all inputs (like the halting problem).Learn more in
Undecidable problems.
andwidth: The maximum amount of data that can besent in a fixed period of time over a
b
network connection, typically measured in bits per second.Learn more inBit rate,
bandwidth, and latency.
rotocol: An agreed upon set of rules that specifythe behavior of a system.Learn more in
p
Open protocol development
.
s calability: The ability of a system to adjust scaleto meet new demands.Learn more in
Scalable systems.
orld Wide Web: A system of linked pages, media, andfiles, browsable over HTTP.Learn
W
more inThe World Wide Web
.
TTP (Hypertext Transfer Protocol): The protocol thatpowers the Web, used to request
H
web pages from servers and submit form data to servers.Learn more inHypertext Transfer
Protocol.
arallel computing: A computational model which splitsa program into multiple tasks,
p
some of which can be executed simultaneously.Learnmore inParallel computing.
c rowdsourcing: A model in which many online userscombine efforts to help fund projects,
generate ideas, or create goods or services (like Wikipedia).Learn more inCrowdsourcing
innovations.
c itizen science: Crowdsourcing for science! The participation of volunteers from the
public in a scientific research project (like collecting rain samples or counting butterflies).
Learn more inCitizen science.
pen access: A policy that allows people to have accessto documents (like research
o
papers) for reading or data (like government datasets) for analysis.Learn more inSharing
science research online.
s ymmetric encryption: A technique for encrypting datawhere the same key is used to
both encrypt and decrypt data.Learn more inSymmetricencryption techniques.
ublic key encryption: An asymmetric encryption techniquethat uses different keys for
p
encrypting versus decrypting data.Learn more inPublickey encryption.
c ookie: A small amount of text that tracks informationabout a user visiting a website.
Learn more inWeb cookies.
irus: A type of computer malware that can make copiesof itself.Learn more inComputer
v
malware.
hishing: An attack where a user is tricked into revealing private information, often via a
p
deceptive email.Learn more inPhishing attacks.
r ogue access point: A wireless access point that providesan attacker with unauthorized
access to the traffic going over the network.Learnmore inRogue access points.
● Evaluates
expressionand assigns the result to thevariable
a.
📝
● Practice:Storing data in variables
DISPLAY (expression)
📝
● Practice:Programming basics
INPUT ()
📝
● Practice:Mathematical expressions
a MOD b
📝
● Practice:Mathematical expressions
RANDOM(a, b)
📝
● Practice:Random numbers
● The relational operators, =, ≠, >, <, ≥, and ≤ are used to test the
relationship between two expressions, variables, or values.
📝
● Practice:Conditionals with if, else, and Booleans
NOT condition
● Evaluates to
trueif
conditionis ; otherwise evaluates to
false
.
false
📝
● Practice:Compound Booleans with logical operators
📝
● Practice:Compound Booleans with logical operators
condition1 OR condition2
or if both
condition1and
condition2are true; otherwise
evaluates to false.
📝
● Practice:Compound Booleans with logical operators
Selection
IF (<condition>) { <block of statements> }
expression
conditionevaluates to ; no actionis taken if
true
conditionevaluates to false.
📝
● Practice:Conditionals with if, else, and Booleans
IF (<condition>) { <first block of statements> }
ELSE { <second block of statements> }
Boolean expression
conditionevaluates to ; otherwisethe
true
code in
second block of statementsis executed.
📝
● Practice:Conditionals with if, else, and Booleans,Nested
conditionals
Iteration
**
REPEAT n TIMES { <block of statements> }
**
📝
● Practice:Numbered repetition of instructions
**
REPEAT UNTIL (condition) { <block of statements>
}
**
expression
conditionevaluates to .
true
📝
● Practice:Conditional repetition of instructions
List operations
For all list operations, if a list index is less than 1 or greater than the length of
the list, an error message is produced and the program terminates.
list[i]
list[i] ← list[j]
📝
● Practice:Storing and updating lists
, respectively.
list[3]
📝
● Practice:Storing and updating lists
sequentially, in order from the first element to the last element. The
code in
block of statementsis executed once for each
assignment of item.
📝
● Practice:Iterating over lists with loops
index
iin .
list
📝
● Practice:Storing and updating lists
APPEND(list, value)
of .
list
📝
● Practice:Storing and updating lists
REMOVE(list, i)
📝
● Practice:Storing and updating lists
LENGTH(list)
● Evaluates to the number of elements in list.
Procedures
**
PROCEDURE name (parameter1, parameter2, ...) {
<instructions> }
**
**
PROCEDURE name (parameter1, parameter2, ...) {
<instructions> RETURN (expression) }
**
If the robot attempts to move to a square that is not open or is beyond the
edge of the grid, the robot will stay in its current location and the program will
terminate.
MOVE_FORWARD ()
● The robot moves one square forward in the direction it is facing.
ROTATE_LEFT ()
● The robot rotates in place 90 degrees counterclockwise (i.e. makes an
in-place left turn).
ROTATE_RIGHT ()
● The robot rotates in place 90 degrees clockwise (i.e. makes an in-place
right turn).
CAN_MOVE (direction)
or .
backward
Section II: Create Performance Task
30% of score
On the end-of-course exam, you will respond to two questions related to the code in
your Personalized Project Reference. The two questions include four distinct prompts:
Written Response 1, Written Response 2(a), Written Response 2(b), and Written
Response 2(c). You will have access to your Personalized Project Reference while
responding to these prompts. The four categories listed below align to the four
prompts.
C
● RD-2.I.a: Identify the error.
● CRD-2.I.b: Correct the error.
● CRD-2.J: Identify inputs and corresponding
expected outputs or behaviors that can be
used to check the correctness of an
algorithm or program.
There are many differences between the AP CSP pseudocode and the
JavaScript language syntax.
Assignment
a ← expression var a = expression;
Equality a = b
a == b
Inequality a ≠ b
a != b
REPEAT UNTIL
Repetition while (condition)
(condition)
list[1]is first
List index list[0]is first item
item
List FOR EACH item
for (var i = 0; i <
iteration IN list
list.length; i++)