Search Header Logo

AP Review 2

Computers

9th - 12th Grade

Used 49+ times

AP Review 2
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

An application program interface (API) provides a procedure Max, which returns the greater of its two integer

arguments.


A programmer would like to find the greatest of three integer values a, b, and c. Which of the following

expressions will produce the desired result in every case?

Max (Max (a, b), c)

Max (a, b) - Max (b, c)

Max (a, b) + Max (b, c) – Max (a, c)

(Max (a, b) + Max (b, c)) / 2

2.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Media Image

The following question uses a robot in a grid of squares. The robot is represented by a triangle, which is initially

facing right.

Media Image
Media Image
Media Image
Media Image

3.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Media Image

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 true if the daily high temperature was at least 90 degrees for a majority of days in the

month and return false otherwise.

Which of the following can be used to replace <MISSING CODE> so that the procedure works as intended?

counter < 0.5 * total

counter > 0.5 * total

total < 0.5 * counter

total > 0.5 * counter

4.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

The following figures represent different ways of configuring a network of physically linked computers labeled P, Q, R, and S. A line between two computers indicates that the computers can communicate directly with each other.


In which configuration is it NOT possible to have redundant routing between computers P and S?

Media Image
Media Image
Media Image
Media Image

5.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Byte pair encoding is a data encoding technique. The encoding algorithm looks for pairs of characters that appear in the string more than once and replaces each instance of that pair with a corresponding character that does not appear in the string. The algorithm saves a list containing the mapping of character pairs to their corresponding replacement characters.

For example, the string "THIS_IS_THE_BEST_WISH" can be encoded as "%#_#_%E_BEST_W#H" by replacing all instances of "TH" with "%" and replacing all instances of "IS" with "#".


Which of the following statements about byte pair encoding is true?

Byte pair encoding is an example of a lossy transformation because it discards some of the data in the original string.

Byte pair encoding is an example of a lossy transformation because some pairs of characters are replaced by a single character.

Byte pair encoding is an example of a lossless transformation because an encoded string can be restored to its original version.

Byte pair encoding is an example of a lossless transformation because it can be used to transmit messages securely.

6.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Byte pair encoding is a data encoding technique. The encoding algorithm looks for pairs of characters that appear in the string more than once and replaces each instance of that pair with a corresponding character that does not appear in the string. The algorithm saves a list containing the mapping of character pairs to their corresponding replacement characters.

For example, the string "THIS_IS_THE_BEST_WISH" can be encoded as "%#_#_%E_BEST_W#H" by replacing all instances of "TH" with "%" and replacing all instances of "IS" with "#".


For which of the following strings is it NOT possible to use byte pair encoding to shorten the string’s length?

"BANANA"

"LEVEL_UP"

"MEET_ME_LATER"

"NEITHER_HERE_NOR_THERE"

7.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Media Image

The grid contains a robot represented as a triangle, initially facing up. The robot can move into a white or gray square but cannot move into a black region.


The code segment below uses the procedure GoalReached, which evaluates to true if the robot is in the gray square and evaluates to false otherwise.


REPEAT UNTIL (GoalReached ())

{

<MISSING CODE>

}

Which of the following replacements for <MISSING CODE> can be used to move the robot to the gray square?

Media Image
Media Image
Media Image
Media Image

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?