Log in
Sign up for FREE
arrow_back
Library

APCSP Algorithm (MCQ)

star
star
star
star
star
Last updated 8 months ago
19 questions
Note from the author:
4
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
Remember AP CSP is language agnostic, that is no specific langauge in mind.
Remember AP CSP is language agnostic, that is no specific langauge in mind.
Question 1
1.

Question 2
2.

Question 3
3.

Question 4
4.

Question 5
5.

Question 6
6.

Question 7
7.

Question 8
8.

Question 9
9.

Question 10
10.

Question 11
11.

Question 12
12.

Question 13
13.

Question 14
14.

Question 15
15.

Question 16
16.

Question 17
17.

Question 18
18.

Briefly differentiate between parameters and attributes

Question 19
19.

name = "John"
print(type(name))

When I run the code, what is printed to the screen?

Select all that is true!!
A variable name must not start with a number
A variable name must have no space in between
If a variable name has two word; use snake casing for python, and camel casing for Javascript
A variable name can contain an underscore but not a dash
Which of the following variable names would be considered valid in most programming languages but not self-identifying in purpose?
totalCost
x
numStudents
isOver18
If a variable num is set to 10.5, if precision is needed which data type would best represent it in a language that supports int, float, and double?
int
float
double
Boolean
What is the result of the expression 15 MOD 4 * 3? (Assume CSP’s MOD has precedence similar to multiplication)
9
12
3
5
Given the list grades ← [90, 85, 70, 100], what will DISPLAY(grades[2]) output if list indexing starts at 1?
90
85
70
Error
If you have a list called names and want to add an item to the end of the list, which function would you use?
append(names, newName)
add(names, newName)
names.add(newName)
push(names, newName)
Which of the following statements correctly describes an algorithm that uses REPEAT UNTIL x = 10?
It will iterate a specific number of times, then stop.
It will repeat indefinitely if x is never updated.
It will iterate exactly 10 times.
It will always execute only once.
In a nested conditional structure, which statement is true about the IF conditions?
The inner IF always executes regardless of outer conditions.
The inner IF only executes if the outer IF condition is true.
The outer IF condition is skipped when using nested conditions.
Nested IF conditions require multiple Boolean expressions.
age = 23

def change():
#global age
age += 3

change()
print(age)

Is age within the change function global or local? What will be printed to the screen
local, 23
global 23
global, error
local, 3
global, 3
error
age = 23

def change():
#global age
age = 3

change()
print(age)

Is age within the change function global or local? What will be printed to the screen
local, 23
global, 23
local, error
global, error
local, 3
global, 3
age = 23

def change():
global age
age = 3

change()
print(age)

Is age within the change function global or local? What will be printed to the screen
local, 23
global, 23
local, error
global, error
local, 3
global, 3
If a function calculateDiscount(price) modifies price inside but does not return any value, which of the following statements is correct? Assume we have a price variable already created before the function
The original price value remains unchanged outside the function.
The original price value is modified globally.
calculateDiscount needs a return statement to function.
calculateDiscount is modularly dependent on price.
What will DISPLAY(sum / count) output if sum ← 25 and count ← 0?
0
25
Error: Division by zero
25.0
A problem is said to be undecidable if:
It cannot be solved in reasonable time.
No algorithm exists to solve all possible instances of the problem.
It can be solved using a heuristic approach.
It requires an exponential time complexity.
What is the primary purpose of using parameters in a procedure?
To output information to the user.
To make the procedure return a value.
To allow the procedure to take different inputs each time it is called.
To display content on the screen.
If a procedure has a RETURN statement, what happens to the value when the procedure is called?
The procedure stops and the return value is passed to the caller.
The procedure continues until the end regardless of RETURN.
The return value is displayed automatically.
The return value is ignored.
Which of the following is a benefit of modularity in programming?
It requires more code to be written.
It reduces redundancy and improves readability.
It makes code execution slower.
It only allows fixed data inputs.