AP Computer Science Principles 1st Semester Finals - Set B PDF

Document Details

CharismaticPoisson2169

Uploaded by CharismaticPoisson2169

AP

Tags

computer science programming computer ap exams

Summary

These are past AP Computer Science Principles exam questions. There are multiple choice questions.

Full Transcript

***Directions: Write the letter of the correct answer for each numbered item.\ *** 1\. **What is the Internet?** ---- ----------------------------------------------------------------------- a. A big old group of things. b. A group of connected devices connected by cable, wi-fi, or satell...

***Directions: Write the letter of the correct answer for each numbered item.\ *** 1\. **What is the Internet?** ---- ----------------------------------------------------------------------- a. A big old group of things. b. A group of connected devices connected by cable, wi-fi, or satellite. c. A computer, a monitor, and a printer. d. A collection of networks or network of networks. e. A tablet with a bunch of games on it. ---- ----------------------------------------------------------------------- 2\. **Which of the following is a primary reason for the use of open protocols on the Internet?** ---- ------------------------------------------------------------------------------------------------------- A. Open protocols allow devices to specify how data packets are to be routed on the Internet in advance. B. Open protocols ensure that all data transmission on the Internet is kept secure. C. Open protocols ensure that all Internet users are provided connections with equal bandwidth. D. Open protocols provide a way to standardize data transmission between different devices. E. All of the above ---- ------------------------------------------------------------------------------------------------------- **3. What is a network?** ---- ----------------------------------------------------------------------- a. A big old group of things. b. A group of connected devices connected by cable, wi-fi, or satellite. c. A computer and a monitor. d. A refrigerator and a cell phone. e. A tablet with games on it. ---- ----------------------------------------------------------------------- **4. Which of the following best describes the relationship between the WWW and the Internet?** **A. The World Wide Web is a protocol that is accesses using a data stream called the Internet.** **B. The World Wide Web is a system of linked pages, programs, and files that is accessed using a *data stream* called the Internet.\ C. The World Wide Web is a system of linked pages, and files that is accessed via a *network* called the Internet.** **D. The World Wide Web is a Web site that is accessed using a protocol called the Internet.\ ** 5\. **Which of the following best explains how messages are typically transmitted over the Internet?** ---- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ A. The message is broken into packets that are transmitted in a specified order. Each packet must be received in the order it was sent for the message to be correctly reassembled by the recipient's device. B. The message is broken into packets. The packets can be received in any order and still be reassembled by the recipient's device. C. The message is broken into two packets. One packet contains the data to be transmitted and the other packet contains metadata for routing the data to the recipient's device. D. The message is transmitted as a single file and received in whole by the recipient's device. E. None of the above ---- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ **6. Which of the following programming languages would most likely be the easiest to learn for someone new to Computer Science and programming?** ---- ---------- a. SNAP! b. Java c. Python d. Binary e. Assembly ---- ---------- **7.** **Which of the following best explain how fault tolerance in a network is observed?\ \ A. By providing high-bandwidth connections between devices, enabling data packets to be transmitted as quickly as possible.** **B.** **By providing multiple paths between devices, enabling routing to occur even in the presence of a failed component.** **C. By providing open network protocols, ensuring that all devices on the network are interacting in a standard way** **D. By providing software to monitor all network traffic, ensuring that data packets are sent and received in the proper order** 8\. **What is a list?** ---- ----------------------------------------------- A. A structure that can store multiple variables B. A structure than can only store one value C. A variable that has limited storage D. A and B only E. A, B, and C ---- ----------------------------------------------- 9\. **Why are lists used when writing programs?** ---- -------------------------------------------------------- A. Lists allow multiple values to be stored in one place. B. Lists can increase and decrease in size as needed. C. Lists are easily manipulated with loops. D. A and B only E. A, B, and C ---- -------------------------------------------------------- 10\. **What is the purpose of an if statement or selection statement?** ---- ------------------------------------------------------------- A. To set a value to variable. B. To repeat a section of code. C. To evaluate a condition to determine which code to execute. D. To print out some values. E. To cause your code to blow up. ---- ------------------------------------------------------------- 11\. **What is the purpose of a loop or iteration when writing code?** ---- -------------------------------------------------- A. To repeat a section of code based on a condition B. To repeat a section of code a set number times C. To assign value to a variable D. To print out values E. A and B only ---- -------------------------------------------------- 12\. **What is output by the following code?** set a to 75 repeat 5 times change a by -5 say a ---- ---- A. 50 B. 65 C. 60 D. 55 E. 70 ---- ---- 13\. **What is output by the following code?** set a to 63 repeat 4 times change a by -7 say a ---- ---- A. 63 B. 56 C. 49 D. 42 E. 35 ---- ---- 14\. **Which of the following is a benefit of using a list as a data abstraction in a program?** A. Lists often allow their size to be easily updated to hold as many data values as needed. B. Lists convert all elements to strings so that they can be inspected character-by-character. C. Lists prevent duplicate data values from appearing in the list. D. Lists are used to store all input data so that there is a running record of all user input. E. Lists are allows the use of detailed instructions \ \ 15. **What is output by the following code?** set c to 30 repeat until c \< 10 change c by -5 say c ---- ---- A. 30 B. 20 C. 10 D. 5 E. 0 ---- ---- 16\. Consider the following code segment. **What are the contents of yourList after the code segment is executed?** A. \[10, 30, 50, 70\] B. \[20, 40, 60, 80\] C. \[10, 30, 50, 70, 20, 40, 60, 80\] D. \[20, 40, 60, 80, 10, 30, 50, 70\] E. Error 17\. **The variable age  is to be used to represent a person's age, in years. Which of the following is the most appropriate data type for age ?** A. Boolean\ B. String C. Number\ D. List\ E. Variable 18\. Consider the following code segment. firstList ← \[\"guitar\", \"drums\", \"bass\"\] secondList ← \[\"flute\", \"violin\"\] thirdList ← \[\] thirdList ← firstList firstList ← secondList secondList ← thirdList **What are the contents of secondList after the code segment is executed?** A. \[ \] B. \[\"guitar\", \"drums\", \"bass\"\] C. \[\"flute\", \"violin\"\] D. \[\"flute\", \"violin\", \"guitar\", \"drums\"\] E. \[\"flute\", \"violin\", \"guitar\", \"drums\", \"bass\"\] 19\. **What is output by the following code?** set a to 50 repeat 6 times change a by 3 say a ---- ---- A. 90 B. 76 C. 60 D. 68 E. 66 ---- ---- 20\. **What is output by the following code?** set d to 10 repeat until d \> 71 change d by 6 say d ---- ---- A. 76 B. 34 C. 48 D. 72 E. 84 ---- ---- 21\. **What is output by the following code?** set c to 1 repeat until c \> 49 change c by 8 say c ---- ---- A. 1 B. 17 C. 33 D. 49 E. 57 ---- ---- **22. What is a program variable?** ---- ----------------------------------------------------- A. A place in memory to store a value that can change. B. A decimal or whole number only C. A word or letter only D. A and B only E. A, B, and C ---- ----------------------------------------------------- 23\. **What is output by the following code?** set e to 90 repeat until e \< 20 if e \> 50 change e by -15 else change e by -10 say e ---- ---- A. 75 B. 45 C. 15 D. 35 E. 65 ---- ---- 24\. **What is output by the following code?** set list to \[1, 2, 3\] say list ---- ------------- A. \[1, 2, 3\] B. \[1\] C. \[3, 2, 1\] D. \[3\] E. \[\] ---- ------------- 25\. **What is output by the following code?** set e to 150 set count to 0 repeat until e \< 75 if e \> 100 change e by -20 else change e by -5 change count by 1 say count ---- --- A. 8 B. 7 C. 9 D. 6 E. 5 ---- --- 26\. **What is output by the following code?** set e to 0 set count to 0 repeat until e \> 100 if e \< 50 change e by 15 else change e by 9 change count by 1 say count ---- ---- A. 8 B. 11 C. 10 D. 9 E. 7 ---- ---- 27\. **What is output by the following code?** set a to 60 repeat 2 times change a by 10 say a ---- ---- A. 70 B. 76 C. 90 D. 80 E. 86 ---- ---- 28\. **What is output by the following code?** set list as empty set a to 2 repeat 6 times add a to list say list ---- ---------------------- A. \[2, 2, 2, 2, 2\] B. \[2, 2, 2, 2\] C. \[2, 2, 2, 2, 2, 2\] D. \[\] E. list ---- ---------------------- 29\. **What is output by the following code?** set f to 1 set g to 0 repeat until f \> 20 change g by f change f by 4 say g ---- ---- A. 38 B. 72 C. 45 D. 76 E. 68 ---- ---- 30\. **What is output by the following code?** set f to 1 set g to 0 repeat until f \> 16 change g by f change f by 7 say g ---- ---- A. 25 B. 24 C. 46 D. 8 E. 1 ---- ---- 31\. **What is output by the following code?** set list to \[1, 2, 3\] add 7 to list add 5 to list say list ---- ------------------- A. \[1, 2, 3\] B. \[5, 1, 2, 3\] C. \[1, 2, 3, 5, 7\] D. \[5, 7\] E. \[\] ---- ------------------- 32\. **What is output by the following code?** set list as empty set b to 2 repeat 4 times change b by 3 add b to list say list ---- ------------------ A. \[2, 5, 8, 11\] B. \[4, 5, 7\] C. \[5, 8, 11, 14\] D. \[8, 11, 14\] E. \[11, 14\] ---- ------------------ 33\. **What is output by the following code?** set list as empty set a to 3 repeat 2 times add a to list say list ---- ---------------- A. \[3, 3\] B. \[3\] C. \[3, 3, 3\] D. \[3, 3, 3, 3\] E. \[\] ---- ---------------- 34\. **What is output by the following code?** set list as empty set b to 5 repeat 5 times change b by 5 add b to list say list ---- ------------------------ A. \[25\] B. \[5, 10, 15\] C. \[5, 10, 15, 20, 25\] D. \[20, 25\] E. \[10, 15, 20, 25, 30\] ---- ------------------------ 35\. **Consider the following code.** //the following code would create a list //of random numbers //the user would be asked for a value //the code would search for value in the list //and remove each occurrence from the list set list as empty set rand to 0 repeat 10 times set rand to pick random 1 to 10 add rand to list set count to 0 ask \"Enter a number\" and wait set find to answer set spot to 1 repeat 10 times if item spot of list = find **\** else **\** **Which of the following code statements could fill blank \ ?** ---- ---------------------- A. delete find of list B. delete count of list C. delete list D. delete spot of rand E. delete spot of list ---- ---------------------- 36\. **Consider the following code.** //the following code would create a list of random numbers //the user would be asked for a value //the code would search for value in the list //and count each occurrence of value in the list set list as empty set rand to 0 repeat 10 times set rand to pick random 1 to 10 add rand to list set count to 0 ask \"Enter a number\" and wait set find to answer set spot to 1 repeat 10 times if item spot of list = find **\** **\** say count **Which of the following code segments could fill blank \ ?** ---- -------------------- A. change count by 1 B. change count by -1 C. change count by 0 D. change count by 2 E. change count by -2 ---- -------------------- 37\. **Consider the following code.** //the following code would create a list of random numbers //the user would be asked for a value //the code would search for value in the list //and count each occurrence of value in the list set list as empty set rand to 0 repeat 10 times set rand to pick random 1 to 10 add rand to list set count to 0 ask \"Enter a number\" and wait set find to answer set spot to 1 repeat 10 times if item spot of list = find **\** **\** say count **Which of the following code segments could fill blank \ ?** ---- -------------------- A. change count by 1 B. change count by -1 C. change count by 0 D. change count by 2 E. change count by -2 ---- -------------------- 38\. **What is output by the following code?** set c to 5 repeat until c \> 60 change c by 10 say c ---- ---- A. 15 B. 35 C. 55 D. 65 E. 75 ---- ---- 39\. **What is output by the following code?** set d to 32 repeat until d \> 50 change d by 4 say d ---- ---- A. 32 B. 36 C. 44 D. 52 E. 48 ---- ---- 40\. **Consider the following code.** //the following code would create a list //of random numbers //the user would be asked for a value //the code would search for value in the list //and remove each occurrence from the list set list as empty set rand to 0 repeat 10 times set rand to pick random 1 to 10 add rand to list set count to 0 ask \"Enter a number\" and wait set find to answer set spot to 1 repeat 10 times if item spot of list = find **\** else **\** **Which of the following code statements could fill blank \ ?** ---- -------------------- A. change count by 1 B. change count by -1 C. change count by 0 D. change count by 2 E. change count by -2 ---- --------------------

Use Quizgecko on...
Browser
Browser