AP Computer Science 1st Semester Finals PDF
Document Details
Uploaded by Deleted User
Tags
Related
Summary
This is a computer science exam paper for first semester students. The test covers topics about networks, the internet, and programming concepts. The paper comprises multiple choice questions and code.
Full Transcript
AP Computer Science 1st Semester Finals Directions: Write the letter of the correct answer for each numbered item. 1. 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 an...
AP Computer Science 1st Semester Finals Directions: Write the letter of the correct answer for each numbered item. 1. 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. 2. 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. 3. Which of the following best explains how messages are typically transmitted over the Inter- net? 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 4. 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 AP Computer Science 1st Semester Finals 5. Which of the following best describes the relationship between the WWW and the In- ternet? 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 us- ing 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. 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 pres- ence of a failed component. C. By providing open network protocols, ensuring that all devices on the network are inter- acting 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 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 AP Computer Science 1st Semester Finals 9. 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 10. 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 11. 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. 12. 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 13. 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 AP Computer Science 1st Semester Finals 14. 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 15. 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 16. 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 17. 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 AP Computer Science 1st Semester Finals 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 60 repeat 2 times change a by 10 say a A. 70 B. 76 C. 90 D. 80 E. 86 20. 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 AP Computer Science 1st Semester Finals 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 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 23. 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 24. 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 AP Computer Science 1st Semester Finals 25. 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 26. 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 27. 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 AP Computer Science 1st Semester Finals 28. 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 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 AP Computer Science 1st Semester Finals 31. What is output by the following code? set list to [1, 2, 3] say list A. [1, 2, 3] B. C. [3, 2, 1] D. E. [] 32. 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. [] 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. C. [3, 3, 3] D. [3, 3, 3, 3] E. [] 34. 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 AP Computer Science 1st Semester Finals 35. 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] 36. 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. B. [5, 10, 15] C. [5, 10, 15, 20, 25] D. [20, 25] E. [10, 15, 20, 25, 30] AP Computer Science 1st Semester Finals 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 AP Computer Science 1st Semester Finals 38. 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 AP Computer Science 1st Semester Finals 39. 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 AP Computer Science 1st Semester Finals 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 AP Computer Science 1st Semester Finals