reports a list with two items: "Augusta" and "Maine".
On this page, you will begin to develop a quiz app by creating an abstract data type to pair the questions with their answers.
A sublist is a list used as an item of another list.
(The word sublist is also used to refer to some subset of a list.)
But code like
is hard to read and understand. A better way is to use abstraction to organize the quiz items. The abstraction just hides the list and item of blocks, so it isn't complicated to build, but it can make your code much easier to write, read, and debug.
and list is the the data type for its second input.
The word "abstract" is often used casually to mean something harder to understand or more complex, but in computer science, its meaning is almost the opposite. ADTs are things that you, the programmer, create to make your program easier for you and others to read, debug, and improve.
quiz item has to think only about questions and answers, not about list indices.
block is the constructor; it constructs one example of the data structure. By naming the pieces of the structure, the constructor makes it certain that every time you use it, you build the structure in the right order.
and
blocks are the selectors; they each select one piece of the data structure.quiz item abstract data type.
Reshma Saujani (born 1975) founded the nonprofit organization Girls Who Code in response to the historical decline in the number of women employed in computer science fields. According to their website, in 1995, 37% of computer scientists were women. As of 2023, it’s only 24%. Reshma and Girls Who Code aim to fix this imbalance by running clubs that teach girls CS. In addition to being an activist, Reshma was the first Indian American woman to run for Congress and has served as New York City’s Deputy Public Advocate, where she created innovative partnerships to support DREAMers and promote campaign finance reform, among other initiatives.
quiz item abstract data type (both the constructor and the two selectors).
Your selectors expect a quiz item, i.e., a list, as input. You can make your blocks show what type of data they expect. It's not necessary in Snap! but, like assigning a color to a block, it can be a helpful reminder of what the block does and what type of input it expects. You've already seen input slots of several shapes, indicating different expected data types.
In the Block Editor while creating a selector, click on a plus sign to enter an input name. Then...


A table is a two-dimensional data structure with rows and columns. If you've used a spreadsheet program, what it displays is a table.
In Snap!, a table is implemented as a list of lists, in which each sublist is one row of the table.
Imagine you make a variable capitals and use set to give this list of lists a name:

Which of the following statements are true?
Choose all that apply.
reports a list with two items: "Augusta" and "Maine".
reports the word "Augusta".
reports the word "Iowa".
reports the number 8.
reports a list with one item: "Iowa".
reports the string "Boise".
reports the string "Iowa".
all but first of (capitals) are lists.
reports the number 2.