Search Header Logo
APCSP Big Idea 3 Review

APCSP Big Idea 3 Review

Assessment

Presentation

Computers

12th Grade

Easy

Created by

Amy Austin

Used 1+ times

FREE Resource

70 Slides • 85 Questions

1

media
media
media

AP CS Principles Exam Review

1

Big Idea 3:
Algorithms and
Programming

Exam
Weighting:
30% - 35%

Adapted from:
https://longbaonguyen.github.io/courses/apcsp/apprinciples.html


This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

With material from:
Reichelson, Seth. AP Computer Science Principles Premium with 6 Practice Tests
(Barron's Test Prep). Barrons Educational Series.

2

media

Big Idea 3:
Programming
and Algorithms, I

2

3

media

Big Idea 3:
Programming
and Algorithms, II

3

4

media

Big Idea 3: Programming and Algorithms

The AP exam will use a language-agnostic syntax for programming and
algorithm questions.

Please see the following reference sheet (also available during the
actual exam) for more details about the syntax.

https://apcentral.collegeboard.org/pdf/ap-computer-science-principle
s-exam-reference-sheet.pdf

4

5

media

Big Idea 3: Programming and Algorithms

In computer science, an abstraction is a way to represent essential
features without including the background details or explanations.
Abstractions reduce complexity and allow for efficient design and
implementation of complex software systems.

Abstractions become a necessity as systems become more complex.
For example, anytime you check your stories on Instagram, you are
using a bunch of processes in the background that you have no control
over.

Without these abstractions, it would be difficult to send a message to a
friend. With the use of abstractions, you can focus on content, not the
technical details of how the application works.
5

6

media
media

Big Idea 3: Programming and Algorithms

Programmers also use abstractions. The purpose of abstraction is to hide
coding details so the programmer can focus on the current problem.

Computers can understand only binary machine code. Machine code is a
strictly numerical language that runs fast but is hard to use.

The code on the right is written in machine
code to outputs "Hello World" to the
screen.

In Python it can be done using the print()
abstraction:
print("Hello World")

6

7

media

Big Idea 3: Programming and Algorithms

Abstractions allow for programmers to use semi-human language to
program (Python, Java, etc).

Rarely will programmers deal directly in machine code. Machine code
is a base language where no abstractions are implemented.
Programmers have worked to hide details by using abstractions.

Different program languages offer different levels of abstractions.
High-level programming languages provide more abstractions than do
lower-level languages.

Coding in a programming language is often translated into code in
another low-level language that the computer can execute.
7

8

media

Big Idea 3: Programming and Algorithms

Abstraction Examples Used on the AP Exam:

DISPLAY(expression) is an abstraction that is used on your AP exam to
display a value of expression followed by a space. The input parameter
for the DISPLAY abstraction is expression.

Another abstraction used on your AP exam is RANDOM(a, b), which
evaluates to a random number from a to b inclusive. The input
parameters in this abstraction are a and b.

An abstraction generalizes functionality with input parameters that
allow software reuse. Being aware of and using multiple levels of
abstractions in developing programs helps to apply available resources
and tools more effectively to solve problems.

8

9

media

9

10

Multiple Choice

What is the exam weighting for the AP CS Principles Exam's Big Idea 3: Algorithms and Programming?

1

A) 10% - 15%

2

B) 20% - 25%

3

C) 30% - 35%

4

D) 40% - 45%

11

Multiple Choice

What is the purpose of data abstraction in programming?

1

To represent algorithmic processes without using a programming language.

2

To evaluate solution options.

3

To manage complexity in a program.

4

To determine the result of code segments.

12

Multiple Choice

What is an abstraction in computer science?

1

A detailed explanation of how software systems work.

2

A way to represent essential features without including background details or explanations.

3

A complex software system.

4

A type of computer hardware.

13

Multiple Choice

Why do abstractions become a necessity in computer science?

1

Because they make it easier to send messages to friends.

2

Because they allow users to control background processes.

3

As systems become more complex, they reduce complexity and allow for efficient design and implementation.

4

Because they provide detailed technical information to users.

14

Multiple Choice

What is the benefit of using abstractions when using applications like Instagram?

1

They allow you to control the processes in the background.

2

They enable you to focus on content without worrying about how the application works.

3

They provide a detailed understanding of the technical details of the application.

4

They make it difficult to use the application.

15

Multiple Choice

What is the purpose of abstraction in programming according to Big Idea 3?

1

To make the code run faster

2

To hide coding details so the programmer can focus on the current problem

3

To convert code into binary format

4

To output "Hello World" to the screen

16

Multiple Choice

How can the phrase "Hello World" be output to the screen in Python?

1

print("Hello World")

2

echo "Hello World"

3

console.log("Hello World")

4

write("Hello World")

17

Multiple Choice

What do abstractions in programming allow for?

1

They allow for the use of machine code exclusively.

2

They enable programmers to use semi-human language to program.

3

They prevent programmers from using high-level programming languages.

4

They require programmers to deal directly with hardware details.

18

Multiple Choice

What is machine code considered in terms of abstractions?

1

A high-level language with many abstractions.

2

A semi-human language.

3

A base language with no abstractions implemented.

4

A form of high-level programming language.

19

Multiple Choice

Compared to lower-level languages, what do high-level programming languages provide?

1

Fewer abstractions.

2

No abstractions.

3

More abstractions.

4

Direct interaction with machine code.

20

Multiple Choice

What happens to code written in a high-level programming language for it to be executed by a computer?

1

It is directly executed without any translation.

2

It is translated into a high-level language that the computer can execute.

3

It is often translated into code in another low-level language that the computer can execute.

4

It is converted into an abstract form that cannot be executed.

21

Multiple Choice

What does the RANDOM(a, b) abstraction evaluate to?

1

A specific number between a and b

2

A random number from a to b inclusive

3

The sum of a and b

4

The product of a and b

22

Multiple Choice

What does the operator '+' represent in mathematical operations?

1

Subtraction

2

Division

3

Addition

4

Modulus

23

Multiple Choice

Which example correctly shows the use of the '*' operator?

1

5 + 7 = 12

2

2 - 1 = 1

3

3 * 3 = 9

4

3 MOD 2 = 1

24

Multiple Choice

What is the result of the operation 3 MOD 2?

1

0.5

2

2

3

1

4

1.5

25

Multiple Choice

According to the Operator Precedence (Order of Operations), which operation should be performed first?

1

Addition

2

Division

3

Parentheses

4

Modulus

26

Multiple Choice

Which set of operators have the same precedence level?

1

+, -

2

*, /

3

MOD, +

4

MOD, *, /

27

Multiple Choice

Question image

What is the value of a after the expression 26 MOD 2 is evaluated?

1

0

2

1

3

2

4

13

28

media
media
media

Big Idea 3: Programming and Algorithms

10

29

Multiple Choice

Question image

What is the value of a after the expression 17 MOD 2 is evaluated?

1

0

2

1

3

2

4

8

30

media
media
media
media
media

Big Idea 3: Programming and Algorithms

10

31

media
media
media

Big Idea 3: Programming and Algorithms

11

32

Multiple Choice

What error is encountered when a zero is to the right of MOD in a modulus calculation?

1

No error, the result is 0.

2

The result is the value of the dividend.

3

DIVIDE BY ZERO error.

4

The result is the value of the divisor.

33

Multiple Choice

Is it feasible to have a zero to the left of MOD in a modulus calculation, and if so, what is the result?

1

No, it results in a DIVIDE BY ZERO error.

2

Yes, the result is the value of the divisor.

3

Yes, the result is 0.

4

No, it results in an undefined operation.

34

Multiple Choice

Question image

What will the following program display?

1

A) 13

2

B) 17

3

C) 9

4

D) 21

35

media
media
media

Big Idea 3: Programming and Algorithms

12

36

Multiple Choice

Question image

What will the following program display if the INPUT function reads an even number such as 4?

1

1

2

2

3

0

4

4

37

media
media
media

Big Idea 3: Programming and Algorithms

13

38

Multiple Choice

Question image

What will the following program display?

1

False

2

0

3

3

4

True

39

media
media
media

Big Idea 3: Programming and Algorithms

13

40

Multiple Choice

Question image

What will be the output of DISPLAY(a) after executing the given code?

1

3

2

5

3

14

4

0

41

Multiple Choice

Question image

What will be the output of DISPLAY(b) after executing the given code?

1

3

2

5

3

14

4

0

42

Multiple Choice

Question image

What will be the output of DISPLAY(c) after executing the given code?

1

3

2

5

3

14

4

0

43

media
media
media
media

Big Idea 3: Programming and Algorithms

14

44

Multiple Choice

Question image

If the code "a ← RANDOM 1,4" followed by "DISPLAY a = 3" is executed several times, what is the percentage of times "false" would be expected to be displayed?

1

25%

2

50%

3

75%

4

100%

45

media
media
media

15

46

Multiple Choice

Question image

If the code "a ← RANDOM 1,10" followed by "DISPLAY a ≤ 3" is executed several times, what is the percentage of times "true" would be expected to be displayed?

1

10%

2

20%

3

30%

4

40%

47

media
media
media

15

48

Multiple Choice

Question image

What is the value at index 3 in the list scores?

1

11

2

35

3

6

4

75

49

media
media
media

Lists

16

50

Multiple Choice

According to the content, how do indexes in lists start on the AP exam?

1

At 0

2

At 1

3

At -1

4

At 2

51

Multiple Choice

Question image

What will happen if you try to access scores[6]?

1

It will return the value 11.

2

It will return the value 37.

3

It will return an index out of bounds error.

4

It will return the value 75.

52

media
media
media

Lists

16

53

media
media

Lists

17

54

Multiple Choice

What will happen if you try to access an index in a list that is less than 1 or greater than the length of the list?

1

The list will automatically expand to accommodate the new index.

2

The program will ignore the operation.

3

An error message is produced and the program will terminate.

4

A new element will be created at that index.

55

Multiple Choice

Question image

What is the result of the operation a <- newList[0] given the list namesOfMyDogs <- ["Waffles", "Novack the 3rd", "Benji"]?

1

a is assigned the value "Waffles"

2

a is assigned the value "Novack the 3rd"

3

a is assigned the value "Benji"

4

This operation causes an error because the index is out of bounds

56

media
media
media

Lists

17

57

media
media

The INSERT(list, i, item) will insert the item at index i and shift right
items at index i or higher.

18

58

Multiple Choice

What does the INSERT method do when applied to a list?

1

It deletes the item at the specified index.

2

It replaces the item at the specified index with a new item.

3

It inserts the item at the specified index and shifts right items at index or higher.

4

It appends the item to the end of the list.

59

Multiple Choice

Question image

After using the INSERT method with the parameters (words, 3, "Green"), what will the list 'words' look like?

1

["The", "Little", "Frog", "Jumping"]

2

["The", "Little", "Green", "Frog", "Jumping"]

3

["The", "Green", "Little", "Frog", "Jumping"]

4

["Green", "The", "Little", "Frog", "Jumping"]

60

media
media
media

The INSERT(list, i, item) will insert the item at index i and shift right
items at index i or higher.

18

61

media
media

19

The APPEND(list, item) will add the item to the end of the list.

62

Multiple Choice

Question image

What does the APPEND function do in the context of the list provided?

1

Inserts an item at a specified index in the list

2

Adds the item to the beginning of the list

3

Adds the item to the end of the list

4

Deletes an item from the list

63

Multiple Choice

Question image

After performing the operations shown, what is the correct order of items in the 'words' list?

1

Fox

2

Elephant

3

Green

4

Pig

5

The

64

Multiple Choice

Question image

What is the final position of "The" in the 'words' list after all the operations are performed?

1

1

2

2

3

3

4

4

65

media
media
media

19

The APPEND(list, item) will add the item to the end of the list.

66

media
media

Line 4: REMOVE(words, 3)
Line 5: DISPLAY(words)

20

The REMOVE(list, i) will remove the item at index i and shift left items
at index i or higher.

67

Multiple Choice

Question image

What is the result of executing Line 2 in the given code snippet?

1

5

2

6

3

7

4

8

68

Multiple Choice

Question image

What does the REMOVE function do according to the description provided?

1

It adds an item at the specified index.

2

It removes the item at the specified index and shifts left the remaining items.

3

It replaces the item at the specified index with a new item.

4

It creates a copy of the list without the item at the specified index.

69

Multiple Choice

Question image

After executing Line 3, what will the DISPLAY function show if it is called?

1

"Elephant", "Green", "The", "Fox", "Pig", "Rhino"

2

"Green", "The", "Fox", "Pig", "Rhino"

3

"Elephant", "The", "Fox", "Pig", "Rhino"

4

"Elephant", "Green", "Fox", "Pig", "Rhino"

70

Multiple Choice

Question image

What will be the final output after executing Line 5?

1

"Green", "The", "Pig", "Rhino", "Fox"

2

"Green", "The", "Rhino", "Fox"

3

"Green", "The", "Fox", "Pig"

4

"Green", "The", "Pig", "Rhino"

71

media
media

Line 4: REMOVE(words, 3)
Line 5: DISPLAY(words)

Answer: ["Green", "The", "Pig", "Rhino", "Fox"]

20

The REMOVE(list, i) will remove the item at index i and shift left items
at index i or higher.

72

media
media
media

21

73

Multiple Choice

Question image

What will be the output of the given code snippet?

1

96 93 90 100 92 90

2

93 96 90 100 92 90

3

90 92 93 96 100 90

4

96 96 93 90 100 92 90

74

Multiple Choice

In some programming languages, what is another term for a procedure?

1

Object

2

Class

3

Method or subroutine

4

Array

75

Multiple Choice

What is the initial value of 'count' when the PROCEDURE doubling(list) starts?

1

0

2

1

3

2

4

Undefined

76

Multiple Choice

How many times does the loop inside the PROCEDURE doubling(list) run?

1

Once

2

Twice

3

As many times as the length of the list

4

Indefinitely

77

Multiple Choice

What operation is performed on each element of the list in the PROCEDURE doubling(list)?

1

The element is incremented by 1

2

The element is decremented by 1

3

The element is multiplied by 2

4

The element is divided by 2

78

Multiple Choice

What happens to 'count' after each iteration of the loop in the PROCEDURE doubling(list)?

1

It is reset to 0

2

It is incremented by 1

3

It is decremented by 1

4

It remains unchanged

79

Multiple Choice

What is the purpose of the 'findTotal' procedure in the given code snippet?

1

To find the average of the scores

2

To display the scores

3

To find the sum of the scores

4

To count the number of scores

80

Multiple Choice

What will be the value of 'total' after the 'findTotal' procedure is executed with the given 'scores' list?

1

467

2

475

3

485

4

500

81

Multiple Choice

What does the 'FOR EACH' statement in the code do?

1

It repeats a set of statements for each element in 'scores'

2

It adds each item in 'scores' to the sum

3

It returns the sum of the scores

4

It initializes the sum to 0

82

Multiple Choice

What is the result of executing the ROTATE_RIGHT() command if the initial robot direction is pointing upwards (▲)?

1

The robot will point to the right (►)

2

The robot will point downwards (▼)

3

The robot will point to the left (◄)

4

The robot will make a 180-degree turn

83

Multiple Choice

What is the result of executing the ROTATE_RIGHT() command if the initial robot direction is pointing to the right (►)?

1

The robot will point upwards (▲)

2

The robot will point downwards (▼)

3

The robot will point to the left (◄)

4

The robot will point downwards (▼)

84

Multiple Choice

What is the result of executing the ROTATE_RIGHT() command if the initial robot direction is pointing downwards (▼)?

1

The robot will point to the right (►)

2

The robot will point upwards (▲)

3

The robot will point to the left (◄)

4

The robot will point to the left (◄)

85

Multiple Choice

What is the result of executing the ROTATE_RIGHT() command if the initial robot direction is pointing to the left (◄)?

1

The robot will point to the right (►)

2

The robot will point upwards (▲)

3

The robot will point downwards (▼)

4

The robot will point upwards (▲)

86

Multiple Choice

What is the result of executing the ROTATE_LEFT() command on a robot facing upwards (↑)?

1

The robot will face to the right (→)

2

The robot will face downwards (↓)

3

The robot will face to the left (←)

4

The robot will remain facing upwards (↑)

87

Multiple Choice

What is the result of executing the ROTATE_LEFT() command on a robot facing to the right (→)?

1

The robot will face upwards (↑)

2

The robot will face to the left (←)

3

The robot will face downwards (↓)

4

The robot will remain facing to the right (→)

88

Multiple Choice

What is the result of executing the ROTATE_LEFT() command on a robot facing downwards (↓)?

1

The robot will face to the right (→)

2

The robot will face upwards (↑)

3

The robot will face to the left (←)

4

The robot will remain facing downwards (↓)

89

Multiple Choice

What is the result of executing the ROTATE_LEFT() command on a robot facing to the left (←)?

1

The robot will face upwards (↑)

2

The robot will face to the right (→)

3

The robot will face downwards (↓)

4

The robot will remain facing to the left (←)

90

Multiple Choice

What happens when the MOVE_FORWARD command is executed with the robot facing a black square?

1

The robot moves to the next white square.

2

The robot turns to the right.

3

The robot moves to the next black square.

4

The robot reports an ERROR.

91

Multiple Choice

When the MOVE_FORWARD command is executed and the robot is facing a white square, what is the next action of the robot?

1

The robot turns to the left.

2

The robot moves forward to the next square.

3

The robot reports an ERROR.

4

The robot turns to the right.

92

Multiple Choice

What is the purpose of the CAN_MOVE(direction) abstraction in the context provided?

1

To allow the robot to move in any direction without restrictions.

2

To prevent the robot from moving off the grid and resulting in an error.

3

To calculate the distance the robot moves in a certain direction.

4

To record the number of moves the robot makes.

93

Multiple Choice

What is the purpose of the Goal_Reached() procedure in the robot's program?

1

To move the robot to the gray square

2

To return "true" if the robot is in the gray square and "false" otherwise

3

To rotate the robot to the right

4

To repeat the program until the robot moves

94

Multiple Choice

What action does the robot take if it can move to the right according to the program?

1

It moves forward

2

It rotates left

3

It rotates right

4

It does nothing

95

Multiple Choice

What will the robot do if it cannot move forward according to the program?

1

It will rotate right

2

It will rotate left

3

It will move to the gray square

4

It will stop executing the program

96

Multiple Choice

What does the procedure Goal_Reached() return when the robot is in the gray square?

1

false

2

error

3

true

4

undefined

97

Multiple Choice

According to the comment in the image, what happens when the robot runs the given code?

1

The robot successfully reaches the gray square

2

The robot exits the grid

3

The robot gets stuck in an infinite loop at the top right corner

4

The robot turns off automatically

98

Multiple Choice

What is the maximum number of times the ROTATE_LEFT() procedure can be called according to the given code snippet?

1

0

2

1

3

2

4

3

99

Multiple Choice

What is the maximum number of times the MOVE_FORWARD() procedure can be called according to the given code snippet?

1

0

2

1

3

2

4

3

100

Multiple Choice

How many times does the robot rotate left according to the procedure?

1

1 time

2

2 times

3

3 times

4

1 to 3 times randomly

101

Multiple Choice

Which of the following is a possible final position of the robot after executing the procedure?

1

The square immediately to the left of the starting position

2

The square two places above the starting position

3

The square immediately to the right of the starting position

4

The square immediately below the starting position

102

Multiple Choice

What is the common algorithm mentioned in the text?

1

Sorting

2

Searching

3

Swapping

4

Queuing

103

Multiple Choice

What will be the result of the swap operation in the animals' data structure?

1

animals[1] = frog; animals[3] = sheep

2

animals[1] = bear; animals[2] = sheep

3

animals[2] = sheep; animals[3] = bear

4

animals[1] = sheep; animals[3] = frog

104

Multiple Choice

What is the first step in the algorithm to swap the first and third items in a list?

1

Replace the first item with the second item.

2

Assign the third item to a temporary variable.

3

Create a temporary variable to store the value of the first item.

4

Swap the second and third items in the list.

105

Multiple Choice

What is done with the first item in the list after creating a temporary variable?

1

It is deleted from the list.

2

It is swapped with the second item.

3

It is replaced with the third item in the list.

4

It is moved to the end of the list.

106

Multiple Choice

After replacing the first item in the list with the third item, what is the next step in the algorithm?

1

Replace the second item with the value in the temporary variable.

2

Replace the third item with the value in the temporary variable.

3

Replace the first item with the value in the temporary variable.

4

No further action is required.

107

Multiple Choice

What will be the output after executing the given pseudocode?

1

A list containing all the numbers from list1

2

A list containing some numbers from list1

3

An empty list

4

A list containing all numbers from list1 that are either even or odd

108

Multiple Choice

What is a linear search also known as?

1

Binary search

2

Sequential search

3

Hash search

4

Depth-first search

109

Multiple Choice

In a linear search, where does the search start?

1

At the end of the list

2

At a random point in the list

3

From the beginning of the list

4

In the middle of the list

110

Multiple Choice

What types of lists can a linear search be used on?

1

Only sorted lists

2

Only unsorted lists

3

Both sorted and unsorted lists

4

Neither sorted nor unsorted lists

111

Multiple Choice

If a list has n elements, what is the worst case for the number of searches in a linear search?

1

n/2

2

n-1

3

n+1

4

n

112

media
media

22

113

Multiple Choice

What is a procedure in programming?

1

A set of instructions that performs a specific task and is not referred to by name.

2

A set of code that is referred to by name and can be called at any point in a program.

3

A variable that stores data values.

4

A programming language.

114

media
media

What does the code do?

Answer: Double each value in the list.

23

115

media
media

What does the code do?

Answer: Add negative numbers from alist to the end of bList.

24

116

media
media

25

117

media
media

Big Idea 3: Programming and Algorithms

26

118

media
media

Big Idea 3: Programming and Algorithms

27

119

media

28

120

media

29

121

media
media
media

What is the result of executing the above code?

Answer: Robot moves forward 4 steps.

30

122

media
media
media
media

Does the code work as intended?
Yes, as an exercise, trace the code to convince yourself that the robot will
reach destination.

31

123

media
media
media
media

Does the code work as intended?
No! Robot get stuck in an infinite loop at the top right corner.

32

124

media
media
media
media

33

125

media
media
media
media
media

34

126

media
media
media

35

127

media
media
media
media
media

36

128

media
media

What is the output?
Answer: Empty list, a number cannot be both even and odd. No number is
appended to list2.

37

129

media
media

38

130

media
media
media

39

131

Multiple Choice

Using a linear search, how many comparisons would it take to find the number 11?

1

1 comparison

2

2 comparisons

3

10 comparisons

4

11 comparisons

132

Multiple Choice

What is the best case scenario for the number of comparisons in a linear search?

1

The element is found after checking half of the list

2

The element is found at the end of the list

3

The element is not found in the list

4

The element is found with the first comparison

133

media
media
media

40

134

media
media

41

135

media
media
media

42

136

media
media
media

43

137

media
media
media

44

138

media
media

Program Design

45

139

media
media
media

46

140

media
media
media

Trace the code and determine the output of the following program.

Answer:

47

141

media
media

Trace the code and determine the output of the following program.

Answer: Display 3.

48

142

media

Algorithms to Know

The AP MCQ will ask questions about standard algorithms every programmer
should know:

1)

Find total sum of a list of numbers

2)

Find average of a list of numbers

3)

Find maximum/minimum of a list of numbers

4)

Find word from a list of words

Please know these algorithms and know how to quickly recognize them! If the
code for any of the algorithm above is given with the name
"mystery_algorithm", you should be able to quickly recognize what it does.

We'll go over each of them.

49

143

media
media

Find total sum of a list

50

144

media
media
media
media
media
media

Find average of a list (implementation #1)

Implementation #1: Use for Each Loop.

51

145

media
media
media

Find average of a list (implementation #2)

Implementation #2: Use REPEAT n times loop.

52

146

media
media
media
media
media
media
media

Find maximum of a list (implementation #1)

Implementation #1: Use for Each Loop.

53

147

media
media
media
media
media
media

Find maximum of a list (implementation #2)
Implementation #2: Use REPEAT n times loop.

54

148

media
media
media

Common Error Example 1
The AP exam will try to give you code that is the wrong implementation
of an algorithm. Can you find the error?

55

149

media
media
media

Common Error Example 2
The AP exam will try to give you code that is the wrong implementation
of an algorithm. Can you find the error?

56

150

media
media

Correct findMinimum
Here's the correct implementation of findMinimum.

57

151

media
media
media
media
media
media

Find word from list of words

58

This code also works if we remove the Else block:

IF(item = word)
{

RETURN index

}
index 🡨 index + 1

152

media

Algorithmic Efficiency

Some problems cannot be solved in a reasonable amount of time
because there is no efficient algorithm for solving them. In these cases,
approximate solutions are sought.

Algorithms with a polynomial efficiency(constant, linear, square, cube,
etc.)
are said to run in a reasonable amount of time. They can be executed
quickly on a modern processor.

However, there exists important and practical problems for which there
exists no known polynomial time algorithm. Algorithms with
exponential or factorial efficiencies are examples of algorithms that run
in an unreasonable amount of time.

59

153

media

Algorithmic Efficiency

A heuristicis an approach to a problem that produces a solution that is
not guaranteed to be optimal but may be used when techniques that
are guaranteed to always find an optimal solution are impractical.

For example, a file-organizing algorithm determines the content of a
file based on a certain number of bytes in the beginning of the file. This
is an approximate solution since only a few bytes are examined. But it is
more practical and faster to run than examining every byte of every file.

60

154

media

Programmers break down problems into smaller and more manageable
pieces. By creating procedures and leveraging parameters, programmers
generalize processes that can be reused.

Procedures allow programmers to draw upon existing code that has
already been tested, allowing them to write programs more quickly and
with more confidence.

A software library contains procedures that may be used in creating new
programs. (e.g. Python's random, numpy libraries)

The use of libraries simplifies the task of creating complex programs
(abstraction).

61

155

media

Application program interfaces (APIs) are specifications for how the
procedures in a library behave and can be used.

For example, Twitter's API allow programmers to access and analyze tweets.

Documentation for an API/library is necessary in understanding the
behaviors provided by the API/library and how to use them. Twitter has
documentation that allows programmers to learn how to use their API.

A computing device is a physical artifact that can run a program. Some
examples include computers, tablets, servers, routers, and smart sensors.
The device must be able to take inputs, process the inputs, and then
calculate results based on those inputs.

62

media
media
media

AP CS Principles Exam Review

1

Big Idea 3:
Algorithms and
Programming

Exam
Weighting:
30% - 35%

Adapted from:
https://longbaonguyen.github.io/courses/apcsp/apprinciples.html


This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

With material from:
Reichelson, Seth. AP Computer Science Principles Premium with 6 Practice Tests
(Barron's Test Prep). Barrons Educational Series.

Show answer

Auto Play

Slide 1 / 155

SLIDE