AP Computer Science Principles Exam Questions

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

A student is recording a song on her computer. When the recording is finished, she saves a copy on her computer. The student notices that the saved copy is of lower sound quality than the original recording. Which of the following could be a possible explanation for the difference in sound quality? (A) The song was saved using fewer bits per second than the original song. (B) The song was saved using more bits per second than the original song. (C) The song was saved using a lossless compression technique. (D) Some information is lost every time a file is saved from one location on a computer to another location.

(A)

Consider the following code segment. j <-- 1 REPEAT UNTIL (<MISSING CONDITION>) (j <-- j + 2) Which of the following replacements for <MISSING CONDITION> will result in an infinite loop? (A) j = 6 (B) j ≥ 6 (C) j = 7 (D) j > 7

(A)

Consider the following program, which is intended to display the number of times a number "target" appears in a list. count <-- 0 FOR EACH n IN list IF (n = target) (count <-- count + 1) DISPLAY (count) Which of the following best describes the behavior of the program? (A) The program correctly displays the number of time "target" appears in the list. (B) The program does not work as intended when "target" does not appear in the list. (C) The program does not work as intended when "target" appears in the list more than once. (D) The program does not work as intended when "target" appears as the last element of the list.

(A)

Which of the following is LEAST likely to indicate a phishing attack? (A) An e-mail from your bank asks you to call the number on your card to verify a transaction (B) An e-mail from a merchant asks that you click on a link to reset your password (C) An e-mail from a utility company asks you to enter your date of birth and social security number for verification purposes (D) An e-mail indicates that you have won a large sum of money and asks you to enter your bank account number so that the money can be transferred to you

(A)

A programmer is writing a program that is intended to be able to process large amounts of data. Which of the following considerations is LEAST likely to affect the ability of the program to process larger data sets? (A) How long the program takes to run (B) How many programming statements the program contains (C) How much memory the program requires as it runs (D) How much storage space the program requires as it runs

(B)

Central High School keeps a database of information about each student, including the numeric variables numberOfAbsences and gradePointAverage. The expression below is used to determine whether a student is eligible to receive an academic award. (numberofAbsences ≤ 5) AND (gradePointAverage > 3.5) Which of the following pairs of values indicates that a student is eligible to receive an academic award? (A) numberofAbsences = 3, gradePointAverage = 3.5 (B) numberofAbsences = 5, gradePointAverage = 3.8 (C) numberofAbsences = 6, gradePointAverage = 3.4 (D) numberofAbsences = 6, gradePointAverage = 3.6

(B)

The code segment below uses procedure IsFound (list, item), which returns true if item appears in list and returns false otherwise. The lost resultList is initially empty. FOR EACH item IN inputList1 { IF (IsFound (inputList2, item) { APPEND (resultList, item) } } Which of the following best describes the contents of resultList after the code segment is executed? (A) All elements in inputList1 followed by all elements in inputList2 (B) Only elements that appear in both inputList1 and inputList2 (C) Only elements that appear in either inputList1 or inputList2 but not in both lists (D) Only elements that appear in inputList1 but not in inputList2

(B)

The procedure Draw (length, direction) is used to draw a line segment length units long in a given direction (left, right, up, or down), starting at the current cursor position. The cursor is then repositioned at the end of the line segment that was drawn. Consider the following program, where the cursor starts in the upper left corner of a grid of dots. The dots are spaced one unit apart. Draw (1, right) Draw (2, down) Draw (1, left) Draw (1, right) Draw (1, up) Draw (1, left) Which of the following represents the figure that is drawn by the program? (A) •--• • | •--• • | •--• • (B) •--• • | •--• • | •--• • (C) •--• • | • •--• | •--• • (D) •--• • | •--• • | •--• •

(B)

Which of the following best explains what happens when a new device is connected to the Internet? (A) A device driver is assigned to the device. (B) An Internet Protocol (IP) address is assigned to the device. (C) A packet number is assigned to the device. (D) A Web site is assigned to the device.

(B)

An algorithm has been developed to compute the sum of all the elements in a list of integers. Which of the following programming structures must be added to the existing algorithm so that the new algorithm computes the sum of only the even integers in the list? (A) Iteration (B) Searching (C) Selection (D) Sequencing

(C)

Consider the following code segment, which uses the variables r, s, and t. r <-- 1 s <-- 2 t <-- 3 r <-- s s <-- t DISPLAY (r) DISPLAY (s) What is displayed as a result of running the code segment? (A) 1 1 (B) 1 2 (C) 2 3 (D) 3 2

(C)

In the program below, the initial value of x is 5 and the initial value of y is 10. IF (x < 0) { DISPLAY ("Foxtrot") } ELSE { IF (x > y) { DISPLAY ("Hotel") } ELSE { IF (y > 0) { DISPLAY ("Nov") } ELSE } DISPLAY ("Yankee") } } } What is displayed as a result of running the program? (A) Foxtrot (B) Hotel (C) Nov (D) Yankee

(C)

Which of the following activities poses the greatest personal cybersecurity risk? (A) Making a purchase at an online store that uses public key encryption to transmit credit card information (B) Paying a bill using a secure electronic payment system (C) Reserving a hotel room by e-mailing a credit card number to a hotel (D) Withdrawing money from a bank account using an automated teller machine (ATM)

(C)

Which of the following is considered an unethical use of computer resources? (A) Downloading freeware or shareware onto your home computer (B) Purchasing a game from an app store and downloading it directly to a mobile device (C) Purchasing a single-user copy of photo editing software and installing it on all the computers in a computer lab (D) Searching online for an electronic version of a school textbook

(C)

The algorithm below is used to simulate the results of flipping a coin 4 times. Consider the goal of determining whether the simulation resulted in an equal number of heads and tails. Step 1: Initialize the variables heads_counter and flip_counter to 0. Step 2: A variable coin_flip is randomly assigned a value of either 0 or 1. So heads_counter is incremented by 1. Step 3: Increment the value of flip_counter by 1. Step 4: Repeat steps 2 and 3 until flip_counter equals 4. Following execution of the algorithm, which of the following expressions indicates that the simulation resulted in an equal number of heads and tails? (A) coin_flip = 1 (B) flip_counter = 1 (C) flip_counter = 2 (D) heads_counter = 2

(D)

Which of the following is a true statement about product documentation? (A) Program documentation should not be changed after it is first written. (B) Program documentation is only needed for programs in development; it is not needed after a program is completed. (C) Program documentation is useful when programmers collaborate but not when a programmer works individually on a project. (D) Program documentation is useful during initial program development and also when modifications are made to existing programs.

(D)

Which of the following statements are true about using a high-level programming language instead of a lower-level language? I. Programs written in a high-level language are generally easier for people to read than programs written in a low-level language. II. A high-level language provides programmers with more abstractions than a low-level language. III. Programs written in a high-level language are generally easier to debug than programs written in a low-level language. (A) I only (B) I and III only (C) II and III only (D) I, II, and III

(D)


संबंधित स्टडी सेट्स

Maternal Newborn Practice 2019 A***

View Set

Biology 1620 Chap. 34 Vertebrates

View Set

chapter 4 patterns of inheritance

View Set

The American Legal System- Chapter 8

View Set

PSYCH chapter 13 (question samples)

View Set