AP CSP Part 2

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/29

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

30 Terms

1
New cards

Consider the following algorithms. Each algorithm operates on a list containing n elements, where n is a very large integer.

  1. An algorithm that accesses each element in the list twice

  2. An algorithm that accesses each element in the list n times

  3. An algorithm that accesses only the first 10 elements in the list, regardless of the size of the list

Which of the algorithms run in reasonable time?

Responses

A

I only

B

III only

C

I and II only

D

I, II, and III

D. I, II, and III

2
New cards

A smartphone stores the following data for each photo that is taken using the phone.

  • The file name of the photo

  • The date and time the photo was taken

  • The geographic location where the photo was taken

Assume that all of the photos that have been taken on the phone are accessible.

Which of the following can be determined using the photo data described?

      I. The number of photos that were taken at a particular geographic location
     II. The number of photos that were taken in the last year
    III. The name of the person who took the most recent photo

Responses

A

III only

B

I and II only

C

I and III only

D

I, II, and III

I and II only

3
New cards

A media librarian at a movie studio is planning to save digital video files for archival purposes. The movie studio would like to be able to access full-quality videos if they are needed for future projects.

Which of the following actions is LEAST likely to support the studio’s goal?

Responses

A

Using video file formats that conform to published standards and are supported across many different devices

B

Using lossy compression software to reduce the size requirements of the data being stored

C

Using storage media that can be expanded for additional data capacity

D

Using a system that incorporates redundancy to handle disk failure


Using lossy compression software to reduce the size requirements of the data being stored

4
New cards

A musician is creating a song using audio samples. Which of the following actions will minimize the risk of a copyright violation when creating sample-based music?

Responses

A

Using samples found on popular music-streaming sites

B

Using samples found on peer-to-peer networks

C

Using samples from nondigital sound sources (vinyl records, tapes, etc.)

D

Using samples published with a no-rights-reserved Creative Commons license

Using samples published with a no-rights-reserved Creative Commons license

5
New cards

Which of the following scenarios best exemplifies a phishing attack?

Responses

A

A user connects to a public wireless network. An unauthorized individual intercepts data transmitted on the network, looking for private information that can be used to gain access to the user’s accounts.

B

A user’s e-mail account is overwhelmed with messages containing large attachments, which causes the account to exceed the maximum amount of data allowed and temporarily prevents the user from sending and receiving new messages.

C

A user receives an e-mail from a sender offering technical help with the user’s computer. The e-mail prompts the user to start a help session by clicking a provided link and entering the username and password associated with the user’s computer.

D

A user chooses a weak password for an online account. An unauthorized individual successfully guesses the user’s password from a list of common passwords.

A user receives an e-mail from a sender offering technical help with the user’s computer. The e-mail prompts the user to start a help session by clicking a provided link and entering the username and password associated with the user’s computer.

6
New cards

In a science experiment, result X is expected to occur 25% of the time and result Y is expected to occur the remaining 75% of the time. The following code segment is intended to simulate the experiment if there are 100 trials.

Line 1:  xCount 0

Line 2:  yCount 0

Line 3:  REPEAT 100 TIMES

Line 4:  {

Line 5:     IF(RANDOM(1, 4) = 1)

Line 6:     {

Line 7:        xCount xCount + 1

Line 8:     }

Line 9:     IF(RANDOM(1, 4) > 1)

Line 10:    {

Line 11:       yCount yCount + 1

Line 12:    }

Line 13: }

Line 14: DISPLAY("Result X occurred")

Line 15: DISPLAY(xCount)

Line 16: DISPLAY("times and result Y occurred")

Line 17: DISPLAY(yCount)

Line 18: DISPLAY("times.")

A programmer runs the code segment, and the following message is displayed.

Result X occurred 24 times and result Y occurred 70 times.

The result shows that 94 trials were counted, rather than the intended 100 trials.

Which of the following changes to the code segment will ensure a correct simulation of the experiment?

Responses

A

Replacing line 9 with IF(RANDOM(1, 4) ≥ 2)

B

Replacing line 9 with ELSE

C

Interchanging lines 5 and 9

D

Interchanging lines 7 and 11

Replacing line 9 with ELSE

7
New cards

The following algorithm is intended to take a positive integer as input and display its individual digits in order from right to left. For example, if the input is 512, the algorithm should produce the output 2 1 5. Step 3 of the algorithm is missing.

Step 1: Input a positive integer from the user and store it in the variable number.

Step 2: Divide number by 10 and record the integer quotient and the remainder. The integer quotient is the quotient with any part after the decimal point dropped. For example, when 127 is divided by 10, the quotient is 12.7, the integer quotient is 12 and the remainder is 7.

Step 3: (missing step)

Step 4: Repeat steps 2 and 3 until number is 0.

Which of the following can be used as step 3 so that the algorithm works as intended?

Responses

A

Step 3: Display the remainder of number divided by 10 and store the remainder in number.

B

Step 3: Display the remainder of number divided by 10 and store the integer quotient in number.

C

Step 3: Display the integer quotient of number divided by 10 and store the remainder in number.

D

Step 3: Display the integer quotient of number divided by 10 and store the integer quotient in number.

Step 3: Display the remainder of number divided by 10 and store the integer quotient in number.

8
New cards

In which of the following situations would it be most appropriate to choose lossy compression over lossless compression?

Responses

A

Storing digital photographs to be printed and displayed in a large format in an art gallery

B

Storing a formatted text document to be restored to its original version for a print publication

C

Storing music files on a smartphone in order to maximize the number of songs that can be stored

D

Storing a video file on an external device in order to preserve the highest possible video quality

Storing music files on a smartphone in order to maximize the number of songs that can be stored

9
New cards

If a game is begun by placing the game piece on the rightmost black space for step 1, what will be the value of the counter at the end of the game?

Responses

A. 2

B. 3

C. 4

D.5

C. 4

10
New cards

Delivery trucks enter and leave a depot through a controlled gate. At the depot, each truck is loaded with packages, which will then be delivered to one or more customers. As each truck enters and leaves the depot, the following information is recorded and uploaded to a database.

  • The truck’s identification number

  • The truck’s weight

  • The date and time the truck passes through the gate

  • Whether the truck is entering or leaving the depot

Using only the information in the database, which of the following questions CANNOT be answered?

Responses

A

On which day in a particular range of dates did the greatest number of trucks enter and leave the depot?

B

What is the average number of customer deliveries made by each truck on a particular day?

C

What is the change in weight of a particular truck between when it entered and left the depot?

D

Which truck has the shortest average time spent at the depot on a particular day?

What is the average number of customer deliveries made by each truck on a particular day?

11
New cards

A researcher wrote a program to simulate the number of mice in an environment that contains predators. The program uses the following procedures.

Code for the simulation is shown below.

Based on the code, which of the following assumptions is made in the simulation?

Responses

A

The number of mice increases by 1 each day.

B

The number of mice does not change from day to day.

C

The number of predators increases by 1 each day.

D

The number of predators does not change from day to day.

The number of predators does not change from day to day.

12
New cards

Which of the following are ways in which a programmer can use abstraction to manage the complexity of a program?

Select two answers.

response - correct

Responses

A

Replacing each instance of repeated code with a call to a procedure

B

Replacing longer variable names with shorter variable names to reduce typing errors

C

Replacing several lines of documentation with a single line of documentation

D

Replacing the string variables 

One word, name 1

One word, name 2

One word, name 3

, and 

One word, name 4

 with a list of strings
called 

names

A, D

13
New cards

A group of planners are using a simulation to examine whether or not a park that they are designing is going to affect foot traffic in the area. The simulation uses a model that includes input variables for the park such as the number of entrances, sidewalks, and bike trails and the square footage of open space (grassy areas). The simulation can then be run multiple times using different values for the input variables to represent different park designs.

However, the simulation takes a very long time to run. The planners update the model by removing some variables they consider less important than others.

Of the following, which is the most likely effect the updated model will have on the simulation?

Responses

A

The updated model is likely to decrease the runtime of the simulation because the time required for simulations generally depends on the complexity of the model used.

B

The updated model is likely to decrease the runtime of the simulation because simulations that use older models tend to require more time to run than simulations that use newer models.

C

The updated model is unlikely to decrease the runtime of the simulation because the simulation is computationally complex, regardless of the model used.

D

The updated model is unlikely to provide any benefit because removing details from a model will compromise the accuracy of the simulation.

A. The updated model is likely to decrease the runtime of the simulation because the time required for simulations generally depends on the complexity of the model used.

14
New cards

Which of the following is an example of symmetric encryption?

Responses

A

Evy buys a locked box that operates using two different codes. When the first code is entered, a slot opens that allows a message to be put in the box. When the second code is entered, the door to the box opens. Evy gives the first code to her friends so they can leave messages for her and keeps the second code to herself so that she is the only one who can retrieve the messages.

B

Finn and Gwen develop a system that maps each letter of the alphabet to a unique symbol using a secret key. Finn uses the key to write a message to Gwen where each letter is replaced with the corresponding symbol. Gwen uses the key to map each symbol back to the original letter.

C

Hannah writes a message to send to Isabel and hides the message under a rock behind the soccer field. Hannah gives Isabel the exact location of the rock so that only Isabel can find the message.

D

Juan writes a message to send to Kelly and slides the message through a slot in the front of Kelly’s locker. Juan knows that Kelly has not shared her locker combination with anyone, so no one other than Kelly will be able to read the message.

B. Finn and Gwen develop a system that maps each letter of the alphabet to a unique symbol using a secret key. Finn uses the key to write a message to Gwen where each letter is replaced with the corresponding symbol. Gwen uses the key to map each symbol back to the original letter.

15
New cards

A list of numbers is considered increasing if each value after the first is greater than or equal to the preceding value. The following procedure is intended to return true if numberList is increasing and return false otherwise. Assume that numberList contains at least two elements.

Line 1:  PROCEDURE isIncreasing(numberList)

Line 2:  {

Line 3:     count 2

Line 4:     REPEAT UNTIL(count > LENGTH(numberList))

Line 5:     {

Line 6:        IF(numberList[count] < numberList[count - 1])

Line 7:        {

Line 8:           RETURN(true)

Line 9:        }

Line 10:       count count + 1

Line 11:    }

Line 12:    RETURN(false)

Line 13: }

Which of the following changes is needed for the program to work as intended?

Responses

A

In line 3, 2 should be changed to 1.

B

In line 6, < should be changed to .

C

Lines 8 and 12 should be interchanged.

D

Lines 10 and 11 should be interchanged.

Lines 8 and 12 should be interchanged.

16
New cards

Which of the following best exemplifies the use of multifactor authentication to protect an online banking system?

Responses

A

When a user resets a password for an online bank account, the user is required to enter the new password twice.

B

When multiple people have a shared online bank account, they are each required to have their own unique username and password.

C

After entering a password for an online bank account, a user must also enter a code that is sent to the user’s phone via text message.

D

An online bank requires users to change their account passwords multiple times per year without using the same password twice.

C. After entering a password for an online bank account, a user must also enter a code that is sent to the user’s phone via text message.

17
New cards

A student is creating a procedure to determine whether the weather for a particular month was considered very hot. The procedure takes as input a list containing daily high temperatures for a particular month. The procedure is intended to return  if the daily high temperature was at least 90 degrees for a majority of days in the month and return  otherwise.

Which of the following can be used to replace 

missing code

 so that the procedure works as intended?

Responses

A

Counter, less than, 0 point 5, times, total

B

Counter, greater than, 0 point 5, times, total

C

total, less than, 0 point 5, times, counter

D

total, greater than, 0 point 5, times, counter

B.

Counter, greater than, 0 point 5, times, total

18
New cards

Which of the following actions are likely to be helpful in reducing the digital divide?

Select two answers.

response - correct

Responses

A

Designing new technologies intended only for advanced users

B

Designing new technologies to be accessible to individuals with different physical abilities

C

Implementing government regulations restricting citizens’ access to Web content

D

Having world governments support the construction of network infrastructure

B. Designing new technologies to be accessible to individuals with different physical abilities


D. Having world governments support the construction of network infrastructure

19
New cards

A person wants to transmit an audio file from a device to a second device. Which of the following scenarios best demonstrates the use of lossless compression of the original file?

Responses

A

A device compresses the audio file before transmitting it to a second device. The second device restores the compressed file to its original version before playing it.

B

A device compresses the audio file by removing details that are not easily perceived by the human ear. The compressed file is transmitted to a second device, which plays it.

C

A device transmits the original audio file to a second device. The second device removes metadata from the file before playing it.

D

A device transmits the original audio file to a second device. The second device plays the transmitted file as is.

A device compresses the audio file before transmitting it to a second device. The second device restores the compressed file to its original version before playing it.

20
New cards

A code segment is intended to transform the list utensils so that the last element of the list is moved to the beginning of the list.

For example, if utensils initially contains  ["fork", "spoon", "tongs", "spatula", "whisk"],it should contain ["whisk", "fork", "spoon", "tongs", "spatula"] after executing the code segment.

Which of the following code segments transforms the list as intended?

Responses

A

len LENGTH(utensils)

temp utensils[len]

REMOVE(utensils, len)

APPEND(utensils, temp)

B

len LENGTH(utensils)

REMOVE(utensils, len)

temp utensils[len]

APPEND(utensils, temp)

C

len LENGTH(utensils)

temp utensils[len]

REMOVE(utensils, len)

INSERT(utensils, 1, temp)

D

len LENGTH(utensils)

REMOVE(utensils, len)

temp utensils[len]

INSERT(utensils, 1, temp)

C. len LENGTH(utensils)

temp utensils[len]

REMOVE(utensils, len)

INSERT(utensils, 1, temp)

21
New cards

A list of binary values (0 or 1) is used to represent a black-and-white image. Which of the following is LEAST likely to be stored as metadata associated with the image?

Responses

A

Copyright information for the image

B

The date and time the image was created

C

The dimensions (number of rows and columns of pixels) of the image

D

A duplicate copy of the data

D. A duplicate copy of the data

22
New cards

The following procedure is intended to return the value of x times y, where x and y are integers. Multiplication is implemented using repeated additions.

The figure presents a block of code that consists of 7 lines. Throughout the block of code there are nested blocks of code. [Begin Block] Line 1: PROCEDURE Multiply [begin block] x, y [end block] [Begin Block] Line 2: [begin block] count ← 0 [end block] Line 3: [begin block] result ← 0 [end block] [Begin Block] Line 4: REPEAT UNTIL [begin block] count ≥ y [end block] [Begin Block] Line 5: [begin block] result ← result + x [end block] Line 6: [begin block] count ← count + 1 [end block] [End Block] [End Block] Line 7: [begin block] RETURN [begin block] result [end block] [end block] [End Block] [End Block]

For which of the following procedure calls does the procedure NOT return the intended value?

Select two answers.

response - correct

Responses

A

B

C

D

B

The figure presents a line of code. The line of code contains a nested block of code. Line 1: [begin block] Multiply [begin block] 2, −5 [end block] [end block]

D. -2,-5

23
New cards

The ticket prices at a movie theater are given below.

A programmer is creating an algorithm to set the value of  based on the information in the table. The programmer uses the integer  variable  for the age of the moviegoer. The Boolean variable  is  when the movie is 3-D and  otherwise.

Which of the following code segments correctly sets the value of 

One word, ticket Price

 ?

Responses

A

The block code consists of 5 lines. Some of the lines of code are indented. The code uses the variable ticket Price, closed up with initial capital P, henceforth referred to as ticket Price. Line 1: ticket Price left arrow 12 Begin block Line 2: IF begin block, begin block, age less than or equal to 12, end block, OR, begin block, age greater than or equal to 60, end block, end block Begin block Line 3, indented 1 tab: ticket Price left arrow 9 End block End block Begin block Line 4: IF begin block is 3 D, closed up with numeral 3 and capital D, end block Begin block Line 5, indented 1 tab: ticket Price left arrow 17 End block End block

B

The block code consists of 5 lines. Some of the lines of code are indented. The code uses the variable ticket Price, closed up with initial capital P, henceforth referred to as ticket Price. Line 1: ticket Price left arrow 12 Begin block Line 2: IF begin block, begin block, age less than or equal to 12, end block, OR, begin block, age greater than or equal to 60, end block, end block Begin block Line 3, indented 1 tab: ticket Price left arrow 9 End block Line 4: ELSE Begin block Line 5, indented 1 tab: ticket Price left arrow 17 End block End block

C

The block code consists of 5 lines. Some of the lines of code are indented. The code uses the variable ticket Price, closed up with initial capital P, henceforth referred to as ticket Price. Line 1: ticket Price left arrow 12 Begin block Line 2: IF begin block, begin block, age less than or equal to 12, end block, OR, begin block, age greater than or equal to 60, end block, end block Begin block Line 3, indented 1 tab: ticket Price left arrow 9 End block End block Begin block Line 4: IF begin block is 3 D, closed up with numeral 3 and capital D, end block Begin block Line 5, indented 1 tab: ticket Price left arrow ticket Price plus 5 End block End block

D

The block code consists of 5 lines. Some of the lines of code are indented. The code uses the variable ticket Price, closed up with initial capital P, henceforth referred to as ticket Price. Line 1: ticket Price left arrow 12 Begin block Line 2: IF begin block, begin block, age less than or equal to 12, end block, OR, begin block, age greater than or equal to 60, end block, end block Begin block Line 3, indented 1 tab: ticket Price left arrow 9 End block Line 4: ELSE Begin block Line 5, indented 1 tab: ticket Price left arrow ticket Price plus 5 End block End block

C.

The block code consists of 5 lines. Some of the lines of code are indented. The code uses the variable ticket Price, closed up with initial capital P, henceforth referred to as ticket Price. Line 1: ticket Price left arrow 12 Begin block Line 2: IF begin block, begin block, age less than or equal to 12, end block, OR, begin block, age greater than or equal to 60, end block, end block Begin block Line 3, indented 1 tab: ticket Price left arrow 9 End block End block Begin block Line 4: IF begin block is 3 D, closed up with numeral 3 and capital D, end block Begin block Line 5, indented 1 tab: ticket Price left arrow ticket Price plus 5 End block End block

24
New cards

The transmission control protocol (TCP) and Internet protocol (IP) are used in Internet communication. Which of the following best describes the purpose of these protocols?

Responses

A

To ensure that communications between devices on the Internet are above a minimum transmission speed

B

To ensure that private data is inaccessible to unauthorized devices on the Internet

C

To establish a common standard for sending messages between devices on the Internet

D

To validate the ownership of encryption keys used in Internet communication

To establish a common standard for sending messages between devices on the Internet

25
New cards

Which of the following best exemplifies the use of keylogging to gain unauthorized access to a computer system?

Responses

A. A user unintentionally installs a program on their computer that records all user input and forwards it to another computer. A few weeks later, someone else is able to access the user’s computer using the recorded data.

B.A user has a very common password for an online banking account. Someone else guesses the password after a few attempts and gains access to the user’s account.

C.A user logs into an unsecure Web site. Someone else is able to view unencrypted log-in information as it is transmitted over the Internet. The user has the same username and password for multiple accounts, so the user’s log-in information for multiple systems may be compromised.

D.A user receives an e-mail that claims to be from the user’s bank. The e-mail instructs the user to click on a link to a Web site and enter a username and password to verify an account. Shortly after following the steps, the user discovers that the Web site is fraudulent and that the user’s username and password were stolen.

(A.) A user unintentionally installs a program on their computer that records all user input and forwards it to another computer. A few weeks later, someone else is able to access the user’s computer using the recorded data.

26
New cards

Consider the following code segment.

The figure presents 5 lines of code. Throughout the code there are nested blocks of code, as follows. Line 1: [begin block] integerList ← [begin block] 4, 2, 5, 4, 2, 3, 1 [end block] [end block] Line 2: [begin block] result ← 0 [end block] [Begin Block] Line 3: FOR EACH item IN integerList [Begin Block] Line 4: [begin block] result ← result + (item MOD 2) [end block] [End block] [End Block] [begin block] Line 5: DISPLAY [begin block] result [end block] [end block]

What value is displayed as a result of executing the code segment?

Responses

A. 3

B.4

C.9

D.12

A. 3

27
New cards

The following code segment is intended to remove all duplicate elements in the list myList.The procedure does not work as intended.

j LENGTH(myList)

REPEAT UNTIL(j = 1)

{

IF(myList[j] = myList[j - 1])

{

REMOVE(myList, j)

}

j j - 1

}

For which of the following contents of myList will the procedure NOT produce the intended results?

Select two answers.

response - correct

Responses

A

[10, 10, 20, 20, 10, 10]

B

[30, 30, 30, 10, 20, 20]

C

[30, 50, 40, 10, 20, 40]

D

[50, 50, 50, 50, 50, 50]

A. [10, 10, 20, 20, 10, 10]

C. [30, 50, 40, 10, 20, 40]

28
New cards

A library of e-books contains metadata for each book. The metadata are intended to help a search feature find books that users are interested in. Which of the following is LEAST likely to be contained in the metadata of each e-book?

Responses

A.An archive containing previous versions of the e-book

B.The author and title of the e-book

C.The date the e-book was first published

D.The genre of the e-book (e.g., comedy, fantasy, romance, etc.)

A. An archive containing previous versions of the e-book

29
New cards

Consider two lists of numbers called list1 and list2. A programmer wants to determine how many different values appear in both lists. For example, if list1 contains [10, 10, 20, 30, 40, 50, 60] and list2 contains [20, 20, 40, 60, 80], then there are three different values that appear in both lists (20, 40, and 60).

The programmer has the following procedures available.

Procedure Call

Explanation

Combine (myList1, myList2)

This procedure creates a new list containing the elements from myList1 ​followed by the entries from myList2. The resulting list is returned. For example, if myList1 contains [2, 4, 6] and myList2 contains [1, 5], the procedure will return the list [2, 4, 6, 1, 5].

RemoveAllDups (myList)

This procedure creates a new list containing the elements of myList with any duplicate values removed. The resulting list is returned. For example, if myList contains [3, 2, 4, 2, 2, 5, 6, 4], the procedure will return the list [3, 2, 4, 5, 6].

Which of the following can be used to assign the intended value to count ?

Responses

A

bothList Combine (list1, list2)

uniqueList RemoveAllDups (bothList)

count LENGTH (bothList) - LENGTH (uniqueList)

B

newList1 RemoveAllDups (list1)

newList2 RemoveAllDups (list2)

bothList Combine (newList1, newList2)

count LENGTH (list1) + LENGTH (list2) - LENGTH (bothList)

C

newList1 RemoveAllDups (list1)

newList2 RemoveAllDups (list2)

bothList Combine (newList1, newList2)

count LENGTH (newList1) + LENGTH (newList2) - LENGTH (bothList)

D

newList1 RemoveAllDups (list1)

newList2 RemoveAllDups (list2)

bothList Combine (newList1, newList2)

uniqueList RemoveAllDups (bothList)

count LENGTH (bothList) - LENGTH (uniqueList)

D. newList1 RemoveAllDups (list1)

newList2 RemoveAllDups (list2)

bothList Combine (newList1, newList2)

uniqueList RemoveAllDups (bothList)

count LENGTH (bothList) - LENGTH (uniqueList)

30
New cards

A certain computer has two identical processors that are able to run in parallel. The following table indicates the amount of time it takes to execute each of four processes on a single processor. Assume that none of the processes is dependent on any of the other processes.

Process

Execution Time onEither Processor

P

30 seconds

Q

10 seconds

R

20 seconds

S

15 seconds

Which of the following parallel computing solutions would minimize the amount of time it takes to execute all four processes?

Responses

A

Running processes P and Q on one processor and processes R and S on the other processor

B

Running processes P and R on one processor and processes Q and S on the other processor

C

Running processes P and S on one processor and processes Q and R on the other processor

D

Running process P on one processor and processes Q, R, and S on the other processor

A. Running processes P and Q on one processor and processes R and S on the other processor