Upgrade to remove ads
AP CSP Unit 3 Test
Terms in this set (37)
defines a sequence of steps for solving a problem computationally.
-hides details so programmers can concentrate on problem solving
- allows programmers to think about problems at a much higher level
- breaking big problems down into smaller, easier-to-understand problems (sometimes multiple times)
- solve the smaller problems then combine them together to solve the big problem
- once we write a program to solve a problem, we can use it (or tweak it) to solve other similar problems
Machine Language (aka Machine Code)
Composed of only 1s and 0s (binary)
Extremely difficult to code
Can manipulate computer memory directly
High-Level Language (aka Problem-Solving Language)
Pre-defined operations ("puzzle pieces") that can be combined to solve a problem (visual languages)
English-like words or symbols are used in the code (textual languages)
Code is far easier and understandable
Allow us to concentrate on the problem without worrying about specifics of a particular computer or operating system
-May be visual or textual
-Not processable directly by any particular computer or CPU
-Allows us to think about algorithm implementation without worrying about details of a particular language (abstraction)
Procedures and Functions
-Allow commonly used operations to be consolidated into a single routine
-Allow programmers to define their own complex operations that can be called as a single command (abstraction)
-Reduce clutter in a program and allow for easier modification if programming requirements change
-Can optionally accept parameters, which provide additional info or data that the procedure needs
- are used when a specific calculation or result must be returned-
Boolean, number, string, list
holds a bi-state value - true / false, yes / no, 1 / 0, on / off, etc
holds a numerical quantity (integer or real)
-(Text) holds a sequence of characters which may be empty (no characters) or any non-zero length
-Characters are encoded as binary numbers using ASCII (128 characters, numbered 0-127)
-Each upper case, lower case, digit, and punctuation symbol has a unique code (numbers do not represent themselves)
is a collection of items of (possibly) different types, including other lists (i.e. a "list-of-lists")
Booleans and Numbers are considered
primitive types (fits into single memory location)
create a list
initializes a list with values
list ← [value1, value2, value3]
add items to list
- appends individual items to the end of a list
APPEND (list, value)
- insert items in a specific location
INSERT (list, i, value)
length of list
number of items currently in the list
select list item
gets an item from a list (must know item index ahead of time)
list[ i ]
remove list item
deletes an item from a list (must know item index ahead of time)
REMOVE ( list, i )
Algorithms can be combined
to create other algorithms
Algorithms can be expressed in
natural language (i.e. English-like statements), pseudo-language, or visual or textual languages. Flowcharts are commonly used to visualize algorithms
Always takes the same amount of time regardless of how many items (rare!) (reasonable)
Eliminates half the data at each step (Binary Search, Guess-A-Number game) (reasonable)
Double data size doubles running time, triple data size triples running time, etc (Sequential Search) (reasonable)
2x data size increases time by 4x, 3x data size increases time by 9x, etc (simple sorting algorithms) (reasonable)
Small increases in the data size causes time to double (Unreasonable)
allow us to arrive at an approximate solution by making an educated guess. Can sometimes provide a computational solution for an algorithm that is otherwise Undecidable or would require Unreasonable time. Examples - "find the best", "find the smallest" (what is the exact metric that is used to determine "best" or "smallest"?)
problems can be answered with a simple yes/no answer
algorithms are characterized by eliminating half the remaining data on each pass. Such algorithms always exhibit logarithmic performance.
= Are the values equal?
≠ Are the values unequal?
> Is the first value greater than the second?
≤ Is the first value less than or equal to the second?
< Is the first value less than the second?
≥ Is the first value greater than or equal to the second?
Always provides the programmer with two alternatives
Short If statements
do this if condition is true ...
Long If statements
If the condition is met, the commands in the IF block are executed, otherwise the commands in the ELSE block are executed
do this if condition is true ...
do this if condition is not true (i.e. false) ...
Repeated action(s) until a condition becomes true
is often used when you do not know when you are going to terminate the loop - the loop cycles until a condition is met. (Example: Do an operation while waiting for something to finish that you don't know how long it will take)
REPEAT UNTIL (condition)
is used when you know when you are going to terminate the loop - you know ahead of time how many times you want it to cycle (Example: Do an operation for each day of the week - always 7 days)
REPEAT n TIMES
is used with lists. The variable item is assigned the value of each element of list sequentially, in order from the first element to the last element. The code in block of statements is executed once for each assignment of item (i.e. once for each item in list ). Ex: 10 items in list, then the program will run 10 times
FOR EACH item IN list
THIS SET IS OFTEN IN FOLDERS WITH...
Code.org Unit 5 Terms
AP CSP Unit 5 - Building Apps (Test 1)
AP-CSP Unit 5 - Building Apps (Test 2)
AP CSP Unit 3 Quiz
YOU MIGHT ALSO LIKE...
AP Computer Science Unit 3
CSC 131 Final Review
IT 116 Ungraded Quizzes (20-24)
OTHER SETS BY THIS CREATOR
CS21B - Java 3- Conditional Branching
Unit 3 HTML - Web Forms
Unit 2 More Basic HTML
Unit 2 Basic HTML