Learning Goal 3 (Lessons 9-12)

53 important questions on Learning Goal 3 (Lessons 9-12)

What is the initial list of numbers in the code example?

The initial list of numbers is `[5,4,3,2,1]`.

What is the purpose of the `smallest` variable in the code?

The purpose of the `smallest` variable is to store the smallest number.

What is the purpose of the Multiple List Filter pattern?

The purpose of the Multiple List Filter pattern is to filter lists based on a specific condition, ensuring all lists are the same length for this pattern.
  • Higher grades + faster learning
  • Never study anything twice
  • 100% sure, 100% understanding
Discover Study Smart

What should you create to store the average?

Create a blank variable to store the average

What does the `findSmallest` function do?

The `findSmallest` function finds the smallest number in the list.

What is the initial value of `StudentNameList`?

`StudentNameList` is `["Sal", "Maya", "Rudy", "Gina", "Paris"]`.

What must be true about the lists for the Multiple List Filter pattern?

All the lists must be the same length for this pattern.

What is created in a function to store the total value of all elements in the list?

In a function create a local variable to store the total value of all elements in the list

How is the temporary value stored in the function?

A local variable `temp` is created to store a temporary value.

What is the purpose of the `filteredList` variable in the code?

The purpose of the `filteredList` variable is to store the filtered list.

What values are in the `StudentGradesList`?

`StudentGradesList` is `[10, 11, 10, 10, 11]`.

What is the first step in the process of filtering lists?

Create a variable for each list.

What is used to access each element in the list and add its value to total?

Use a for loop to access each element in the list and add its value to total

What is the purpose of the `filter` function in the "List Filter - starting letter (text)" code?

The purpose of the `filter` function is to iterate through the `list` and append items that start with the letter "a" to the `filteredList`.

What condition is used to filter the list in the function?

The condition used to filter the list is if `wordLength > 7`.

What is the purpose of the `filter` function?

The `filter` function starts with blank lists and filters students with a grade of `11`.

What should be done with the filtered lists at the start of the function?

Create blank lists to store the filtered lists.

How is the average calculated after the for loop?

After the for loop, calculate the average by dividing total by the length of the list

What happens if an element is less than the value stored in `temp`?

If an element is less than the value stored in `temp`, the value of `temp` is set to the current element.

What is the initial step to filter a list of temperatures to only keep the list of freezing temperatures?

The initial step is to have an initial list of temperatures that we could read in with the getColumn command and store in a list variable. Alternatively, you could create your own list of numbers representing a list of temperatures.

In the "List Filter - length (block)" code, what condition is used to append items to `filteredList`?

The condition used is if `wordLength` is greater than 0.

How does the function access each element in the original list?

The function uses a `for` loop to access each element in the original list.

What happens inside the `for` loop in the `filter` function?

The `for` loop iterates over `StudentGradesList` and checks if `StudentGradesList[i]` is `11`.

What happens to the filtered lists each time the function is called?

Every time the function is called, the filtered lists will reset.

What is the title of the tutorial?

Tutorial: Filtering Lists from Tables

What columns are used in the program according to the tutorial?

Columns A, D, and G are used in the program.

What is the initial value of the variable `i` in the for loop?

The initial value of the variable `i` in the for loop is `0`.

What is the definition of "Traversal" in the context of list traversals?

The process of accessing each element in a list one at a time.

What is the initial content of the `list` variable in both code examples?

The initial content of the `list` variable is `["apples", "oranges", "apricots", "bananas"]`.

What happens if an element meets the certain condition in the function?

If an element meets a certain condition, it is appended to the filtered list.

What does the `appendItem` function do in the `filter` function?

`appendItem` adds items to `filteredStudentNameList`, `filteredStudentGradeList`, and `filteredStudentAgeList`.

What is the role of the loop in the filtering process?

Use a for loop to access each item in the list that contains the element you are filtering by.

What function is used to grab data from the columns?

The function used is getColumn("MyTable", "A"), getColumn("MyTable", "D"), and getColumn("MyTable", "G").

What condition is checked inside the if statement?

The condition checked inside the if statement is `listD[i] > someNumber`.

How is "Iteration" defined in list traversals?

A repetitive portion of an algorithm which repeats a specified number of times or until a given condition is met (accomplished by using loops in code).

What occurs when the ending condition of a loop is never met?

Infinite Loop: Occurs when the ending condition of a loop is never met.

How should the function be structured to filter the list?

In a function, make a for loop that will across all of the values in the original list.

In the "List Filter - length (block)" code, what variable stores the length of each word?

The variable `wordLength` stores the length of each word.

How does the "List Filter - starting letter (text)" code determine the first letter of each item?

It determines the first letter by using `list[i].substring(0,1)`.

What are the steps to filter a list according to the explanation?

  • Create a variable and store a list in it.
  • Create a blank list to store the filtered list.
  • In a function use a for loop to access each element in the original list.
  • If that element meets a certain condition, append it to the filtered list.

What is the List Reduce Pattern used for?

The List Reduce Pattern is used when you want to reduce the information in a list down to a single number.

How does each index in the list correspond to the table?

Each index in the list corresponds to the SAME ROW in the table.

Where do all the values at index 0 come from?

All of the values at index 0 come from the TOP row of the table.

What function is used to add elements to the filtered lists?

The function used to add elements to the filtered lists is `appendItem`.

Which lists are elements added to when the condition is met?

Elements are added to `filteredListA`, `filteredListD`, and `filteredListG` when the condition is met.

What are "Simulations" in the context of list traversals?

Abstractions of more complex objects or phenomena for a specific purpose.

What are filtering and processing lists used for?

Filtering and processing lists are common applications that combine loops and lists. In both cases, loops are used to traverse, or access, all of the values in the list. From there, a boolean condition (if statement) is used to look for criteria that can be stored in variables, added to new lists, used to increment counters, etc depending on the task required.

What is used to detect if a row is a "keeper"?

The if statement in the loop is used to detect if a row is a "keeper".

What is the first step in the List Filter Pattern?

Create a variable and store a list of data in it, or read a column from a table into a list (can use getColumn command in Javascript).

What is the purpose of using the same index i for all lists?

The same index i is used because all elements at this index came from the same row.

What is the second step in the List Filter Pattern?

Create a blank list to store the filtered list.

What is the third step in the List Filter Pattern?

In a function use a for loop to access each element in the original list.

What is the fourth step in the List Filter Pattern?

If that element meets a certain condition, append it to the filtered list.

The question on the page originate from the summary of the following study material:

  • A unique study and practice tool
  • Never study anything twice again
  • Get the grades you hope for
  • 100% sure, 100% understanding
Remember faster, study better. Scientifically proven.
Trustpilot Logo