Comp Sci
Which of the following is a true statement about Internet communication?
Every device connected to the Internet is assigned an Internet protocol (IP) address.
The question below uses a robot grid of squares. The robot is represented as a triangle, which initially starts in the top-left square facing toward the right side of the grid
GG
A NAND gate is a type of logic gate that produces an output of false only when both of its two inputs are true. Otherwise, the gate produces an output of true. Which of the following Boolean expressions correctly models a NAND gate with inputs P and Q ?
NOT (P AND Q)
A programmer wishes to create a program for calculating his grades in courses and to verify his GPA. Which data type is the most appropriate?
Real Number
Consider the following program. count = 1 sum = 0 repeat 10 times { sum = sum + count count = count +2 } display sum Which of the following describes the result of executing the program?
The program displays the sum of the odd integers from 1 to 19
Referring to the scores list in question 14 and the APCSP Lists Operations, select the pseudocode to insert the value at the middle of the scoreslist.
a INSERT (scores, 6, 66)
Internet packets are made up of sequences that are sent through the lowest layer of OSI.
binary
Consider the following code segment. What is displayed as a result of execution? d ß 10 e ß 20 f ß 30 e ß d DISPLAY (e)
10 20
A programmer notices the following two procedures in a library. The procedures do similar, but not identical, things. • Procedure Square (n) returns the value n 2 . • Procedure Cube (n) returns the value n 3 Which of the following procedures is a generalization of the procedures described above?
Procedure Power (n, m), which returns the value n^m
The failure to create a condition on which a repeat statement is controlled creates which programming error?
infinite loop
The question below uses a robot in a grid of squares. The robot is represented as a triangle, which is initially in the bottom right square of the grid and facing toward the top of the grid. The following programs are each intended to move the robot to the gray square. Program II uses the procedure GoalReached, which returns true if the robot is in the gray square and returns false otherwise. Which of the following statements is true?
Both program I and program II correctly move the robot to the gray square.
Which of the following describes how a distributed denial-of-service (DDoS) attack is most likely to compromise an online store'sWeb site?
By preventing customers from placing orders
A bank customer receives an e-mail from a sender claiming to be a bank employee. The e-mail asks the customer to provide personal information and to call a phone number if he or she has any questions. The customer suspects the e-mail might be a phishing attempt. Which of the following responses is most likely to be a privacy risk for the bank customer?
Calling the phone number given in the e-mail and providing the personal information over the phone
Which of the following statements accurately describe the hierarchy of theWeb pages example.org and about.example.org ? Select two answers.
the web page example.org is a domain under the top-level domain .org the web page about.example.org is a subdomain of about.org
Ebony is searching for an Internet provider. Which is her best consideration when selecting from her options.
Both Internet speed and latency
Identify the organization who sets industry standards for computing:
IEEE (Institute of Electrical and Electronics Engineering
Mercedes is planning to expand her jewelry business from artisan fairs into e-commerce. Which two of the following strategies should she employ to best grow her customers and sales?
Partner with another ecommerce site to facilitate secure transactions Create a smooth interface to facilitation site navigation.
The binary search algorithm makes which vital assumption about the data list being considered?
The data is pre-sorted.
Consider the program segment below. Which statements best describe num2 when num1 is any positive integer. (2 responses)
a positive integer num1 + 20
The procedure DrawCircle (x, y, r) can be used to draw a circle on a coordinate grid. The circle is centered at the coordinate (x, y) and has a radius of r units. The procedure will be used to draw the following figure on a coordinate grid.
xPos ← 3 yPos ← 6 REPEAT 3 TIMES { } DrawCircle (xPos, yPos, 2) xPos ← xPos + 2 yPos ← yPos - 2
In a certain science experiment, 75 percent of trials are expected to be successful and 25 percent of trials are expected to be unsuccessful. The program below is intended to simulate the results of repeated trials of the experiment. successful ← 0 unsuccessful ← 0 REPEAT 1000 TIMES { IF (<MISSING CODE>) { successful ← successful + 1 } ELSE { unsuccessful ← unsuccessful + 1 } } DISPLAY (successful) DISPLAY ("trials were successful,") DISPLAY (unsuccessful) DISPLAY ("trials were unsuccessful.") Which of the following can be used to replace <MISSING CODE> so that the simulation works as intended?
RANDOM (1, 100) ≤ 75
Bella is writing a program that will ask the user a series of questions pulled randomly from a list. The responses will be used for completing an output procedure. She realizes that this program should have a control structure in order to limit the number of questions to be posed to the user. Which control structure will allow Bella to limit the number of questions?
Repeat loop
Byte pair encoding is a data encoding technique. The encoding algorithm looks for pairs of characters that appear in the string more than once and replaces each instance of that pair with a corresponding character that does not appear in the string. The algorithm saves a list containing the mapping of character pairs to their corresponding replacement characters. For example, the string "THIS_IS_THE_BEST_WISH" can be encoded as "%#_#_%E_BEST_W#H" by replacing all instances of "TH" with "%" and replacing all instances of "IS" with "#". For which of the following strings is it NOT possible to use byte pair encoding to shorten the string's length?
"LEVEL_UP"
A spinner is divided into three sections. The sector labeled Red is four times as large as each of the sectors labeled Blue and Yellow, which are of equal size. The procedure below is intended to simulate the behavior of the spinner. Which of the following can be used to replace <MISSING CODE> so that the procedure correctly simulates the spinner?
(swis) CHEESE spin arrow random 1,6 if spin is 1 return yellow if spin is 2 r return blue return red CHECK THIS
The diagram below shows a circuit composed of three logic gates. Each gate takes two inputs and produces a single output.
A = true, B = false, C = false, D = false
Which of the following describes a benefit of using hexadecimal numbers instead of binary numbers to represent data?
A hexadecimal representation of a value generally requires fewer digits than a binary representation of the same value.
A program contains the following procedures for string manipulation. Which of the following expressions can be used to generate the string "Happy" ?
Concat (Substring ("Harp", 1, 2), Substring ("Puppy", 3, 3))
Which of the following best describes the role of the Internet Engineering
Developing standards and protocols for Internet communication
Select the language supported by the ASCII character set:
English
The grid below contains a robot represented as a triangle, initially facing up. The robot can move into a white or gray square but cannot move into a black region. The code segment below uses the procedure GoalReached, which evaluates to true if the robot is in the gray square and evaluates to false otherwise. REPEAT UNTIL (GoalReached ()) { <MISSING CODE> } Which of the following replacements for <MISSING CODE> can be used to move the robot to the gray square?
IF (CAN_MOVE (right)) { ROTATE_RIGHT } MOVE_FORWARD ()
The CPU (central processing unit) of a computer is a(n):
Integrated circuit
The program below is intended to count the number of prime numbers in a list called numbers and display the result. The program uses the procedure isPrime (n), which returns true if n is a prime number and false otherwise. The program does not work as intended. Which two lines of code should be removed so that the program will work as intended? Select two answers.
Line 4 Line 9
A local web development company wishes to hire a developer with application layer expertise to handle end-user support. Select the areas of expertise should the ideal candidate possess as an Application Layer expert?
NICE
A population researcher is interested in predicting the number of births that will occur in a particular community. She created a computer model that uses data from the past ten years, including number of residents and the number of babies born. The model predicted that there would be 200 births last year, but the actual number of births last year was only 120. Which of the following strategies is LEAST likely to provide a more accurate prediction?
Removing as many details from the model as possible so that calculations can be performed quickly CHECK THIS
A student wrote the procedure below, which is intended to ask whether a user wants to keep playing a game. The procedure does not work as intended. Which of the following best describes the result of running the procedure?
The procedure returns true no matter what the input value is.
A musician is creating a song using audio samples. Which of the following actions will minimize the risk of a copyright violation when creating sample-based music?
Using samples published with a no-rights-reserved Creative Commons license
A model is a(n) of an actual system
abstraction
Data representation is as follows: is continuous; is broken in pieces.
analog digital
Consider the pseudo code segment below. /30 //Read and average three numbers If (avg > 89.45) Print "Congratulations, you made an A!" Else Print "Your average is" + avg "." What selection criteria is being used to determine the output? (choose 2)]
avg results above 89.45 Logical condition
A student is creating a procedure to determine whether the weather for a particular month was considered very hot. The procedure takes as input a list containing daily high temperatures for a particular month. The procedure is intended to return true if the daily high temperature was at least 90 degrees for a majority of days in the month and return false otherwise. PROCEDURE IsHot (temperatureList) { total ← 0 counter ← 0 FOR EACH temperature IN temperatureList { IF (temperature ≥ 90) { counter ← counter + 1 } total ← total + 1 } RETURN (<MISSING CODE>) } Which of the following can be used to replace <MISSING CODE> so that the procedure works as intended?
counter > 0.5 * total
Sam needs to send a picture via email and wants it to arrive in best quality, therefore, he should select which lossless compression image format?
png
The procedure Smallest is intended to return the least value in the list numbers. The procedure does not work as intended. PROCEDURE Smallest (numbers) { min ← numbers[1] FOR EACH number IN numbers { IF (number < min) { RETURN (number) } } RETURN (min) } For which of the following values of theList will Smallest (theList) NOT return the intended value? Select two answers.
theList ← [40, 30, 20, 10] theList ← [30, 40, 20, 10]
Consider the code segment below: line 3 t1 ß 0 line 4 t2 ß 0 line 5 t3 ß 0 line 6 a ß 0.00 line 7 a ß (t1 + t2 + t3)/3 line 8 DISPLAY a What type of data may be entered for t1-t3?
yo yo you figure it out
What is output by the code below? Display( 20 mod 4) + 3
3
What is the output of the following program segment? s ß "Hula-hoops were a fad." DISPLAY (s.indexOf("hoo"))
6
Which of the following would be the best use of citizen science?
An experiment that requires data measurements to be taken in many di erent locations
A media librarian at a movie studio is planning to save digital video files for archival purposes. The movie studio would like to be able to access full-quality videos if they are needed for future projects. Which of the following actions is LEAST likely to support the studio's goal?
Using lossy compression software to reduce the size requirements of the data being stored
This logic is used to describe behavior of gates and circuits:
boolean
A video-streaming service maintains a database of information about its customers and the videos they have watched. The program below analyzes the data in the database and compares the number of viewers of science fiction videos to the number of viewers of videos of other genres. It uses the procedure Analysis (category), which returns the number of unique users who viewed videos of a given category in the past year. The Analysis procedure takes approximately 1 hour to return a result, regardless of the number of videos of the given genre. All other operations happen nearly instantaneously. sciFiFans ← Analysis ("science fiction") genreList ← ["comedy", "drama", "mystery", "romance"] FOR EACH genre IN genreList { IF (Analysis (genre) > sciFiFans) { DISPLAY (genre) } } Which of the following best approximates the amount of time it takes the program to execute?
5 hours
A text-editing application uses binary sequences to represent each of 200 different characters. What is the minimum number of bits needed to assign a unique bit sequence to each of the possible characters?
8
Which of the following best characterizes a high-level programming language?
A language that uses multiple abstractions to manage complexity
Which of the following is an underlying assumption that is made when Moore's law is used?
As computer hardware improves, future computers will be able to run faster than current computers.
Which of the following is an example of symmetric encryption?
Finn and Gwen develop a system that maps each letter of the alphabet to a unique symbol using a secret key. Finn uses the key to write a message to Gwen where each letter is replace
Secondary storage could be accomplished using which two of the following:
Hard disk Flash drive
An application program interface (API) provides a procedure Max, which returns the greater of its two integer arguments. A programmer would like to find the greatest of three integer values a, b, and c. Which of the following expressions will produce the desired result in every case?
Max (Max (a, b), c)
Which of the following explains a benet of using open standards and protocols for Internet communication?
Open standards and protocols allow di erent manufacturers and developers to build hardware and software that can communicate with hardware and software on the rest of the network.
A social media site allows users to send messages to each other. A group of researchers gathered user data for the first 10 years of the site's existence. Some of the data are summarized in the table below, along with some of the company milestones. Which of the following hypotheses is most consistent with the data in the table?
The mobile app release led to users tending to write shorter messages.
Select the best description for a control structure
a An order that speci es the sequence in which program instructions are to be executed
Grades in a computer science course are based on total points earned on a midterm exam and a final exam. The teacher provides a way for students to improve their course grades if they receive high scores on the final exam: if a student's final exam score is greater than the student's midterm exam score, the final exam score replaces the midterm exam score in the calculation of total points. The table below shows two students' scores on the midterm and final exams and the calculated total points each student earns. A programmer is writing a procedure to calculate a student's final grade in the course using the score replacement policy described. The student's exam scores are stored in the variables midtermExam and finalExam. The procedure Max (a, b) returns the larger of a and b. Which of the following could be used in the procedure to calculate a student's total points earned in the course and store the result in the variable adjustedTotal?
adjustedTotal ← Max (midtermExam, nalExam) + nalExam
A student wrote the following code for a guessing game. While debugging the code, the student realizes that the loop never terminates. The student plans to insert the instruction WIN←TRUE somewhere in the code. Where could win <-true be inserted so that the code segment works as intended?
Between line 9 and line 10
The two code segments below are each intended to display the average of the numbers in the list numList. Assume that numList contains more than one value. Which of the following best describes the two code segments?
Both code segments display the correct average, but code segment I requires more arithmetic operations than code segment II.
In determining the best route to take on recent trip using a maps application gave the user three options based on trac patterns, road construction, and roadways. Choosing the best alternative among the three possible routes is considered which of the following:
Heuristic solution
A smartphone stores the following data for each photo that is taken using the phone. • The file name of the photo • The date and time the photo was taken • The geographic location where the photo was taken Assume that all of the photos that have been taken on the phone are accessible. Which of the following can be determined using the photo data described above? I. The number of photos that were taken at a particular geographic location II. The number of photos that were taken in the last year III. The name of the person who took the most recent photo
I and II only
Which of the following actions could be used to help reduce the digital divide? I. Providing free education and training on how to use computing devices II. Providing free or low-cost computing devices to low-income individuals III. Providing networks and infrastructure to people in remote areas
I, II, and III
Which of the following methods are useful to convert numbers from one base to any other base?
Remainder Division
A free online encyclopedia contains articles that can be written and edited by any user. Which of the following are advantages the online encyclopedia has over a traditional paper-based encyclopedia? Select two answers.
The ability to quickly update encyclopedia content as new information becomes available The ability to have a larger number of perspectives re ected in the encyclopedia content
An online retailer uses an algorithm to sort a list of n items by price. The table below shows the approximate number of steps the algorithm takes to sort lists of different sizes. Based on the values in the table, which of the following best characterizes the algorithm for very large values of n ?
The algorithm runs in reasonable time.
Recently Jessica gave a speech while running for ocer of her club. Her debate coach wants Jessica to rene her public speaking skills by analyzing a transcript he made of her speech to identify her use of specic ller words not necessary to convey her message. What results will the following program segment create for Jessica's consideration if the variable k represents a word to search?
The program will count the number of times the word "like" was said by Jessica.
Two different schools maintain data sets about their currently enrolled students. No individual student is enrolled at both schools. Each line of data contains information, separated by commas, about one student. East High School stores the data in the following format Select two answers
The schools can create a single list of student names, sorted by last name. The schools can determine the average number of days students are absent.
John is the manager of the school basketball team and wishes to create a program to create statistics for the team. Referring to ERS APCSP Lists Operations, select the pseudocode to create and ll a list of scoresfrom the rst 10 games.
scores <--[56, 49, 61, 70, 58, 62, 75, 50, 66, 59]
A program is created to perform arithmetic operations on positive and negative integers. The program contains the following incorrect procedure, which is intended to return the product of the integers x and y. PROCEDURE Multiply (x, y) { count ← 0 result ← 0 REPEAT UNTIL (count = y) { result ← result + x count ← count + 1 } RETURN (result) } A programmer suspects that an error in the program is caused by this procedure. Under which of the following conditions will the procedure NOT return the correct product? Select two answers.
when the values of x and y are both negative when the value of x is positive and the value of y is negative
A library of e-books contains metadata for each book. The metadata are intended to help a search feature find books that users are interested in. Which of the following is LEAST likely to be contained in the metadata of each e-book?
An archive containing previous versions of the e-book
Which of the following is NOT accurate information about cookies?
Cookies indicate that the system may have been compromised by a virus or threat.
A student wants to create an algorithm that can determine, given any program and program input, whether or not the program will go into an infinite loop for that input. The problem the student is attempting to solve is considered an undecidable problem. Which of the following is true?
It is not possible to create an algorithm that will solve the problem for all programs and inputs. CHECK THIS
The question below uses a robot in a grid of squares. The robot is represented as a triangle, which is initially in the top-left square of the grid and facing downward. The robot can move into a white or gray square, but cannot move into a black region. Which of the following code segments can be used to move the robot to the gray square?
MOVE_FORWARD ( ) ROTATE_LEFT ( ) REPEAT 2 TIMES { } ROTATE_RIGHT REPEAT 3 TIMES { MOVE_FORWARD ( ) MOVE_FORWARD ( ) ROTATE_LEFT ( ) }
Consider the program below which outputs the season. What is the output results with the initial values of x is 3 and y is 5?
Winter
A flowchart is a way to visually represent an algorithm. The flowchart below is used by an apartment rentalWeb site to set the variable include to true for apartments that meet certain criteria. Which of the following statements is equivalent to the algorithm in the owchart?
include ← (floor > 10) OR (bedrooms = 3)
A programmer is developing a word game. The programmer wants to create an algorithm that will take a list of words and return a list containing the first letter of all words that are palindromes (words that read the same backward or forward). The returned list should be in alphabetical order. For example, if the list contains the words ["banana", "kayak", "mom", "apple", "level"], the returned list would contain ["k", "l", "m"] (because "kayak", "level", and "mom" are palindromes). The programmer knows that the following steps are necessary for the algorithm but is not sure in which order they should be executed. Executing which of the following sequences of steps will enable the algorithm to work as intended? I. First shorten, then keep palindromes, then sort II. First keep palindromes, then shorten, then sort III. First sort, then keep palindromes, then shorten
II and III
Two grids are shown below. Each grid contains a robot represented as a triangle with the initial position facing downward. Each robot can move into a white or gray square, but cannot move into a black region. For each grid, the program below is intended to move the robot to the gray square. The program uses the procedure Finish_Race, which evaluates true if the robot is in the gray square and evaluates to false otherwise. REPEAT UNTIL (Finish_Race( )) { IF (CAN_MOVE (forward)) { MOVE_FORWARD ( ) } IF (CAN_MOVE (left)) { ROTATE_LEFT ( ) } ELSE { ROTATE_RIGHT ( ) } } For which of the grids does the program correctly move the robot to the gray square?
grid 1 only
Grades in a computer science course are based on total points earned on a midterm exam and a final exam. The teacher provides a way for students to improve their course grades if they receive high scores on the final exam: if a student's final exam score is greater than the student's midterm exam score, the final exam score replaces the midterm exam score in the calculation of total points. The table below shows two students' scores on the midterm and final exams and the calculated total points each student earns Khalil does better on the midterm exam than on the nal exam, so his original midterm and nal exam scores are added to compute his total points. Josena does better on the nal exam than on the midterm exam, so her nal exam score replaces her midterm exam score in the total points calculation. The teacher has data representing the scores of thousands of students. For each student, the data contain the student name, the midterm exam score, the final exam score, and the result of the total points calculation. Which of the following could be determined from the data? I. The average total points earned per student II. The average increase in total points per student as a result of the score replacement policy III. The proportion of students who improved their total points as a result of the score replacement policy
i, ii , and iii