APCSP Practice Exam

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Which of the following statements are true about using a high-level programming language instead of a lower-level language?

II only

Which of the following best describes the behavior of the the code?

The program could display either true or false

Which of the following questions about the group of tracked birds COULD be answered using only the data collected from the tracking collars?

In what month do the birds tend to travel the farthest?

Program 1 and 2 below are intended to calculate the average of the integers in a list, number_list.

Program 1 displays the correct average, but Program 2 does not

Which of the following replacements for <MISSING CODE> will cause an infinite loop?

i ← i MOD 3

Which of the following Boolean expressions is not equivalent to the expression

(num < 0) AND (num * -1 = 10)

What is displayed as a result of running this program?

Dog Turtle

What ASCII character is represented by the binary (base 2) number 1010001?

Q = 81

Which of the following expressions is equivalent to the value returned from Mystery(x)?

X*5

Which of the following code options can be used to move the robot (the black triangle) to the gray square?

REPEAT 4 TIMES: { ROTATE_LEFT () MOVE_FORWARD () ROTATE_RIGHT () MOVE_FORWARD () ROTATE_RIGHT () MOVE_FORWARD () ROTATE_LEFT () }

Consider the example grid above. Assuming our code segment needs to work when the gray square is anywhere in the top row, which of the following code segments will always get the robot to the gray square?

REPEAT UNTIL (CAN_MOVE (left)) { MOVE_FORWARD () } ROTATE_LEFT () MOVE_FORWARD ()

What is the minimum number of connections that must be broken or removed in the network before computer E can no longer communicate with computer F?

2

Which of the following expressions is equivalent to the value returned from Mystery(x)?

2 * 3 * x

A byte is made up of 8 bits (binary digits). You have a programming language that uses one byte to represent characters and are now modifying your language to use two bytes to represent characters. How many more characters can you represent in your new programming language?

2^8 times as many characters

Which of the following best describes the result of using 128-bit addresses instead of 32-bit addresses?

2^96 times as many addresses can be represented

What is the value of Mystery("karel", ["karel", "karel", "tracy", "karel", "karel", "karel", "tracy"])

3

What is the minimum number of bits you would need to represent a number on a 0 to 10 scale?

4

What does this flowchart algorithm display?

?

Which of the following statements describes a limitation of using a heuristic approach to solve a problem?

A heuristic approach can only provide an approximate solution, rather than an exact solution

Which of the following programs is most likely to benefit from the use of a heuristic?

A program that computes the best move to play in a board game

What is the purpose of the Digital Millennium Copyright Act?

To criminalize the act of circumventing, or getting around, access controls that block access to copyrighted works.

Which of the following tasks is an example where searching for patterns is needed to produce useful information?

An online retail store analyzing customers' viewing habits to suggest other products based on the purchasing history of other customers

A video viewing Website previously used 32-bit integers to store the number of views for each video, but a video that had been watched billions of times hit the maximum value. What is it called when this maximum is exceeded?

An overflow error

A researcher is emailing images of soil samples back to her lab so her team can analyze them. She notices that the images sent in her email are of lower quality than the images on her camera. Which of the following could be a possible explanation for the difference in image quality?

Before being sent, the image was compressed using a lossy compression technique

Assume we have an algorithm used to simulate the results of flipping a coin n times. Two variables used for the algorithm are heads_counter, storing the number of heads we've had, and flip_counter, storing the number of flips we've made. We want to add on to the algorithm so that at the end we display whether there were an odd or even number of tails.

Both Algorithm A and Algorithm B always calculate the correct answer.

What change do you need to make to be able to display the correct maximum value for any list of integers?

Change line 1 to max ← list[1]

Which of the following will NOT affect the results when the code segment is executed?

Change line 3 to x ← y

Digital images are often represented by the red, green, and blue values (an RGB triplet) of each individual pixel in the image. A photographer is manipulating a digital image and overwriting the original image. Which of the following describes a lossy transformation of the digital image (a transformation in which information is lost and cannot be restored)?

Creating the gray scale of an image by averaging the amounts of red, green, and blue in each pixel and assigning this new value to the corresponding pixel in the new image. The new value of each pixel represents a shade of gray, ranging from white to black.

Which of the following lists the numbers in order from least to greatest?

Decimal 70, Binary 1001001, Hexadecimal 4E

Which of the following activities poses the greatest personal cybersecurity risk?

Emailing your bank account number to an online vendor to purchase a product from them

Which of the following is a true statement about these algorithms?

Generally, as the size of songList becomes larger, Algorithm 2 will be more efficient than Algorithm 1

Given the following algorithms, which one uses selection?

Given two numbers display the larger of the two.

Which of the following questions could be answered by analyzing only information in the data set?

How many states have computer science as the most common major for female students?

A user enters a Web address in a browser, and a request for a file is sent to a Web server. Which of the following statements are true about how the file is sent to the user? I - The file is broken down into several packets for transmission. II - The packets must be reassembled by the user's device upon receipt. III - The user's browser must request each individual packet, in order, until all packets are received

I and II

Which of the following statements are true about this network: I - The network is fault-tolerant. If a single connection fails, any two devices can still communicate. II - Computers B and F need to first communicate with at least one other device in order to communicate with each other.

I and II

Which of the following are true statements about Distributed Denial of Service (DDoS) attacks? I - DDoS attacks compromise a target website by flooding it with requests from multiple systems II - DDoS attacks are carried out using a large group of computers III - DDoS attacks can be prevented using encryption

I and II only

For which of the following goals would it be more useful to computationally analyze the metadata instead of the data? I. Estimate the number of texts that will be sent next month II. Determine the most frequently used emoji in text messages III. Determine if two phones have been in contact in the last week

I and III

Why is it important to focus on programming style in addition to programming functionality? I) Program style helps others understand your program and maintain it II) Programming style only applies to certain programming languages III) Programming style increases the reusability of your code

I and III

Which of the following are true statements about phishing attacks? I - Phishing attacks are characterized by communication from one person trying to trick another person into divulging personal information II - Phishing attacks can be defended against using the DNS system

I only

Which of the following code segments can replace <MISSING CODE> so that the program works as intended?

IF (studentGPAs[i] ≤ 4) { gradePointAverageSum ← gradePointAverageSum + studentGPAs[i] } ELSE { numGPAs ← numGPAs - 1 } i ← i + 1

Which of the following statements are true: I - Every problem can be solved with an algorithm for all inputs, but some of these algorithms have not yet been discovered II - Every problem can be solved with an algorithm for all inputs, but some problems cannot be solved in a reasonable amount of time III - There exist problems that cannot be solved by any algorithm for all inputs

III only

Which of the following questions could NOT be answered using only the data and metadata collected?

In what country is the site most active?

Which of the following code options will make the robot (the triangle) touch all of the gray squares?

MOVE_FORWARD () ROTATE_LEFT () MOVE_FORWARD () REPEAT 3 TIMES: { ROTATE_LEFT () MOVE_FORWARD () MOVE_FORWARD () }

A bank uses a computer program during the night to tell if the alarm should be rung. Sensors in the bank set the following Boolean variables: vaultClosed: set to true if the bank vault is closed; otherwise falseheardNoise: set to true if a microphone heard noise; otherwise falsesawMovement: set to true if a camera saw movement in the bank; otherwise false The automatic alarm should notify the police if there is noise and movement in the bank, or if the bank vault is open. Which of the following boolean expressions can be used in a selection statement to ring the alarm?

NOT vaultClosed OR (heardNoise AND sawMovement)

The robot must get to the grey square at the bottom left hand corner by jumping over the black hurdle. The program to achieve this is: ROTATE_LEFT () MOVE_FORWARD () ROTATE_RIGHT () JUMP_HURDLE () ROTATE_RIGHT () MOVE_FORWARD () Which of the procedures below is the correct implementation of the JUMP_HURDLE procedure used in the above program?

PROCEDURE JumpHurdle () { MOVE_FORWARD () ROTATE_LEFT () MOVE_FORWARD () MOVE_FORWARD () ROTATE_LEFT () MOVE_FORWARD() }

Procedures A and B are meant to get the minimum value of a list of one or more integers. We have the two procedures below

Procedure A returns the correct minimum value, but Procedure B does not.

Which of the following actions is MOST likely to be effective in this purpose?

Providing free wireless Internet connections at locations in low-income neighborhoods

You are writing a program to simulate a coin toss. What line of code could be used to replace <MISSING CONDITION> so that there is a 50-50 chances of your program printing heads or tails?

RANDOM(1, 2) = 1

Which of the following best describes the behavior of the Mystery PROCEDURE?

Return whether or not word is in list

Which of the following best describes the behavior of the Mystery PROCEDURE?

Returns whether or not number is even

Which of the following activities has the greatest potential for compromising your personal privacy?

Sharing the cookies stored in your Web browser

Which of the following activities poses the LEAST potential cybersecurity risk?

Sharing your device's public key used for encryption

Which of the following statements describes an advantage of using a computer simulation to model a real-world object or system?

Simulations allow us to test real-world events without the cost or danger of building and testing the phenomena in the real world.

Which of the following describes a limitation of cloud computing?

Storing data using cloud computing rather than storing on a personal computer may weaken the security of data

Based on the information in the table, which of the following tasks is likely to take the longest amount of time when scaled up for a very large company of approximately 100,000 customers?

Task B

Which of the following is NOT a characteristic of the redundant nature of routing on the Internet?

The ability to use a hierarchical naming system to avoid naming conflicts

Which of the following is true about why it is important to write clear function names?

The name makes it clear what the purpose of the function is.

A program is expressed in a programming language. Which of the following is true of the program?

The program can also be expressed as binary code, which is what the program will be translated to in order to execute on the computer

Consider the following program, which is intended to print the count of even numbers between 1 and number Which of the following best describes the behavior of this program?

The program correctly displays the count of even numbers between 1 and number

Which of the following best describes the result of running the Mystery procedure?

The return value will be a positive integer greater than or equal to the initial value of number

A construction company is building a tall skyscraper and is considering two different types of material to use for the beams in the building. The company decides to use a computer simulation of each option to determine which material will cause the building to be more stable. Which of the following is NOT true about the company's plan?

The simulation will not produce usable results because actual data about each material is not available

Given the following code segment, how can you best describe its behavior?

This code displays the sum of the even numbers in list

Given the following Mystery procedure, how can you best describe the result it returns?

This procedure returns the list without any instance of the given target

Which of the following is a benefit that online shopping websites provide over brick and mortar stores?

Users can easily see product reviews and determine if an item has been satisfactory for a large number of people

A Website is considering an update to its servers that would save the geolocations of users accessing the site. Which of the following is LEAST likely to occur as a result of this update?

Users in a certain location may no longer be able to access the Website

Which of the following is considered an unethical use of computer resources?

Using an image on a website without giving credit to the original creator

A search engine has a trend-tracking feature that provides information on how popular a search term is. The data can be filtered by geographic region, date, and search term. Which of the following questions is LEAST likely to be answerable using the trends feature?

What region of the country has the highest population of a particular animal

Which of the following is a characteristic of the hierarchical nature of the domain name system (DNS)?

Which of the following is a characteristic of the hierarchical nature of the domain name system (DNS)?

Which of the following replacements for <MISSING CONDITION> will display the first 10 powers of 2?

counter > 10

According to the domain name system (DNS), which of the following is a subdomain of the domain test.com?

info.test.com

Based on the code segment, how would you best describe the value of resultList?

resultList contains all items from inputList that met the Mystery condition

Based on the code segment, how would you best describe the value of resultList?

resultList contains the result of calling the Mystery procedure on every item in inputList

We want to create an algorithm called swapValues. Given two variables x and y the result should have the values of x and y swapped. Which of the following algorithms correctly swaps the values of x and y?

temp ← x x ← y y ← temp

Which of the following expressions is equivalent to the value returned from Mystery(x, y)?

y * x


Kaugnay na mga set ng pag-aaral

ECON 2100 Test 3 Practice Questions (Ch. 17, 18, 19, 20, & 21)

View Set

Chapter 11: The differential Analysis: Key to Decision Making

View Set

ARCH 2600 - seven ways to look at a building

View Set

Identifying and Safeguarding PII DS-IF101.06

View Set

Psychology In Your Life: Chapter 5 Sensation and Perception

View Set

CSCI Ch 1 - 7 combined, CSCI CH 8-11, 13-14, Computer Science 165 Midterm, C++ Chapter 12, Ch17, Final

View Set

Senior Project MLA Research Paper Outline (sample paper)

View Set

Chapter 6 Review Data Management

View Set

TERM 4 Ch 28 Care of Patients Requiring Oxygen Therapy or Tracheostomy

View Set

305 Chapter 29 Infection Control

View Set