Search Header Logo

AP Computer Science Principles Practice Exam Questions Part 2

Authored by Alyssa DeOrio

Computers

11th Grade

Used 13+ times

AP Computer Science Principles Practice Exam Questions Part 2
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

28 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

A programmer notices the following two procedures in a library. The procedures do similar, but not identical, things.

• Procedure MaxTwo (x, y) returns the greater of its two integer parameters.

• Procedure MaxThree (x, y, z) returns the greatest of its three integer parameters.

Which of the following procedures is a generalization of the MaxTwo and MaxThree procedures?

Procedure Min (x, y), which returns the lesser of its two integer parameters

Procedure Max (numList), which returns the maximum value in the list of integers numList

Procedure MaxFour (w, x, y, z), which returns the greatest of its four integer parameters

Procedure OverMax (numList, max), which returns the number of integers in numList that exceed the integer value max

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

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?

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.

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.

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

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

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

A programmer wants to determine whether a score is within 10 points of a given target. For example, if the target is 50, then the scores 40, 44, 50, 58, and 60 are all within 10 points of the target, while 38 and 61 are not. Which of the following Boolean expressions will evaluate to true if and only if score is within 10 points of target?

(score ≤ target + 10) AND (target + 10 ≤ score)

(target + 10 ≤ score) AND (score ≤ target - 10)

(score ≤ target - 10) AND (score ≤ target + 10)

(target - 10 ≤ score) AND (score ≤ target + 10)

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image

A photographer has a collection of digital pictures, each using the same file-naming format: a date tag, followed by a description, followed by the file extension ".jpg". The photographer wants to write a code segment to extract the description from each file name, as shown in the following table: Original File Name Extracted Description 2016-05-22-Andrews-Graduation.jpg Andrews-Graduation 2016-07-04-Fireworks.jpg Fireworks 2017-10-18-Grandmas-Birthday.jpg Grandmas-Birthday The photographer has the following procedures available: Procedure Call Explanation TrimLeft (str, n) Returns a copy of the string str with the n leftmost characters removed. For example, TrimLeft ("keyboard", 3) returns "board". TrimRight (str, n) Returns a copy of the string str with the n rightmost characters removed. For example, TrimRight ("keyboard", 3) returns "keybo". Let an original file name be stored in the string variable original. Which of the following statements will correctly extract the description and store it in the string variable descr?

I only

II only

I and III

II and III

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which of the following best explains how a certificate authority is used in protecting data?

A certificate authority certifies the safety of a particular Web site so that users know that it does not contain any viruses.

A certificate authority issues passwords that grant access to secure databases.

A certificate authority maintains a secure database that maps all Web domain names to the IP addresses of the servers where the sites are hosted.

A certificate authority verifies the authenticity of encryption keys used in secured communications.

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Internet protocol version 6 (IPv6) has been introduced to replace the previous version (IPv4). Which of the following best describes a benefit of IPv6 over IPv4?

IPv6 addresses are shorter than IPv4 addresses, which allows for faster routing of packets.

IPv6 allows for a greater number of addresses than IPv4, which allows more devices to be connected to the Internet.

IPv6 eliminates the use of hierarchy in addressing, making addresses easier to use.

IPv6 allows users to bypass older security protocols so that data can be sent peer-to-peer without the use of routers.

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Assume that the list of numbers nums has more than 10 elements. The program below is intended to compute and display the sum of the first 10 elements of nums. Line 1: i ← 1 Line 2: sum ← 0 Line 3: REPEAT UNTIL (i > 10) Line 4: { Line 5: i ← i + 1 Line 6: sum ← sum + nums[i] Line 7: } Line 8: DISPLAY (sum) Which change, if any, is needed for the program to work as intended?

Lines 1 and 2 should be interchanged.

Line 3 should be changed to REPEAT UNTIL (i ≥ 10).

Lines 5 and 6 should be interchanged.

No change is needed; the program works correctly.

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Computers