cps
A program calculates the total number of minutes that have passed since 1:00 PM after the user types in the current time. The user types in the current time as an hour and a minute. For example, consider the following input: hour: 2minute: 35 The program would report the following: 95 minutes have passed since 1:00PM. Assume that the user will not input a time after midnight or before 1:00PM. Which of the following equations would find the correct number of minutes?
(hour - 1) * 60 + minute
Given the following code segment: x ← 10 y ← 5 z ← 20 DISPLAY ( x + ((z MOD 7) * y + x) / 8 - 2 + z / y ) Of the following, which is closest to the number being displayed as a result of executing this code segment?
17
Use the following code segment to answer this question. z ← (a + b) MOD 10 What will be the value of z at the end of this code segment, given that a is 4 and b is 5?
9
Which of the following is an example of abstraction?
A parent is teaching their child how to drive a car. Instead of explaining how the engine works, they explain that turning the key will start the car.
Which of the following program functionalities will MOST likely require string concatenation?
A program combines four random words into a secure password.
Boolean
A single value of either TRUE or FALSE
Collaborative spreadsheets are now common tools for people to use and share information in real time. An example of collaborative spreadsheet software is Google Sheets. Of the following situations, which are most conducive for using collaborative spreadsheet software instead of using standalone spreadsheet software? Select TWO answers.
A team of engineers records their individual test results, which are monitored by a supervisor every hour. Each day, students in an AP Computer Science Principles class record how many hours of sleep they received the previous night, and the average is reported to the class.
Collaboration is an important way of working in the modern world. Of the following statements, which more accurately describe advantages of teams working together collaboratively? Select TWO answers.
Brainstorming among team members encourages creativity. Work being shared among team members helps get the job done faster.
A programmer asks a partner to help debug their code. The programmer tells their partner that the code is supposed to take a list of names and return the alphabetically sorted list with any duplicate names in bold. Why will this information help the partner debug the programmer's code?
Knowing what the program is supposed to do will help them determine which test cases can be used to find errors in the code.
Which of the following is NOT an example of collaboration?
Seth and Alex each decide they want to create a piece a music using a coding software. Seth and Alex discuss what genre of music they want to make, but they cannot agree. They each decide to create their own music.
Different computing devices rely on different forms of input data. Elevators are controlled by a panel of buttons. Which of the following correctly describes the form of input used by elevators?
Tactile.
Consider the following lines of code: subject ←["bird", "cat", "dog", "rabbit"] verb ←["flew", "meowed", "barked", "jumped"] FOR EACH item IN subject { index ← RANDOM(1,3) sentence ←"The " + item + verb[index] + "." } The expected result is a complete sentence such as "The bird flew.". Which of the following is a potential output as the code is currently written?
The catmeowed.
A programmer is developing software for a client. Which of the following will best help the programmer understand what the software is supposed to do?
The intended outcome of several specific inputs.
Three friends are collaborating on a big AP® Statistics project. They met once and decided to gather data about the "effect of extracurricular activities on class rank." Separately, they generated their own questions and collected data from various classmates. Each student cleaned their individual dataset, and then they combined the three datasets into one dataset. The end product was a scatterplot that analyzed their results. However, the teacher was not impressed with their work. Which of the following are the most appropriate changes the students should make to their collaborative process to make it more effective? Select TWO answers.
The students should develop the survey questions together and each should ask the same questions to their classmates. The data should be combined before it is cleaned, so that it is cleaned in a consistent manner.
Which of the following would be the best explanation of the functionality of a program?
The user calculates their bill by entering the price of each item they plan to purchase. The user then clicks "calculate" to determine the total cost.
A home security company develops software that takes a human voice as input, searches for the voice in a voice recognition database, and determines the identity of the person based on the voice. It is sophisticated enough to be able to distinguish a live voice from a recorded voice. The main purpose of this software is to activate and deactivate the security system at a person's home residence. Of the following, which would be the MOST logical extension of this software for another purpose?
To allow an officer's entry into a military facility.
Which of the following is the MOST significant reason it is important to understand the purpose of a computing innovation?
Understanding the purpose improves the probability of success in developing the computing innovation.
A student is working on creating a fairly large program. Which of the following strategies will make their code easier to maintain once the program is finished? Select TWO answers.
Using procedures for repeated code. Writing documentation for all procedures and variables in the program.
Strings
any string of characters (both letters and numbers) for numbers it is strictly only numbers that will have no value to them besides character value. such as a random set of numbers for an ID; 13538924
A student is creating a program to automate the invitation process for a party. They want to invite everyone in the invites list except for "John". Which of the following algorithms correctly displays everyone's name in the list, except for "John"?
invites ← ["Jill", "Jacob", "John", "Jean"] FOR EACH name IN invites { IF (NOT (name = "John")) { DISPLAY(name) } }
Iteration
is a sequence of instructions that is continually repeated. a for loop as an example
Consider the code below: 1 numbers ← [12, 17, 15, 72, 3] 2 big ← 0 3 FOR EACH number IN numbers 4 { 5 IF (number > 15) 6 { 7 big ← big + 10 8 } 9 ELSE 10 { 11 big ← big - 10 12 } 13 } 14 DISPLAY (big) Line 3 is best described as
iteration
number
only numbers that have or will have a value to them. such as 10 from 10 = 2 times 5
Consider the following short program: 1. pi ← 3.14159 2. r ← INPUT() 3. a ← pi * r * r 4. DISPLAY (a) In the short program above, which is best thought of as a constant?
pi
A programmer wants to write a code that will swap the values of two variables, x and y. He knows that he needs to create a temporary variable temp but is unsure how to make the program work correctly. Which of the following code segments will correctly swap the values of x and y? Select TWO answers.
temp <--- x x <--- y y <--- temp temp <--- y y <--- x x <--- temp
What will be the values of x, y, and z after the following code executes? x ← 0 y ← 1 z ← 2 x ← y z ← x z ← y * 2
x = 1, y = 1, z = 0