APCSP Midterm (Previous Tests and Check Your Understandings)
How many bits would be needed to count all of the students in class today?
5 bits for 16 students in the class → 10000
"You win!" never displays. What line is responsible for this error? A. 1 B. 3 C. 4 D. 5
B. 3
How would you explain a number system to someone who had never seen numbers before?
A system made of a combination of shapes to express information
Which of the following binary (base-2) numbers is LARGEST? A. 11000000 B. 01111111 C. 00000001 D. 10111111
A. 11000000
Convert the binary (base-2) number 1001 to decimal (base-10). A. 9 B. 10 C. 16 D. 17
A. 9
What number will be output by the console.log command on line 7? A. 10 B. 100 C. 20 D. 200
B. 100
Jesse purchases a new smartphone and is immediately able to use it to send a photo over the Internet to a friend who lives in a different country. Which of the following is NOT necessary to make this possible? A. Both devices are using the same shared and open protocols B. A single direct connection is established between any two devices connected to the Internet C. The data of the image is routed through a sequence of directly connected devices before arriving at its destination. D. Both devices are directly connected to at least one part of the Internet
B. A single direct connection is established between any two devices connected to the Internet
Which of the following is NOT true of how computers represent complex information? A. Computing devices use patterns of bits to represent complex information B. Abstraction helps represent complex information by surfacing complexity that might otherwise be hidden C. Depending on context the same sequence of bits may represent different types of information D. Common abstractions that are represented by computing devices include numbers, characters, and color.
B. Abstraction helps represent complex information by surfacing complexity that might otherwise be hidden
Which of the following is true of functions? A. Programs written with functions run more quickly B. Functions can help remove repeated code from a program C. Replacing repeated code with a function will reduce the number of commands the computer needs to run D. Functions are called once but can be declared many times
B. Functions can help remove repeated code from a program
Which line of code in this program is MOST likely to result in an error? A. Line 1 B. Line 2 C. Line 3 D. Line 4
B. Line 2
Which of the following is true of lossy and lossless compression algorithms? A. Lossy compression algorithms are used when perfect reconstruction of the original data is important. B. Lossy compression algorithms are typically better than lossless compression algorithms at reducing the number of bits needed to represent a piece of data. C. Lossless compression algorithms are only used to compress text data. D. Lossless compression algorithms only allow for an approximate reconstruction of the original data.
B. Lossy compression algorithms are typically better than lossless compression algorithms at reducing the number of bits needed to represent a piece of data.
Which of the following is true of how packets are sent through the Internet? A. Packet metadata is only included on important packets to indicate they should get access to faster paths through the network B. Packet metadata is used to route and reassemble information traveling through the Internet C. Information sent through the internet is only encapsulated in packets if the message is too large to be sent as a datastream D. Information sent through the internet is split into two packets, one which contains the message and another which contains the metadata
B. Packet metadata is used to route and reassemble information traveling through the Internet
Which of the following is true of how computers represent numbers? A. Using a fixed but large number of bits can eliminate the possibility of round off error when representing numbers in binary B. With a fixed number of bits some numbers are too large to represent in a computer which will lead to overflow errors. C. Using a fixed but large number of bits, for example 128, eliminates the possibility of overflow errors. D. With a large but fixed number of bits it is possible to eliminate either round-off errors or overflow errors, but not both.
B. With a fixed number of bits some numbers are too large to represent in a computer which will lead to overflow errors.
This diagram shows a number of computing devices connected to the Internet with each line representing a direct connection. What is the MINIMUM number of paths that would need to be broken to prevent Computing Device A from connecting with Computing Device E? A. 1 B. 2 C. 3 D. 4
C. 3
Which of the following best describes how computing devices represent information? A. A computer will either represent information as bits or bytes but not both B. A computer represents data as a byte which is either a 0 or a 1 C. A computer represents data as bits which is either a 0 or a 1 D. A computer represents information as bits which contain 8 bytes.
C. A computer represents data as bits which is either a 0 or a 1
Which of the following best describes the purpose of a design specification? A. Tracking errors that arise through user testing B. Documenting comments that will need to be added to a program C. Describing the requirements for how a program will work or users will interact with it D. Listing detailed questions that will be asked of users during interviews
C. Describing the requirements for how a program will work or users will interact with it
How many total numbers can be represented with an 8-bit binary (base-2) system? A. 127 B. 128 C. 255 D. 256
D. 256
This diagram shows a number of computing devices connected to the Internet with each line representing a direct connection. Device A is attempting to send data over the Internet to Device E. Which of the following is true of how the data will travel through the network? A. The data will always travel through Device B as it is the shortest path B. The data will never be sent to Device G since there are other shorter paths available C. It is possible that the data travels through any of the devices in the network before arriving at device E D. If the data travels through Device D then it will not travel through Device B
C. It is possible that the data travels through any of the devices in the network before arriving at device E
An Internet Service Provider (ISP) is a company that builds the routers and wired connections that allow individuals to access the Internet. An ISP is considering adding additional redundant connections to its network. Which of the following best describes why the company would choose to do so? A. It costs less to design a network that is redundant B. The protocols of the Internet only work on networks that are redundant C. Redundant networks are more reliable D. Adding additional connections reduces the fault-tolerance of the network
C. Redundant networks are more reliable
What will be the order of letters printed to the console when this program is run? A. a b c B. a b c b c b c C. a b c b c D. a b c a
C. a b c b c
What will the "background-color" of the "topButton" be when the program is finished running? A. red B. orange C. blue D. green
C. blue
What text will be output by the program? A. Less than 10 B. Less than 20 C. Less than 30 D. 30 or more
D. 30 or more
What number will be output by the console.log command on line 5? A. 10 B. 25 C. 30 D. 35
D. 35
Which of the following is NOT a reason to include comments in programs A. Comments help the computer decide whether certain components of a program are important. B. Comments help programmers debug issues in their own code C. Comments help document how code was written for other programmers to use D. Comments enable programmers to track their work throughout the development process
D. Comments enable programmers to track their work throughout the development process
Which of the following Internet protocols is used to request and send pages and files on the World Wide Web? A. Transmission Control Protocol (TCP) B. Internet Protocol (IP) C. User Datagram Protocol (UDP) D. HyperText Transfer Protocol (HTTP)
D. HyperText Transfer Protocol (HTTP)
Which of the following is true regarding the way information is transmitted on the Internet? A. Information flows on a dedicated direct connection from the sender's device to the receiver's device using binary electrical signals. B. If a single packet is dropped, the entire file must be resent. C. Because of the reliability of the Internet, packets always arrive in the same order they were sent. D. Information does not travel in one piece, but rather as a datastream of packets.
D. Information does not travel in one piece, but rather as a datastream of packets.
What text will be output by the program? A. Output A B. Output B C. Output C D. Output D E. Output E
D. Output D
Which of the following best describes the protocols used on the Internet? A. The protocols of the Internet are designed by government agencies to ensure they remain free to use B. The protocols of the Internet are secret to maintain the privacy and security of people using them C. Each device connected to the Internet will use a protocol designed by the company that manufactured it D. The protocols of the Internet are open and used by all devices connected to the network
D. The protocols of the Internet are open and used by all devices connected to the network
What number will be output by the console.log command on line 5? A. 10 B. 11 C. 12 D. 13 E. 16
E. 16
Why is it important for element IDs to have meaningful names?
Helps to stay organized, makes code easier to write and review
An author is preparing to send their book to a publisher as an email attachment. The file on their computer is 1000 bytes. When they attach the file to their email, it shows as 750 bytes. The author gets very upset because they are concerned that part of their book has been deleted by the email address. If you could talk to this author, how would you explain what is happening to their book?
I would explain that this is happening due to lossless compression which is the computer condensing the file. However, when the file receives at the publisher the exact copy will reappear. There is zero data lost in lossless compression.
Describe how the Internet Protocol (IP) allows devices to easily connect and communicate on the Internet.
IP allows message to be sent clearly and have a destination that allows for proper sending
Which of the following BEST describes the differences between sequential and event-driven programming? A. In sequential programming commands run one at a time. In event-driven programming all commands run at the same time. B. In sequential programming commands run faster than in event-driven programming. C. In sequential programming each command is run many times in sequence. In event-driven programming all commands are run a single time as an event. D. In sequential programming commands run in the order they are written. In event-driven programming some commands run in response to user interactions or other events.
In sequential programming commands run in the order they are written. In event-driven programming some commands run in response to user interactions or other events.
Each time we add another bit, what happens to the amount of numbers we can make?
It doubles
When using bits to represent fractions of a number, can you create all possible fractions? Why or why not
No, because there are a limited number of fractions that can be represented by available number places
"The binary pattern 01000001 represents the number 65." Write a brief response explaining whether you believe this statement is always true. Explain your reasoning.
Not always true because it can represent other values in other systems
What is the difference between a sequential program and an event-driven program?
Sequential programming is for beginning-to-end code and event-driven programming is for waiting (or if) for something to occur to trigger the code.
Can a computer evaluate an expression to something between true and false? Can you write an expression to deal with a "maybe" answer?
Yes it can evaluate between true and false but it can't deal with a "maybe answer"
Convert the decimal (base-10) number 20 to binary (base-2). A. 10010 B. 00101 C. 11000 D. 10100
D. 10100
Which of the following situations is most likely to cause issues arising from the digital divide? A. A state makes voter registration forms available only by visiting a government website B. Two internet-connected devices located in different countries and thousands of miles apart attempt to communicate with one another C. Packets sent from one router to another begin arriving in a different order than they were sent D. A smartphone attempts to communicate over the Internet with another type of device, like a tablet or laptop
A. A state makes voter registration forms available only by visiting a government website
Which of the following best describes the purpose of an IP address? A. IP addresses provide a unique number for identifying devices that send and receive information on the Internet B. IP addresses assist in the reconstruction of a message that has been divided into many packets C. IP addresses indicate the location where an internet-connected computing device was manufactured D. IP addresses indicate how many times an individual packet has been requested by a router
A. IP addresses provide a unique number for identifying devices that send and receive information on the Internet
When creating an if-else-if statement you should always make your first condition the most specific. Write a short paragraph responding to the questions below. A. What does it mean to put the most specific case first? B. Why is it important to put the most specific case first? What types of errors does it help avoid?
A. Put the most specific part first that will apply to most of the if-else-if statement B. Applies to most of the code so there is less code left as it moves down the computer, which helps to alleviate bugs
Which of the following Internet protocols is MOST important in reassembling packets and requesting missing packets to form complete messages? A. Transmission Control Protocol (TCP) B. Internet Protocol (IP) C. User Datagram Protocol (UDP) D. HyperText Transfer Protocol (HTTP)
A. Transmission Control Protocol (TCP)
Choose the correct definition for Conditional Statement A. affects the sequential flow of control by executing different statements based on the value of a Boolean expression B. stores information as a number, String, or Boolean C. joins together two or more strings end-to-end to make a new string D. an ordered sequence of characters
A. affects the sequential flow of control by executing different statements based on the value of a Boolean expression
Two devices are connected to the Internet and communicating with one another. A squirrel chews through one of the wires in the network that is currently being used by the devices to communicate. The network immediately begins using a different path through the network and communication continues as normal. This situation best exemplifies which principle? A. fault-tolerance B. scalability C. protocol D. pathing
A. fault-tolerance
In which of the following stages of the development process is a team MOST likely to interview a potential user of an app? A. investigating and reflecting B. designing C. prototyping D. testing
A. investigating and reflecting
When this function is called, the smaller of two numbers is displayed. What Boolean expression would not work in line 12 in order to accomplish this goal? A. num1 == num2 B. num1 < num2 && num2 > num1 C. num2 > num1 D. num 1 < num2
A. num1 == num2
Which of the following is MOST likely to be an outcome of the digital divide? A. Certain companies will be unable to certify their technology as digitally secure. B. People from some racial or ethnic groups have unequal access to computing technology. C. People will have equal access and influence both globally and locally. D. Political groups in some countries are unable to agree on regulations of digital technology.
B. People from some racial or ethnic groups have unequal access to computing technology.
Choose the two statements that best describe the relationship between HTTP and the World Wide Web A. The World Wide Web is a protocol used for sharing HTTP messages B. The World Wide Web is a collection of pages and files that is shared between computers using HTTP C. Computers will send information using either HTTP or the World Wide Web, but not both. D. HTTP and the World Wide Web both rely on other layers of protocols for sending information on the Internet
B. The World Wide Web is a collection of pages and files that is shared between computers using HTTP D. HTTP and the World Wide Web both rely on other layers of protocols for sending information on the Internet
When visiting a museum Lian takes a photo of a painting with a smartphone which stores the photo as an image file. Which of the following best describes the differences between the painting itself and the photo of the painting stored on the smartphone? A. Both the painting and the photo are analog B. The photo is a digital representation of the analog painting C. Sampling can be used to determine whether the analog image is an accurate representation of the painting D. The phone can represent the photo in either digital or analog formats depending on the sampling technique that is used
B. The photo is a digital representation of the analog painting
What will the value of score be at the end of the program? Note: <- is used to represent a left facing arrow A. 1 B. The score is:4 C. 4 D. The score is: score
B. The score is:4
If the user does NOT click the button what color will "topButton" be when this program finishes running? A. red B. blue C. green D. orange
B. blue
This function chooses the screen to display based on the score. What is the correct way to call this function? A. CheckWin(); B. checkWin(); C. checkwin(); D. check Win();
B. checkWin();
What are the benefits of building redundancy into a network? What are the potential issues with building redundancy?
Benefits: ensures that a message will be sent to both sides in case one side is interrupted (makes for proper communication even when errors occur) Issues: can be difficult to make because of extra routers
Your computer uses 4 bits to represent decimal numbers (0, 1, 2, 3 and so on) in binary. What is the SMALLEST number for which an overflow error occurs? A. 14 B. 15 C. 16 D. 17
C. 16
Which of the following is true of how the Internet has responded to the increasing number of devices now using the network? A. The Internet protocols are changed every year to adapt to the new devices that have been connected to the network B. While the number of devices connected to the Internet has grown, the network itself has not grown C. The protocols of the Internet were designed to scale as new devices are added D. The protocols of the Internet are no longer necessary thanks to the large number of devices now connected to the network
C. The protocols of the Internet were designed to scale as new devices are added
How is a Creative Commons license different from a regular copyright?
Creative Commons licenses are copyright however others can still use the work. A regular copyright reserves work to only the owner.
Emilee is watching an online video. The video is being sent to her laptop by a server over the Internet which splits the video into packets and sends them in the order they appear in the video. Which of the following is true about how the packets will arrive at her computer? A. The packets will always be received in the order that they were sent B. Either every packet will reach her computer or none of them will. C. Packets that arrive out of order will be sent back to the server. D. The packets may arrive out of order
D. The packets may arrive out of order
Describe two different paths that a message could take from Person A to Person D
Person A to person B to person D and Person A to person E to person C to person D
What is the difference between a programming language and natural (every-day) language?
Programming language is very specific but natural language is more open-ended
Your computer science teacher asks you to sample a black and white image that is 4" x 6". How would you sample the image to provide a good digital approximation using the pixelation widget? What sample size would you use? How would your decision affect the digital representation?
Sample size of 15 x 15 so the grid would by 20" x 25". This would use 500 sample squares to create a detailed image
Describe how the process of sampling, RGB pixels, and binary sequences work together to display a digital color image.
Sampling makes a framework and then color is added through RGB pixels; the more RGB pixels the more colors; the binary sequences represent a large range of colors and hues in the image
What are the similarities and differences between the binary and decimal systems?
Similarities: systems of shapes, have a "one's" place, zeros on the left-hand side do not affect binary or decimal number Differences: binary system is base-2 but the decimal system is base-10; computers use binary and people use decimal
You've been given a new cell phone with a 2 gigabyte data plan. You plan to use your phone for text messages, images, video, and music. Which of these categories are best compressed using lossless compression? Which of these categories are best compressed using lossy compression? Why?
Text messages are best compressed using lossy compression because people already talk in abbreviations that use less data. Videos, images, and music are best compressed using lossless compression because you need the full image or song for it to be valuable. There is little enjoyment when listening to a song with bad quality.