Main content
Course: AP®︎/College Computer Science Principles > Unit 9
Lesson 2: Learn AP CSP exam pseudocodeAP CSP pseudocode vs. JavaScript
Since AP CS Principles is taught with a variety of programming languages, the AP CSP exam questions use a pseudocode that represents fundamental programming concepts.
You can see the full pseudocode reference online here or on page 205 of the College Board AP CSP exam description.
There are many differences between the AP CSP pseudocode and the JavaScript language syntax.
This table highlights the biggest differences:
Concept | Pseudocode | JavaScript |
---|---|---|
Assignment | a ← expression | var a = expression; |
Equality | a = b | a == b |
Inequality | a ≠ b | a != b |
Repetition | REPEAT n TIMES | for (var i = 0; i < n; i++) |
Repetition | REPEAT UNTIL (condition) | while (condition) |
List index | list[1] is first item | list[0] is first item |
List iteration | FOR EACH item IN list | for (var i = 0; i < list.length; i++) |
To make sure you understand the pseudocode, practice using it in the exercises from our Programming and Algorithms units.
Want to join the conversation?
- when will there be a full moon?(5 votes)
- Friday, May 5,12:34pm CST(5 votes)
- Shouldn't Repetition be while (!condition) in JS(3 votes)
- A
while
loop is run while the provided condition is true. However, if your condition describes the criteria for ending thewhile
loop, thenwhile (!condition)
would be fitting, like you say.(5 votes)
- explain three differences between Pseudocode and JavaScript language syntax.(1 vote)
- Pseudo code is for readability, JavaScript is for actual programming.
JavaScript is more strict about syntax while pseudocode, because it doesn’t run, doesn’t give a f.
Indexes in Js start at 0 while pseudocode starts at 1(1 vote)
- I like mc donalds(0 votes)