ap comp sci b - final

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/170

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 11:37 PM on 5/17/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

171 Terms

1
New cards

a. it is the value that will be inserted an index 2 of the list "things"

INSERT(things,2,9) means to insert the value 9 at the index 2 and move whatever had been at 2 to a higher index number as well as any values that were in items greater than index 2.

INSERT(things, 2, 9)

In the statement above, what is 9 ?

a. it is the value that will be inserted an index 2 of the list "things"

b. it is the number of times 2 will be inserted into the list "things"

c. it is the number of items in the list "things"

d. it is the index of "things" where 2 will be inserted

2
New cards

b. a variable that holds each item one at a time

FOR EACH ttl IN titles{

print ttl

}

In the statements above, ttl is each individual list item one at a time, and titles is the name of the list

FOR EACH ttl IN titles{

print ttl

}

In the statements above, what is "ttl"?

a. the name of the list

b. a variable that holds each item one at a time

c. the sum of all items

d. the average of all items

3
New cards

d. it accesses each item in the list from the first item to the last

a list traversal algorithm allows access to each item in the list one at a time from the first item to the last.

What does a list traversal algorithm do?

a. it deletes all the items from a list

b. it makes sure there are no duplicate items in the list

c. it creates a new list and puts items in it

d. it accesses each item in the list from the first item to the last

4
New cards

c. 7

The statement X <- zList[2] means to put a copy of the value in item #2 from the list "zList" into the variable "X"

zList = { 4, 7, 2, 3 }

X <- zList[2]

What is the value of X after the statements above run?

a. 3

b. 2

c. 7

d. 16

5
New cards

b. 4

The LENGTH of a list is the number of items it contains.

zList = { 2, 1, 8, 3 }

X <- LENGTH(zList)

What is the value of X after the statements above run?

a. 14

b. 4

c. 3

d. 5

6
New cards

a. 3, 4, 8, 1, 6

The INSERT operation puts a new item at given index number and moves the other items over to make room.

In the case of INSERT(zList, 2,4) it means to insert the value "4" at index #2, and move the item that was at #2 up to #3, and the rest of the items will also be moved higher.

zList = { 3, 8, 1, 6 }

INSERT(zList, 2, 4)

What is the value of zList after the statements above run?

a. 3, 4, 8, 1, 6

b. 3, 4, 1, 6

c. 3, 8, 1, 6, 4

d. 3, 8, 1, 4, 6

7
New cards

c. 3, 1, 2

The REMOVE operation uses an index number to identify the item to be removed. After the item is removed, all the items after tha will be moved forward.

zList = { 3, 8, 1, 2 }

REMOVE(zList, 2)

What is the value of zList after the statements above run?

a. 3, 0, 1, 2

b. 1, 6, -1, 0

c. 3, 1, 2

d. 3, 8, 1

8
New cards

b. x, y, z, w

the APPEND operation puts a new item at the end of the list

uList = { x, y, z}

APPEND( uList, "w")

What is the value of uList after the statements above?

a. w, x, y, z

b. x, y, z, w

c. w, w, w

d. x, y, w

9
New cards

a. 7

The FOR EACH algorithm accesses each item (c) in the list (countList), the statement IF c> 0 eliminates any value that is negative, the statement sum = sum + c adds those non-negative items to "sum"

countList = { -2, 4, -7, 3, -3}

sum = 0

FOR EACH c IN countList

{ IF c> 0

sum = sum + c

}

After the algorithm above runs, what is the value of the variable "sum"?

a. 7

b. -5

c. 5

d. -12

10
New cards

c. prints " 9 4 7 2 "

the FOR EACH accesses each item (x) in the list (xList), and the print statement prints its value.

xList = { 9, 4, 7, 2 }

FOR EACH x IN xList

{ print x }

What does the code above do?

a. prints "2"

b. prints "x"

c. prints " 9 4 7 2 "

d. prints "9"

11
New cards

d. AP does not require you to implement a binary search, just understand it

EXCLUSION STATEMENT : Specific implementations of the binary search are outside the scope of the course and the AP Exam.

Choose the statement about implementing a binary search that is most accurate.

a. AP requires you to implement a binary search

b. AP requires you to create a binary search from scratch

c. AP tests do not have any questions about binary searches

d. AP does not require you to implement a binary search, just understand it

12
New cards

b. 4 or 5

The formula to figure the number of passes is (log2 n) +1 , where n is the number of items in to be searched. To express this in normal language, log2 n is the number of times you can divide n by 2 until the result is 1. This is obviously much faster than a (linear/sequential) search that just starts with the first item, then moves on the next item, and so forth until it finds the search value.

If the original data set is 16 items, choose the number of passes would you expect a binary search to take to find a value.

a. 1

b. 4 or 5

c. 16

d. more than 16

13
New cards

c. binary search is faster especially on large data sets

Why would you choose a binary search? A binary can be much faster than a sequential search (which just starts with the first item, then goes on to the 2nd item and so forth) because each time it checks an item, it eliminates half of the searchable items. A sequential search only eliminates one item at a time. The larger the data set is, the more apparent the difference between binary and sequential will be.

Choose the statement that best describes how a binary search compares to a sequential search.

a. binary is faster on small data sets and sequential is faster on larger data sets

b. sequential i faster than binary

c. binary search is faster especially on large data sets

d. sequential and binary are about the same speed

14
New cards

a. 4

Each pass eliminates half of the data items that need to be searched.

Choose the number of search items the 2nd pass would have if the 1st pass had 8 search items

a. 4

b. 7

c. 8

d. 1

15
New cards

b. it returns an impossible index number, like -1

It depends on how the search is written, but it is common for the search to return the index number of the search value, but if it does not find the value in the list, then it returns an impossible index number, like -1.

Choose what would happen if a binary search does not find the search value.

a. it returns the index number of the last item it checked

b. it returns an impossible index number, like -1

c. it adds the value to the list

d. it starts searching all over again

16
New cards

d. depending on how the search is written, it probably returns the index of the item it found

What happens when the binary search finds the search value? It depends on how the search is written, but it is common for it to return the index number of the value.

What happens if the binary search does not find the search value in the list? It depends on how the search is written, but it is common for the search to return the index number of the search value, but if it does not find the value in the list, then it returns an impossible index number, like -1.

Choose the best description of what happens when the binary search finds the search value in the list.

a. it deletes the item

b. it moves the item to the back of the list

c. it moves the item to the front of the list

d. depending on how the search is written, it probably returns the index of the item it found

17
New cards

a. the item that is approximately in the middle

The binary search algorithm starts at the middle of a sorted data set

Choose the first item to be checked in a binary search.

a. the item that is approximately in the middle

b. the first item in the list

c. the last item in the list

d. the second item in the list

18
New cards

b. it is cut in half

The binary search algorithm starts at the middle of a sorted data set of numbers and eliminates half of the data; this process repeats until the desired value is found or all elements have been eliminated.

Choose what happens the the number of search items after the 1st pass in a binary search.

a. it doubles

b. it is cut in half

c. it doubles

d. it goes down by 1

19
New cards

d. the structure that holds the data must have some kind of addressing, like a list that uses index numbers

What does a binary search need in order to work? There are basically 2 things required for a binary search:

A data structure that holds many values and has some addressing system, like index numbers. Lists and arrays are examples of that kind of structure.

The data in the structure needs to be sorted. If the data is unsorted, then the binary search may not be able to even find a given value.

Choose something that is needed for a binary search to be successful.

a. the structure that holds the data must assign random addresses to the values

b. the data can only be viewable, but not changeable

c. the data can only be integers

d. the structure that holds the data must have some kind of addressing, like a list that uses index numbers

20
New cards

c. the data must already be sorted

What does a binary search need in order to work? There are basically 2 things required for a binary search:

A data structure that holds many values and has some addressing system, like index numbers. Lists and arrays are examples of that kind of structure.

The data in the structure needs to be sorted. If the data is unsorted, then the binary search may not be able to even find a given value.

Choose one thing that is required for a binary search to be successful.

a. there can only be less than 100 data items

b. the data must be in random order

c. the data must already be sorted

d. there must be at least 100 data items

21
New cards

b. arguments being passed to a procedure

Hyp - This is the name of a variable that will get a value returned from the procedure. The value in the variable "Hyp" is the square root of 32 + 42

<- This is the symbol that shows a value is being put into the variable Hyp.

getHypotenuse - This is the name of the procedure that was defined in the block above. It's name is being used here to call the procedure.

3, 4 - These are the arguments. If you look at the definition above, you will see that the first argument (3) will go into the parameter called A, and the 2nd argument (4) will go into the parameter called B.

Hyp <- getHypotenuse(9, 2)

In the code above, what is (9, 2)?

a. procedures returning values from a parameter

b. arguments being passed to a procedure

c. procedures being passed to an argument

d. parameters returning values from a procedure

22
New cards

a. a variable that receives the value returned from a procedure

Why - This is the name of a variable that will get a value returned from the procedure. The value in the variable "Hyp" is the square root of 32 + 42

<- This is the symbol that shows a value is being put into the variable Hyp.

getHypotenuse - This is the name of the procedure that was defined in the block above. It's name is being used here to call the procedure.

3, 4 - These are the arguments. If you look at the definition above, you will see that the first argument (3) will go into the parameter called A, and the 2nd argument (4) will go into the parameter called B.

Why <- getHypotenuse(3, 4)

In the code above, what is "Why"?

a. a variable that receives the value returned from a procedure

b. an argument that has an input value

c. a parameter that has an input value

d. a procedure that receives a value from a variable

23
New cards

c. the name of the procedure being called

Hyp - This is the name of a variable that will get a value returned from the procedure. The value in the variable "Hyp" is the square root of 32 + 42

<- This is the symbol that shows a value is being put into the variable Hyp.

getItDone - This is the name of the procedure that was defined in the block above. It's name is being used here to call the procedure.

3, 4 - These are the arguments. If you look at the definition above, you will see that the first argument (3) will go into the parameter called A, and the 2nd argument (4) will go into the parameter called B.

Hyp <- getItDone(3, 4)

In the code above, what is "getItDone"?

a. the name of a value being returned

b. the name of the procedure being defined

c. the name of the procedure being called

d. the name of a parameter

24
New cards

a. the name of a parameter

PROCEDURE- This is used to start the definition of a procedure.

getHypotenuse- This is the name of the parameter that is being defined

X, Y- These are parameter names (A & B) that will be used in this procedure. Not all procedures have parameters, and some may have many parameters.

C- This is the return value. Some procedures do not return anything.

PROCEDURE getHypotenuse(X, Y) {

C2 = X2 + Y2

RETURN( C )

}

In the code above, what is X ?

a. the name of a parameter

b. a method or function

c. the name of a return value

d. the name of a procedure

25
New cards

b. the name of the procedure being defined

PROCEDURE- This is used to start the definition of a procedure.

getMoreMoney- This is the name of the parameter that is being defined

A, B- These are parameter names (A & B) that will be used in this procedure. Not all procedures have parameters, and some may have many parameters.

C- This is the return value. Some procedures do not return anything.

PROCEDURE getMoreMoney(A, B) {

C2 = A2 + B2

RETURN( C )

}

In the code above, what is "getMoreMoney"?

a. the name of a variable

b. the name of the procedure being defined

c. the name of the procedure being called

d. the name of a parameter

26
New cards

d. that is a way of determining which programming instruction will run next

What is the "flow of control"? This is an expression that describes which computer instruction will execute next. Normally, the flow is sequential. This means that the first instruction executes, then the next one after that executes, and so forth, like a list of numbered instructions.

Choose the best description of "flow of control".

a. that is a way of determining which user can interact with the program

b. it is a way of determining how much data can be stored

c. it is way of determining which variable can hold a value

d. that is a way of determining which programming instruction will run next

27
New cards

a. input variables for procedures

Parameters are input variables of a procedure. Arguments specify the values of the parameters when a procedure is called.

Choose the best description of "parameters".

a. input variables for procedures

b. the instructions inside of procedures

c. another name for procedures

d. values that are returned from procedures

28
New cards

b. methods and functions

Procedures are referred to by different names, such as method or function, depending on the programming language.

Choose some other terms that mean the same thing as "procedure".

a. comments and components

b. methods and functions

c. variables and loops

d. trends and charts

29
New cards

d. they contain programming instructions

A procedure is a named group of programming instructions that may have parameters and return values.

Choose the statement that is most accurate about what is in a procedure.

a. they cannot contain programming instructions

b. they contain computer components like a monitor and hard drive

c. they usually have hardware such as transistors and computer chips

d. they contain programming instructions

30
New cards

c. procedures have names

A procedure is a named group of programming instructions that may have parameters and return values.

Choose the statement about procedure names that is most accurate.

a. all procedures share the same name

b. procedures cannot have names

c. procedures have names

d. naming procedures is optional

31
New cards

c. 1 2 3

it prints 1 because of the 1st PRINT statement

it prints 2 because of the PRINT statement in the PROCEDURE demo3

it RETURNS 3 from the procedure call into the variable Word

it does NOT print 4 because the RETURN statement causes the flow of execution to exit demo3 before it reaches the PRINT("D") statement

it prints 3 because that is the value in the variable Word.

PROCEDURE demo3() { PRINT(2) RETURN(3) PRINT(4) }

The code above is the definition of a procedure that will be called in the statements below.

PRINT(1)

Word = demo3( )

PRINT(Word)

When the statements above run, what is printed

a. 1 2 4 3

b. 1 2 3 3

c. 1 2 3

d. 1 2 3 4

32
New cards

a. 1 2 X 3 Y

Each time the procedure is called, something new is passed for it to print.

PROCEDURE demo1(K) {

PRINT(K)

}

The code above is the definition of a procedure.

PRINT("1")

PRINT("2")

demo1("X")

PRINT("3")

demo("Y")

The computer instructions above call the procedure that is defined above. Which is the correct output of these instructions execute?

a. 1 2 X 3 Y

b. 1 2 K 3 K

c. 1 2 3 K K

d. 1 2 3 X Y

33
New cards

d. demo2( )

demo2( 7, "bye") This one is not right because it passes 2 values and the definition shows 0 parameters.

Num <- demo2( ) This one is not right because it tries to return a value to the variable "Num", but there is no RETURN statement in the definition.

demo2( ) This one is right because it does not pass any values and the definition does not show any parameters.

demo2("hello") This one is not right because it passes a value and there are 0 parameters in the definition.

PROCEDURE demo2( ) {

PRINT("hello")

}

The code above is the definition of a procedure. Choose the procedure calls below that matches this definition.

a. demo2("hello")

b. demo2( 7, "bye")

c. Num <- demo2( )

d. demo2( )

34
New cards

b. paste("A")

paste("A"). This one is correct because it sends one value for the parameter in the definition

Word <- paste("x") This one is not correct because it tries to return a value to the variable "Word", but there is no return statement in the definition, so it cannot return a value.

paste( ) This one is not correct because it does not pass any values and the definition shows one parameter

paste("X", 97) This one is not correct because it tries to pass 2 values, and the definition only shows one parameter

PROCEDURE paste(x) {

PRINT(x)

}

The code above is the definition of a procedure. Which one of the procedure calls below matches this definition?

a. paste("X", 97)

b. paste("A")

c. Word <- paste("x")

d. paste( )

35
New cards

a. procedures can have 0 or more RETURN statements

Not every procedure has a RETURN statement. Some procedures can have more than one RETURN statement.

Choose the description of the number of RETURN statements in a procedure that is most accurate.

a. procedures can have 0 or more RETURN statements

b. procedures must have at least 2 RETURN statements

c. procedures cannot have a RETURN statement

d. procedures must have at least 1 RETURN statement

36
New cards

d. when the RETURN executes, the flow of control returns to the statement that called the procedure

What does the RETURN statement do? It stops the execution of the procedure that it is in, and causes the flow of control to return to the statement that called it.

Choose the description of what of a RETURN statement does inside of a procedure that is most accurate.

a. when the RETURN executes, the entire program ends

b. a RETURN statement causes the procedure to run again

c. the RETURN statement cannot be inside of a procedure

d. when the RETURN executes, the flow of control returns to the statement that called the procedure

37
New cards

b. a procedure may have 0 or more parameters

A procedure may be defined with 0 or more parameters.

Choose the number of parameters a procedure definition can have.

a. procedures cannot have parameters

b. a procedure may have 0 or more parameters

c. a procedure must have at least 1 parameter

d. procedures must have at least 2 parameters

38
New cards

a. two values must be passed as arguments when the procedure is called

the number of arguments passed in a procedure call must EXACTLY match the number of parameters in the procedure definition.

Assuming that a procedure is defined with 2 parameters, choose the most accurate statement.

a. two values must be passed as arguments when the procedure is called

b. the procedure must return 2 values after it is called

c. 2 or more values must be passed when the procedure is called

d. between 0 and 2 values must be passed when the procedure is called

39
New cards

c. you can use a procedure without understanding the details of how it works

"procedural abstraction" which means you don't have to understand all the specifics of how a procedure works, you only have to know if it needs any inputs and if it returns anything. An everyday example of procedural abstraction is driving a car. You don't have to understand how the engine works you just need to know how to start the car (probably by turning the key).

Choose the most accurate statement concerning "procedural abstraction".

a. a procedure uses abstract variables that nobody understands

b. you must understand the details of how a procedure works in order to use that procedure

c. you can use a procedure without understanding the details of how it works

d. a procedure is given an abstract name that nobody can find out

40
New cards

d. breaking down larger programming problems into smaller modules

This refers to breaking down larger programming problems into smaller modules. Modules may be re-used in other parts of the code, thus allowing the programmer to re-use code that has already been written and tested.

Choose the most accurate statement about "modularity".

a. assembling small problems into one large module

b. assigning variables to outputs

c. assigning variables to inputs

d. breaking down larger programming problems into smaller modules

41
New cards

c. 1 2 3

it prints 1 because of the 1st PRINT statement

it prints 2 because of the PRINT statement in the PROCEDURE demo3

it RETURNS 3 from the procedure call into the variable Word

it does NOT print 4 because the RETURN statement causes the flow of execution to exit demo3 before it reaches the PRINT("D") statement

it prints 3 because that is the value in the variable Word.

PROCEDURE demo3() {

PRINT(2)

RETURN(3)

PRINT(4)

}

The code above is the definition of a procedure that will be called in the statements below.

PRINT(1)

Word = demo3( )

PRINT(Word)

When the statements above run, what is printed

a. 1 2 4 3

b. 1 2 3 3

c. 1 2 3

d. 1 2 3 4

42
New cards

a. 1 2 X 3 Y

Each time the procedure is called, something new is passed for it to print.

PROCEDURE demo1(K) {

PRINT(K)

}

The code above is the definition of a procedure.

PRINT("1")

PRINT("2")

demo1("X")

PRINT("3")

demo("Y")

The computer instructions above call the procedure that is defined above. Which is the correct output of these instructions execute?

a. 1 2 X 3 Y

b. 1 2 K 3 K

c. 1 2 3 K K

d. 1 2 3 X Y

43
New cards

d. demo2( )

demo2( 7, "bye") This one is not right because it passes 2 values and the definition shows 0 parameters.

Num <- demo2( ) This one is not right because it tries to return a value to the variable "Num", but there is no RETURN statement in the definition.

demo2( ) This one is right because it does not pass any values and the definition does not show any parameters.

demo2("hello") This one is not right because it passes a value and there are 0 parameters in the definition.

PROCEDURE demo2( ) {

PRINT("hello")

}

The code above is the definition of a procedure. Choose the procedure calls below that matches this definition.

a. demo2("hello")

b. demo2( 7, "bye")

c. Num <- demo2( )

d. demo2( )

44
New cards

b. paste("A")

paste("A"). This one is correct because it sends one value for the parameter in the definition

Word <- paste("x") This one is not correct because it tries to return a value to the variable "Word", but there is no return statement in the definition, so it cannot return a value.

paste( ) This one is not correct because it does not pass any values and the definition shows one parameter

paste("X", 97) This one is not correct because it tries to pass 2 values, and the definition only shows one parameter

PROCEDURE paste(x) {

PRINT(x)

}

The code above is the definition of a procedure. Which one of the procedure calls below matches this definition?

a. paste("X", 97)

b. paste("A")

c. Word <- paste("x")

d. paste( )

45
New cards

a. procedures can have 0 or more RETURN statements

Not every procedure has a RETURN statement. Some procedures can have more than one RETURN statement.

Choose the description of the number of RETURN statements in a procedure that is most accurate.

a. procedures can have 0 or more RETURN statements

b. procedures must have at least 2 RETURN statements

c. procedures cannot have a RETURN statement

d. procedures must have at least 1 RETURN statement

46
New cards

d. when the RETURN executes, the flow of control returns to the statement that called the procedure

What does the RETURN statement do? It stops the execution of the procedure that it is in, and causes the flow of control to return to the statement that called it.

Choose the description of what of a RETURN statement does inside of a procedure that is most accurate.

a. when the RETURN executes, the entire program ends

b. a RETURN statement causes the procedure to run again

c. the RETURN statement cannot be inside of a procedure

d. when the RETURN executes, the flow of control returns to the statement that called the procedure

47
New cards

b. a procedure may have 0 or more parameters

A procedure may be defined with 0 or more parameters.

Choose the number of parameters a procedure definition can have.

a. procedures cannot have parameters

b. a procedure may have 0 or more parameters

c. a procedure must have at least 1 parameter

d. procedures must have at least 2 parameters

48
New cards

a. two values must be passed as arguments when the procedure is called

the number of arguments passed in a procedure call must EXACTLY match the number of parameters in the procedure definition.

Assuming that a procedure is defined with 2 parameters, choose the most accurate statement.

a. two values must be passed as arguments when the procedure is called

b. the procedure must return 2 values after it is called

c. 2 or more values must be passed when the procedure is called

d. between 0 and 2 values must be passed when the procedure is called

49
New cards

c. you can use a procedure without understanding the details of how it works

"procedural abstraction" which means you don't have to understand all the specifics of how a procedure works, you only have to know if it needs any inputs and if it returns anything. An everyday example of procedural abstraction is driving a car. You don't have to understand how the engine works you just need to know how to start the car (probably by turning the key).

Choose the most accurate statement concerning "procedural abstraction".

a. a procedure uses abstract variables that nobody understands

b. you must understand the details of how a procedure works in order to use that procedure

c. you can use a procedure without understanding the details of how it works

d. a procedure is given an abstract name that nobody can find out

50
New cards

d. breaking down larger programming problems into smaller modules

This refers to breaking down larger programming problems into smaller modules. Modules may be re-used in other parts of the code, thus allowing the programmer to re-use code that has already been written and tested.

Choose the most accurate statement about "modularity".

a. assembling small problems into one large module

b. assigning variables to outputs

c. assigning variables to inputs

d. breaking down larger programming problems into smaller modules

51
New cards

c. 0 or 1

What does the RANDOM( a, b) mean? RANDOM is the name of the procedure, a is the parameter that indicates the lowest random number to be generated and b is the parameter that indicates the highest number to be generated. Remember that the numbers are integers, meaning whole numbers, not decimal numbers or fractions.

RANDOM( 0, 1)

For the instruction above, choose the possible numbers that could be generated.

a. 0 or 10

b. only 0

c. 0 or 1

d. only 1

52
New cards

d. -1, 0 or 1

All integers between -1 and 1 inclusive, so -1, 0, or 1

RANDOM( -1, 1)

For the instruction above, choose the possible numbers that could be generated.

a. -1 or 0

b. -1 or -2

c. -1 or 1

d. -1, 0 or 1

53
New cards

a. integers which are whole numbers

Remember that the numbers RANDOM generates are integers, meaning whole numbers, not decimal numbers or fractions.

RANDOM( 7, 11)

Choose the type of numbers that the statement above would generate.

a. integers which are whole numbers

b. equations and variables

c. fractions

d. decimal numbers

54
New cards

b. the highest random number to be generated

What does the RANDOM( a, b) mean? RANDOM is the name of the procedure, a is the parameter that indicates the lowest random number to be generated and b is the parameter that indicates the highest number to be generated.

RANDOM( 2, 7)

In the statement above, what does the 7 indicate?

a. the lowest random number to be generated

b. the highest random number to be generated

c. the number of times to create a random number

d. the amount of possible values that could be generated

55
New cards

a. it is the lowest possible random number that will be generated

What does the RANDOM( a, b) mean? RANDOM is the name of the procedure, a is the parameter that indicates the lowest random number to be generated and b is the parameter that indicates the highest number to be generated.

RANDOM( -3, 9)

In the statement above, what does the -3 indicate?

a. it is the lowest possible random number that will be generated

b. it is the highest random number that will be generated

c. it is the amount of random numbers to be generated

d. it is the number of decimal places the random number will have

56
New cards

d. random numbers can be used to get random items from a list

What can random numbers be used for? They can be used to get random items from a list as you will see in the next exercise. They can be used to simulate real-world conditions such as weather, crowds, and games of chance. They can be used to encrypt information and to select unbiased responses for research.

Choose one of the following statement about lists that is most accurate.

a. random numbers cannot be applied to lists

b. random numbers can only be used to get list items that are also numbers

c. list items are in a specific order and cannot be randomized

d. random numbers can be used to get random items from a list

57
New cards

a. each number from 2 to 9 is equally likely to occur

It is reasonable to think that the RANDOM procedure will not favor any of the possible random numbers so that if you ran it enough times, no particular number would be over-represented because each number is equally likely to occur.

RANDOM( 2, 9)

For the statement above, which statement is most accurate?

a. each number from 2 to 9 is equally likely to occur

b. the numbers 2 and 9 are most likely to occur

c. the lower numbers are more likely to occur

d. the higher numbers are more likely to occur

58
New cards

d. it will probably generate a different number the next time it runs

the procedure RANDOM (6, 22) should generate a random number from 6 to 22 every time it executes. The next time it executes, it will probably not generate the same random number, but it possibly could.

RANDOM (6, 22)

If the statement above ran and generated 9, which of the following statements is most accurate?

a. it cannot generate the same number the next time it runs

b. it will generate a higher number the next time it runs

c. it will probably generate the same number the next time it runs

d. it will probably generate a different number the next time it runs

59
New cards

b. it is possible it could generate a 5 the next time it runs

The procedure RANDOM (1, 8) should generate a random number from 1 to 8 every time it executes. The next time it executes, it will probably not generate the same random number, but it possibly could. It is reasonable to think that the RANDOM procedure will not favor any of the possible random numbers so that if you ran it enough times, no particular number would be over-represented.

RANDOM (1, 8)

If the statement above ran and generated 5, which of the following statements is most accurate?

a. it will probably generate a 5 the next time it runs

b. it is possible it could generate a 5 the next time it runs

c. it is not possible for it to generate a 5 the next time it runs

d. the next time it will generate a 6

60
New cards

c. 3, 4, 5 or 6

The 3 is the lowest possible random number and 6 is the highest possible random number

RANDOM (3, 6)

What numbers would the statement above possibly generate?

a. 4, or 5

b. 3 or 6

c. 3, 4, 5 or 6

d. 3, 4 or 5

61
New cards

d. the hypothesis may change based on the results of the simulation

Simulations may be run many times. The hypothesis may be changed or refined depending on the results of the simulation. The simulation may also be changed depending on results, and run again.

Choose the statement that is most accurate about what happens to a hypothesis as a simulation is run many times.

a. the hypothesis must stay the same throughout all of the simulation runs

b. it is not allowed to have a hypothesis when using a simulation

c. the simulations will prove the hypothesis to be correct

d. the hypothesis may change based on the results of the simulation

62
New cards

b. simulation bias

When a simulation is being created, designers make decisions on which factors will be considered in the simulation and which ones will not. This is an effort to reduce the complexity of a real-world phenomenon while keeping important factors. This can cause the simulation to have bias based on the designers choices of which factors are included in the simulation and which ones are not.

Assume that the simulation designers left certain real-world factors out of the simulation, which changed the results of the simulation. Choose the expression that best describes that.

a. factor overload

b. simulation bias

c. real-world bias

d. data overload

63
New cards

a. some details have been removed and functionality simplified

Why are computer simulations considered "abstract"? Specific details of the real-world phenomenon may be removed to create the computer simulation. The functionality of the simulation may be simplified when compared to the real-world version.

Choose the most accurate description of why a simulation is considered "abstract" when compared to a real-world phenomenon.

a. some details have been removed and functionality simplified

b. because the simulation is hard to understand

c. because bright colors and shapes are added to the simulation

d. because it has more details and more complex functionality than real-world

64
New cards

c. they can simulate variability of the real-world

Random number generators can be used to simulate the variability that exists in the real world.

Choose the most accurate statement about random number generators being used in simulations.

a. random numbers would falsify the conclusions of a simulation

b. random number generators should only be used when the real numbers are too dangerous

c. they can simulate variability of the real-world

d. they cannot simulate the variability of the real world

65
New cards

d. when simulations are cheaper than real-world experiments

Simulations are most useful when real-world events are impractical for experiments (e.g., too big, too small, too fast, too slow, too expensive, or too dangerous).

Choose the most accurate description about when to make the choice to use computer simulations instead of real-world experiments.

a. when real-world experiments are cheaper than simulations

b. when it looks like simulations and real-world experiments will prove the same thing

c. when the cost is not a factor

d. when simulations are cheaper than real-world experiments

66
New cards

b. when the simulation is safer than a real-world experiment

Simulations are most useful when real-world events are impractical for experiments (e.g., too big, too small, too fast, too slow, too expensive, or too dangerous).

Choose the most accurate description about when to make the choice to use computer simulations instead of real-world experiments.

a. when you don't need the information that simulations or real-world experiments might provide

b. when the simulation is safer than a real-world experiment

c. when a real-world experiment is safer than a computer simulation

d. when a simulation provides less accurate data than real-world experiments

67
New cards

d. it is caused by designers choices about which real-world factors to include in the simulation

When a simulation is being created, designers make decisions on which factors will be considered in the simulation and which ones will not. This is an effort to reduce the complexity of a real-world phenomenon while keeping important factors. This can cause the simulation to have bias based on the designers choices of which factors are included in the simulation and which ones are not. In the typhoon example, an experiment designer who does not believe in climate change may eliminate factors like rising sea temperature or thinning ozone layer. These omissions may change the results of a simulation.

Choose the statement about "simulation bias" that is most accurate.

a. it is caused by a simulation's tendency to reveal data that was not expected

b. people tend to be biased towards real-world experiences over simulations

c. it is caused by expectations of society

d. it is caused by designers choices about which real-world factors to include in the simulation

68
New cards

c. simulation designers make decisions on important factors to include in the simulation, but all factors may not be included

When a simulation is being created, designers make decisions on which factors will be considered in the simulation and which ones will not. This is an effort to reduce the complexity of a real-world phenomenon while keeping important factors.

Choose the statement about including real-world factors in simulations that is most accurate.

a. the fewer real-world factors in the simulation the better

b. all real-world factors must be included in the simulation

c. simulation designers make decisions on important factors to include in the simulation, but all factors may not be included

d. no real-world factors can be included in a simulation

69
New cards

b. a simulation may be run many times

Simulations may be run many times. The hypothesis may be changed or refined depending on the results of the simulation. The simulation may also be changed depending on results, and run again.

Choose the statement about running simulations that is most accurate.

a. every time a simulation is run it must be exactly the same as the previous time

b. a simulation may be run many times

c. a simulation is run only once

d. a simulation must not be run, that would make it real-world

70
New cards

a. A simulation is an abstract representation of a more complex object or phenomenon

What is a computer simulation? It is an abstract representation of a real-world problem, task, or object, which is created for a specific purpose. The computer simulation is simpler and less complex than the real-world phenomenon that it represents.

Choose the statement is the most accurate description of a computer simulation.

a. A simulation is an abstract representation of a more complex object or phenomenon

b. Simulations have the same amount of complexity as the real-world phenomenon that they represent

c. Simulations are mostly used for entertainment.

d. A simulation is more complex than the real-world thing it represents

71
New cards

a. if there is no efficient algorithm to solve a problem it may not be done in a reasonable time

Why is it that some problems cannot be solved in a reasonable time? Because there is no efficient algorithm to solve them. With such problems, "approximate" solutions are looked for. While it is not within the scope of this lesson to investigate "approximate" solutions, this helps us to understand that there is a limit to what computer programs can do.

Choose the statement about not being able to solve problems in a reasonable time that is most accurate.

a. if there is no efficient algorithm to solve a problem it may not be done in a reasonable time

b. there are no problems that are solved in a reasonable time

c. any problem with a solution is in a reasonable time

d. it just depends on how critical the data is as to whether you consider the time reasonable

72
New cards

b. a solution that may involve trial-and-error, but is acceptable

What is a "heuristic" solution? This is a word that indicates solving a problem through experimentation. This is not a single algorithm but possibly the trial-and-error use of many algorithms to find a solution that may not be perfect, but may be good enough. A heuristic solution ma be used instead of an approach that may find a better solution but may not do it in a reasonable amount of time. I searched for a "heuristic" visual and found the graphic at the right.

Choose the description of a "heuristic" solution that is most accurate.

a. a solution that does not have a problem

b. a solution that may involve trial-and-error, but is acceptable

c. a solution that is not correct

d. a solution that takes too much time

73
New cards

b. an algorithm with constant or linear efficiency is reasonable

Algorithms with a polynomial efficiency or slower (constant, linear, square, cube, etc.) are said to run in a reasonable amount of time. Algorithms with exponential or factorial efficiencies are examples of algorithms that run in an unreasonable amount of time.

Choose the statement about an algorithm's reasonable efficiency (or solving a problem in a reasonable amount of time) that is most accurate.

a. an algorithm with factorial efficiency is reasonable

b. an algorithm with constant or linear efficiency is reasonable

c. any algorithm with a solution has reasonable efficiency

d. an algorithm with exponential efficiency is reasonable

74
New cards

c. There can be different algorithms to solve the same problem and they can have different efficiencies

Can there be more than one algorithm to solve the same problem? Yes, and those different algorithms may have different efficiencies

Choose the statement about algorithms for problems that is most accurate.

a. A problem cannot have an algorithm that solves it

b. There can be different algorithms to solve the same problem but they must have the same efficiency

c. There can be different algorithms to solve the same problem and they can have different efficiencies

d. There can be only one algorithm to solve a problem

75
New cards

d. a problem that must find the best solution

What is an "optimization" problem? It is a problem of finding the best solution. For example, given many different modes of transportation, what is the cheapest way to get from Mexico City to Oaxaca, Mexico?

Choose the best description of an "optimization" problem.

a. a problem with a "yes" or "no" answer

b. a problem that needs to be re-worded

c. a solution that needs a better problem

d. a problem that must find the best solution

76
New cards

b. a problem with a "yes" or "no" solution

What is a "decision" problem? It is a problem that has a "yes" or "no" solution. For example, given a certain amount of fuel, can a rocket reach Mars?

Choose the best description of a "decision" problem.

a. a solution that does not have a problem

b. a problem with a "yes" or "no" solution

c. a problem that must find the best solution

d. a problem that does not have a solution

77
New cards

d. the number of inputs to the algorithm

What is the variable "n"? The variable "n" is used to represent the number of items input. In some cases it could be the number of items in a list to be sorted or some other data structure.

Choose the best description of what the variable "n" stands for.

a. the number of outputs from the algorithm

b. the number of seconds it takes the algorithm to solve the problem

c. the number of times the algorithm must repeat to solve the problem

d. the number of inputs to the algorithm

78
New cards

a. in computation resources, such as the number of steps or decisions

What is "algorithmic efficiency"? It basically means how fast a computer program can solve a problem. That being said, the efficiency is typically not measured in time, but in computation resources, which includes amount of memory and number of steps, where the steps are decisions that the computer makes.

Choose the best description of how algorithm efficiency is measured.

a. in computation resources, such as the number of steps or decisions

b. in variables and output

c. in bits and bytes

d. in milliseconds and nanoseconds

79
New cards

b. a general description of a task that an algorithm needs to solve or complete

What is a "problem"? In the current context it is a general description of a task that an algorithm needs to solve or complete. It may or may not be solvable by a computer algorithm. An example could be to sort the items in a list from smallest to largest.

Choose the best description of a "problem" in terms of computer algorithms.

a. what happens to an algorithm if it encounters something it can't solve

b. a general description of a task that an algorithm needs to solve or complete

c. a specific description of a task that requires specific input values

d. an algorithm that causes an error

80
New cards

c. an instance is a problem with specific input

What is an "instance of a problem"? This is a problem with specific information. The example of a problem is to sort a list from smallest to largest. The example of an instance of a problem would be to sort the list { 34, 5, 17, 2, 97 } from smallest to largest.

Choose the best description of the difference between a "problem" and an "instance" of a problem.

a. an instance can contain several problems

b. a problem is an instance with specific input

c. an instance is a problem with specific input

d. an instance and a problem are the same thing

81
New cards

a. all instances of the problem must have a "yes" or "no" outcome

What makes a problem "decidable"? The solution algorithm must create a "yes" or "no" output for all inputs, so every instance of the problem must have an acceptable output.

Choose the statement about a decidable problem that is most accurate.

a. all instances of the problem must have a "yes" or "no" outcome

b. no instances of the problem must have a yes or no outcome

c. the majority of instances must have a yes or no outcome

d. at least one instance of the problem must have a yes or no outcome

82
New cards

b. if even one instance of a problem does not have a yes or no outcome, then it is undecidable

What makes a problem "undecidable"? If an algorithm cannot be written that produces a "yes" or "no" output for the problem, or if the algorithm only gives appropriate output for some inputs and not others, then the problem is considered "undecidable". If an algorithmic solution can solve some instances of a problem, but not others, then it is considered an "undecidable" problem.

Choose the statement about an undecidable problem that is most accurate.

a. if any instance has a yes or no outcome, then it can NOT be undecidable

b. if even one instance of a problem does not have a yes or no outcome, then it is undecidable

c. if all instances of the problem have a yes or no outcome, it is undecidable

d. if the majority of instances do not have a yes or no outcome, then it is undecidable

83
New cards

c. if an algorithm cannot be constructed that produces a yes or no outcome, then it is considered undecidable

What makes a problem "undecidable"? If an algorithm cannot be written that produces a "yes" or "no" output for the problem, then it is considered undecidable. If the algorithm only gives appropriate output for some inputs and not others, then the problem is considered "undecidable". If an algorithmic solution can solve some instances of a problem, but not others, then it is considered an "undecidable" problem.

Choose the statement about an undecidable problem that is most accurate.

a. if a problem has two solutions that have different efficiencies, then the problem is considered undecidable

b. if an algorithm can be constructed that has a yes or no outcome, then the problem is undecidable

c. if an algorithm cannot be constructed that produces a yes or no outcome, then it is considered undecidable

d. any problem with more than one solution algorithm is considered undecidable

84
New cards

d. it can have some instances that have "yes" or "no" solutions

What makes a problem "undecidable"? If an algorithm cannot be written that produces a "yes" or "no" output for the problem, then it is considered undecidable. If the algorithm only gives appropriate output for some inputs and not others, then the problem is considered "undecidable". If an algorithmic solution can solve some instances of a problem, but not others, then it is considered an "undecidable" problem.

Choose the statement about an undecidable problem that is most accurate.

a. it cannot have any instances that have yes or no solutions

b. it must have at least one instance with a yes or no solution

c. if any instances have yes or no solutions it cannot be undecidable

d. it can have some instances that have "yes" or "no" solutions

85
New cards

b. you need to know the definition of undecidable problems, not how to determine if a problem is undecidable

What does the EXCLUSION STATEMENT mean? We only need to understand the terms "decidable" and "undecidable", we do not need to be able to determine if a problem actually is decidable or undecidable. The goal is that we be able to explain the existence of undecidable problems, not that we be experts in diagnosing them.

Choose the explanation of AP requirements concerning undecidable problems that is most accurate.

a. you need to convert undecidable problems to decidable

b. you need to know the definition of undecidable problems, not how to determine if a problem is undecidable

c. given a problem, you need to determine whether or not it is undecidable

d. given a problem, you need to determine how many instances are undecidable

86
New cards

c. rules on how to use procedures in a library

What is an API? Application Program Interface is a set of rules or agreements on how the library procedures are used. For example, the library may contain specific variables that programmers will use or other expectations that the programmer can rely on to understand how the library procedures work. A non-programming example of this is an electrical outlet. It has 3 holes that are a specific size and distance from each other, the round one is always attached to "ground". The other two are shaped like narrow slots, the larger one is attached to "neutral" and the smaller one is attached to power. Any device that is plugged into a power outlet can expect these basic things to be true.

Choose the most appropriate description of API (Application Program Interface).

a. programs that find errors

b. rules on how to find programming errors

c. rules on how to use procedures in a library

d. procedures for finding errors

87
New cards

a. saving time by using existing code

What makes software libraries valuable? They contain procedures that have already been created and tested. This could represent weeks or even months of a programmer's effort. It only makes sense that other programmers would want to use these procedures rather than waste their own time developing procedures that do the same thing.

Choose the best description of the advantage of using library procedures.

a. saving time by using existing code

b. there is no advantage to using library procedures

c. it makes the program run faster

d. saving space in the program

88
New cards

b. it helps programmers find and understand the most appropriate library

What about documentation? While an API is a form of documentation, there may be even more extensive documentation about how the library procedures work and what they do. This documentation is important for programmers to be able to find and choose library procedures that they need. If a programmer finds to similar libraries, they will read the documentation to compare the different sets of procedures to find the one that best suits their needs.

Choose the most accurate description of why documentation is important.

a. documentation makes the code run faster

b. it helps programmers find and understand the most appropriate library

c. it is not really important

d. it is legally required for all libraries

89
New cards

a. programming procedures that have already been created and tested

What makes software libraries valuable? They contain procedures that have already been created and tested. This could represent weeks or even months of a programmer's effort. It only makes sense that other programmers would want to use these procedures rather than waste their own time developing procedures that do the same thing.

Choose the statement that best describes what software libraries contain.

a. programming procedures that have already been created and tested

b. programming procedures that have not been tested and are not ready for use

c. a table of contents and appendix

d. fiction and non-fiction books in electronic form

90
New cards

c. software developers who are creating new applications using procedures from the library

Choose the most accurate description of who would use software libraries.

a. software users who are looking for new input

b. software developers who are looking for a place to put code that is not being used anymore

c. software developers who are creating new applications using procedures from the library

d. software librarians who keep it safe

91
New cards

Still learning (3)

You've started learning these terms. Keep it up!

92
New cards

d. it is a type of computing system

What is a "computer network"? It is a group of computing devices that are connected together in such a way that they can send and receive information to each other. It is one type of computing system.

Choose the statement about a computer network that is most accurate.

a. it is a type of computing device

b. it is a type of bandwidth

c. it is a type of path

d. it is a type of computing system

93
New cards

c. a lower bandwidth means less data is transmitted in the same amount of time

What is "bandwidth"? This is a term that describes the amount of data that can be passed to and from a computer. It is usually measured in bits per second. Computers or paths with low bandwidth take longer to pass data.

Choose the statement about bandwidth that is most accurate.

a. a high bandwidth means data is less accurate

b. a lower bandwidth means more data is transmitted in the same amount of time

c. a lower bandwidth means less data is transmitted in the same amount of time

d. a high bandwidth means that data is more accurate

94
New cards

a. data between the same two computers may not always be on the same path

Data will not always be routed on the same path between the same two computers.

Choose the statement about routing data that is most accurate.

a. data between the same two computers may not always be on the same path

b. once a path is established, the data gets slower

c. once a path is established, the data moves faster and faster

d. data between the same two computers will always be on the same path

95
New cards

b. in bits per second

It is usually measured in bits per second. Computers or paths with low bandwidth take longer to pass data.

Choose the best description of how data bandwidth is measured.

a. in packets per path

b. in bits per second

c. in miles per hour

d. in files per session

96
New cards

c. the amount of data that can be passed to and from a computing device

What is "bandwidth"? This is a term that describes the amount of data that can be passed to and from a computer. It is usually measured in bits per second. Computers or paths with low bandwidth take longer to pass data.

Choose the best description of data "bandwidth".

a. the amount of computers on a network

b. the size of a computer's memory

c. the amount of data that can be passed to and from a computing device

d. the size of a file that will be transmitted

97
New cards

d. choosing a path for data from one computer to another

What is "routing"? This involves choosing the best path to transmit data between devices on a network. Data will not always be routed on the same path between the same two computers. Data may be broken up to take several different paths, then re-assembled at the receiving computer.

Choose the best description of network "routing".

a. breaking up data into smaller packets

b. choosing which data will be transmitted

c. choosing where to put network cables

d. choosing a path for data from one computer to another

98
New cards

b. the route that data takes to go from one computer to another computer

What is a "path"? It is the route that information takes to get from one computer on a network to another computer on the network. There may be other devices between the sending and receiving computers that pass the information along.

Choose the best description of a network "path".

a. the IP addresses to all of the devices on the network

b. the route that data takes to go from one computer to another computer

c. the physical layout of a network and where each computer is

d. the amount of cable needed to connect all the devices

99
New cards

a. a group of computing devices that are connected so that they can send and receive data to each other

What is a "computer network"? It is a group of computing devices that are connected together in such a way that they can send and receive information to each other. It is one type of computing system.

Choose the best description of a "computer network".

a. a group of computing devices that are connected so that they can send and receive data to each other

b. a group of computing devices that belong to the same organization

c. a group of computing devices that all have the same IP address

d. a group of computing devices that cannot send or receive data

100
New cards

d. a group of computing devices and programs that work on a task together

What is a "computing system"? It is a collection of computing devices and programs that work on a task together.

Choose the best description of a "computing system".

a. anything that has a screen or keyboard

b. anything that can respond to input

c. anything that can run a program

d. a group of computing devices and programs that work on a task together