APCSP Midterm
28. Which of the following are examples of cybersecurity threats that are designed to attack users or computer networks? Select two answers.
a. Distributed denial of service (DDoS) c. Phishing
20. Using a Caesar cipher of shift -3, decode the following message: bibsbkp ybkze
a. Elevens bench
31. Which of the following is true about a low-level language? Select two answers:
a. Guaranteed to be unambiguous b. Less readable by humans than other languages
11. The following set of instructions represent what kind of flow pattern? Dump cereal in bowl Pour milk in bowl Eat cereal and milk Place spoon and bowl in dishwasher
a. Sequence
18. Which of the following illustrates an aspect of efficiency?
a. Size of program b. Execution time c. Memory usage d. All of the above
14. Which of the following best defines confidentiality in context with information and data?
a. The ability to limit access to information to a certain set of users
14. Microsoft Excel® is a spreadsheet program that can be used for computing the average of a list of values in cells A1 through A20 with a command such as =AVG(A1:A20). After the user initiates this command, the command disappears and the average (or mean) of the list of numbers appears. Why is this an abstraction?
a. The average can be viewed without knowing the process of how the average was computed.
27. What must you consider when determining the efficiency of an algorithm? Select two choices.
a. The length of time required to run the program b. The amount of resources, such as storage, required
20. Sally notices that she has the same set of 10 blocks in her code in multiple places. She decides to create a new block (procedure) in Scratch so that she can simply replace those 10 blocks with one procedure. Why would this be beneficial to Sally when she debugs and reasons through her program? Select two answers.
a. The procedure makes the code section more abstract, so she doesn't have to think through all 10 blocks each time she comes across them in her code. c. If there is an error in the procedure, she can fix the error in the procedure without having to search through her code for each place the procedure is used.
28. Consider the following code segment that appears in the middle of a program. Which of the following can replace the missing statement in the REPEAT UNTIL block so that the user will be required to enter the correct password of "swordfish" before they can continue on with the rest of the program.
a. userPassword = "swordfish"
9. For what values of x and y,when inputted into the program below, will the output display Right Right?
a. x must be 0 and y must be a positive number
21. What values are more likely to be displayed using the following block of code? Select two answers.
b. 12 c. 14
2. Moore's Law describes the rate at which the number of transistors on a single chip doubles over time. Which of the following assumptions CANNOT be inferred as a direct consequence of this rate of doubling?
b. Five years from now, web pages will require less memory (RAM) than today's web pages.
29. A large office building has an elevator that carries occupants between any of the building's 10 floors. The basement is referred to as "Level 0" while the topmost floor is "Level 9." The software for the elevator uses a variable, called level, to track the floor number of the elevator's current position. When a person presses a button requesting the elevator to rise to a higher floor, the following is invoked: What is displayed if the elevator is currently on the 7th
b. Level 8 Level 9 Cannot go up.
24. Which of the following is the MOST important reason computers use artificial languages over natural language?
b. The syntax of artificial languages is explicit and unambiguous
30. Which of the following ways of sharing your social security number with a friend poses the least risk of your information being stolen by someone else? Select two answers:
b. Typing your social security number into a form on a website that uses SSL, which can then be accessed by your friend. c. Writing your social security number on a piece of paper and then shredding it once the other person has received it.
31. Given the following code segment, what would be displayed if age were initialized with a value of 18?
b. group
25. Using a Vigenere Cipher with a keyphrase code of BEG, decipher the given hidden message: kirmc hfet.
c. jelly bean
15. Which of the following will cause an algorithm to fall into an infinite loop?
d. The condition of the loop never becomes false
21. Which of the following best describes the concept of distributed computing?
d. a network of autonomous computers that communicate with each other in order to achieve a goal
4. Which of the following would be the most appropriate name for a variable?
d. time_left
15. An algorithm was developed to keep track of how many baskets a student has made while playing basketball. Which of the following program structures must be added to the old algorithm to create a new algorithm that only keeps track of 3 pt. baskets and not 2 pt. baskets.
d. Selection
16. Jessica has been tasked with creating a search algorithm for a large data set. If she is searching for an item that is located last on the list, which search algorithm would be least efficient?
d. Sequential
23. Which of the following is a key factor in determining the efficiency of an algorithm?
d. The amount of storage required and time it takes to run
17. Which of the following is the best example of a heuristic approach to solving a problem?
d. Using your thumb and forefinger in order to add a pinch of salt to a meal because the recipe that your grandma has written on an index card says, "Add some salt".
19. Under which of the following conditions is it most beneficial to use a heuristic approach to solve a problem?
d. When the problem cannot be solved in a reasonable time and an approximate solution is acceptable
10. Every task that you deal with on a day-to-day basis, no matter how large or small, requires that you perform a specific set of actions and make a particular set of decisions in very precise ways. These sets of actions and decisions are known as what?
a. Abstraction
6. Whenever you generalize a variety of related problems and develop a common solution that can be applied to solve any of them, you are using the technique called
a. Abstraction
25. One of the biggest limitations to advancing digital communication and resources has been storage and transfer of information via cloud computing. Which of the following are reasons why cloud computing has gained users and popularity over the past 10 years? Select two choices.
a. Affordability of cloud storage d. Increased security of information
30. Consider the following code segments designed to find the area of a triangle (A = ½ bh). Program A Program B Which of the following statements about the above programs is true?
a. Both programs will work as intended, but Program B is more readable.
23. Which of the following are true about programming documentation? Select two answers:
a. It is useful to other programmers that view your code, so that they can understand what different parts of the code are intended to do. c. It allows the programmer an opportunity to attribute help, work and code from others.
17. A statistics teacher wishes to create a program on her calculator that generates a random even integer. The command built in the calculator to generate a random positive integer is RANDOM(a,b). This command generates a random integer between integers a and b (and including a and b). Which of the following lines of code will ensure that the random integer generated will be even?
a. RANDOM(a,b) * 2
11. Samantha and her programming team have been asked to create a new APP for their client. Which of the following is the most pertinent concept they must understand?
a. The outcomes for specific user inputs b. Flow charts to display the user interface c. Having a strong understanding of algorithms and abstractions d. All of the above
26. Which of the following is a benefits of well-named variables. Select two answers.
a. The program will be easier to read. d. The program will be easier for others to debug.
24. A student developed a program that outputs the name of a fruit that begins with a letter, dependent upon the variable keyPressed, which stores the letter (from A to Z only) a user types on the keyboard. Below is a section of code from her program: Which of the following descriptions below would be a way that this student might have written the rest of her code so that it executes as intended? Select two answers.
a. Use 25 nested if / else blocks where the if portion is formatted like the code segment above (changing the letters of the alphabet and fruits) and the else simply holding the next if portion until the last else, which displays a fruit that begins with Z. d. Use 26 if blocks formatted similarly to the one above (changing the letters of the alphabet and fruits).
10. Which of the following is a reason for the importance of variables in programming?
a. Variables speed up computation. b. Variables assist in making code more readable. c. Variables allow you to store information for any desired attribute. d. All of the above
1. Which of the following could be considered part of the beginning "state" of a Scratch program?
a. Visibility of sprites b. The background image c. The value of a variable d. All of the above
8. Using a Caesar Cipher with an offset of 13, decode the following ciphertext back to plaintext: znyjner
a. malware
7. What starting value of n would make this portion of the program repeat the block of code below the most amount of times?
b. 2
9. SSL (Secure Sockets Layer) refers to the process in which websites send the user a "lock" to encrypt their data so that any traffic being sent over the Internet can then only be decoded by the website who create the original key/lock pair. What symbol found in the address bar usually indicates that a website has such security in place?
b. A Green Padlock
8. Consider the block of code below: What would be the most appropriate substitute for the missing Boolean Operator if the intention is to display "True" for only values of x between, but not equal to values of 0 and 10?
b. AND
5. While writing a program to regulate the speed of a self-driving car, you find that your software sometimes miscalculates the ideal car speed for city streets to be over 1500 MPH (nearly twice the speed of sound), when it should be approximately 30 MPH. Which of the following strategies would be best to employ in debugging your program?
b. After each calculation within your program, insert a temporary statement that displays the most recently calculated value. When running your program, compare the displayed values with the expected values to identify where in the program the error is being introduced.
32. Which of the following algorithms require both selection and iteration? Select two answers:
b. An algorithm that, given a list of integers, displays the number of even integers in the list. c. An algorithm that, given a list of integers, displays only the negative integers in the list.
22. Consider the following code segment that is intended to accept two integers, x and y, as input, and then display "yes" if and only if x is greater than y and y is less than or equal to 20. Otherwise, it should display "no". Unfortunately, the above code does not perform as intended. Identify two different options that a programmer might choose, either of which will correct the code so that it performs as intended. Select two answers.
b. Change the condition in the IF block to be: IF x > y AND y ≤ 20 d. Swap the two DISPLAY blocks (i.e., DISPLAY "yes", DISPLAY "no")
27. A client wishes for your project group to create a program to efficiently catalog their inventory of classical music CDs. What are two important considerations that you might need? Select two answers.
b. Conversations about how the program will work c. Input on the design of the user interface
3. Which of the following best describes the need for using cryptography in data communications?
b. Cryptography ensures data is decipherable by the recipient, but not accessible by a third party.
12. A program that Thomas has written is complete. Now he is trying to determine ways to test the program for accuracy and fix errors when he finds them. What is this procedure called?
b. Debugging
2. Chad has written the majority of his code in Scratch and is ready to start thinking of test cases to make sure that his program functions properly, and when issues arise, fix them. This process is known as what?
b. Debugging
19. Understanding of the life cycle of a program is an essential component to becoming an effective programmer. Which of the following is the best example of how the life cycle of a program should work?
b. Idea→algorithm→write code→execute code→debug→maintain
29. Which of the following is NOT true about high level programming languages? Select two answers:
b. It is guaranteed to be ambiguous d. All languages are the same in terms of expressing different algorithms
16. Which of the following best describes malware?
b. Software that is intended to damage or disable computers and computer systems.
13. As part of the lifecycle of a program, after a computer programmer writes the code, it is then compiled and most times, created into an executable file to be run on the CPU. The code that is run through the compiler is known as what?
b. Source Code
4. According to Moore's Law, increases in technological performance should approximately double every year. If this holds true, how much can performance be expected to increase over 5 years?
c. 32 times as much
13. Consider the given code using variables a, b, and c. What will be the output of this code? a ← 2 b ← 6 c ← 12 a ← b b ← c DISPLAY(a) DISPLAY(c)
c. 6 12
3. Which of the below options would be the best set of instructions to give for a program designed in Scratch?
c. Click on the GREEN flag. Once the game starts, use the arrow keys to navigate your way through the maze. In your travels, collect the "hearts" for more lives and avoid being eaten by zombies.
7. Which of the following is part of the CIA Triad
c. Integrity
22. Which of the following best describes high level computing languages?
c. They are not ambiguous
6. While developing a program, you find a similar project that someone has created and posted online. It contains a number of elements (e.g., images, music, code segments, etc.) that you would like to integrate into your own project. Under what conditions may you reuse these elements in your work?
c. You may only reuse elements for which the original owner has granted a license to reuse, such as the Creative Commons Share Alike license.
18. Consider the given code fragment. Determine the output of the program fragment. m ← 2 REPEAT UNTIL(m > 500) { DISPLAY(m) m ← m + 2 }
d. All even numbers 2 4 6 8 ... 500
5. Which of the following is a good practice to prevent your password from being vulnerable to attacks?
d. Create your passwords based on some algorithm that helps generate a password that uses a combination of letters, numbers and symbols.
1. Which of the following types of languages is optimized for machine processing and may be written and expressed as a series of binary digits (e.g., ones and zeros), making it difficult for humans to read and write?
d. Low-level programming language
26. Which of the following best describes an effect of Moore's Law?
d. Past performance of increased computing power has driven more investment in innovation.
12. What type of language is used in the below algorithm? Prompt user for number if number is greater than or equal to 0 Output "Positive" else Output "Negative" Repeat 4 times
d. Pseudocode