1/16
Flashcards reviewing key concepts from the AP Computer Science Principles exam notes.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
An expected user of the program is someone who watches Netflix and wants to find shows based on and .
genre, rating
The first iteration in New() runs once for each in the list.
item
An infinite loop could happen if you forget to increase the variable, like removing i++.
loop
Changing list[i] in the New() function to something like list[x], but x is never defined, will result in a error.
run-time
To count how many times a value appears in titleList, you should create a variable and set it to 0.
count
A comment at the top of the code explaining what the program does is an example of .
documentation
In the New() function, the loop runs as long as the input list has at least one .
item
filter("Comedy", "PG") calls the filter() procedure and tells it to find all shows that are both and -rated.
Comedy, PG
If you didn’t have a line like var titleList = getColumn("Netflix Content", "Title"), the app wouldn’t know what exist.
shows
Testing the app by trying different genres and ratings in the dropdowns is an example of using .
feedback
In New(), the loop uses i < list.length. A Boolean expression that’s equivalent is i != .
list.length
Instead of test cases, you can use output statements like inside the filter() function.
console.log()
The filter() function solves the of finding which titles match the selected genre and rating.
subproblem
The program solves the issue of too many choices on Netflix by letting users quickly narrow down shows by and .
genre, rating
The function builds a new list of only the matching results.
filter()
Inside the if statement in filter(), adding would tell you which shows matched the filter and were added to the list.
console.log(titleList[i])
If the parameter is removed from filter(), the code would only check for genre.
rating