APCSP Unit 2 Quiz

¡Supera tus tareas y exámenes ahora con Quizwiz!

Abstract data type

An abstract data type (or ADT) is a custom data type that's meaningful to your program. It's not built into the language; you develop it as you code. This is an abstraction because it hides the details inside the constructor and selectors so that the programmer who uses a quiz item has to think only about questions and answers, not about list indices.

Application program interface (API)

An application program interface (API) documents what a programmer needs to know about using a library: it's a description of each procedure's purpose, inputs, and outputs (but not its algorithms).

Element

An element is another name for an item in a list. (If the same value is in the list twice, that counts as two different elements.) Each element has a unique index (position) in the list.

Creative Commons

Creative Commons is a specific copyright license that allows others to use, share, and revise your work.

Index

The position number is called the index of the item in the list. In Snap! and on the AP exam, the index is always a whole number (1, 2, 3, 4, etc.). It is an error to use an index less than 1 or greater than the length of the list.

Abstract

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.

What does the length of list block do?

This block reports the length of the list.

Psuedocode example

all but the first of (item 2 of books1)

Data type

A data type is what kind of data something is (number, text string, list, etc.). For example, number is the data type for the first input to and list is the the data type for its second input. Each programming language provides some primitive data types (data types that are built-in). For example, Snap! provides numbers, text (words and sentences), Booleans (true or false), lists, and some you haven't yet used as data (such as sprites and costumes).

Global Variable

A global variable is a variable that is usable by all scripts in the program.

Nested conditional statement

A nested conditional statement is an if or if else statement inside the else part of another if else statement. If the predicate of the outer if else statement is false, then inner (nested) conditional statement will test its predicate and decide what to do.

Software Library

A software library is a collection of procedures that can be used in programs.

String

A string is an ordered sequence of characters.

Sublist

A sublist is a list as an item of another list.

Free software

Free software means software that anyone can copy, use, modify, and redistribute.

Red obsolete block

If you ever see this red Obsolete! block in code you have imported, it means that a required block was not exported. You'll have to go back to the original project and export again being sure to select all of the blocks needed by the blocks you want.

Open access

Open access scholarly research reports are available for free download, rather than requiring the permission of a journal publisher.

Open source software

Open source software is a more general term that means that you put the program's code online. You may still restrict how people can use the program.

Selection

Selection means deciding (selecting) which part of an algorithm to run based on whether a condition is true or false. Every algorithm can be constructed using sequencing (following steps in order), selection (deciding), and iteration (repeating).

What doe sit mean to initialize the variable?

Setting the starting value of a variable is known as initializing the variable.

Domain and range

The input type (often called domain by programmers) of a function is the type of data that it accepts as input. The output type (often called range) of a function is the type of data that it reports as output.

What is reported (1) mod (2)?

The output is 1

What is reported (5) mod (12)?

The output is 5.

What does the length of text block do?

This block reports the length of the string input by user.(also works on numbers)

What does the keep block do?

This block returns a new list with items from the input list that satisfies the predicate that goes inside the gray ring.

What does the list contains input block do?

This block takes two inputs (a list and any other type of input) and reports true if the list contains the input or false if it doesn't.

What does the input in front of list block do?

This block will return a list with the first input at the front of the list.

Traversing a list

Traversing a list means looking at each item of the list. For each is iterative (that is, it's repetitive, like for, which can also traverse a list). But unlike for, for each traverses the list without using index numbers.

How do you create a variable that is a list?

You create a new variable (script or global)z Then you pull a set block from the variables palette and set the variable equal to an empty list.

Another meaning for index

You've already learned the word index for the position of an element in a list. The same word is used for the position of a character in a string (for example, a letter in a word). So the first input to letter is the index.

Psuedocode example 3

item(1) of list ... contains Insurgent

Psuedocode example 2

keep items such that<length of___=3> from books1


Conjuntos de estudio relacionados

RCLF1B SE Block 4 (all portions) | App Reg & Cul Studies SE Course (RCLF1BSE01) (RCLF1BSE00)

View Set

series 6 - securities chapter unit 6 b- annuities

View Set

(Article 300) - GENERAL REQUIREMENTS FOR WIRING METHODS AND MATERIALS

View Set

physics concepts questions exam one

View Set

Mental Health Exam 2 - Book Questions

View Set