Font size
WorksheetsAP Computer Science Practice Questions
Total questions: 100
Worksheet time: 1hrs 20mins
Which of the following is LEAST likely to indicate a phishing attack?
An e-mail from your bank asks you to call the number on your card to verify a transaction
An e-mail from a merchant asks that you click on a link to reset your password
An e-mail from a utility company asks you to enter your date of birth and social security number for verification purposes
An e-mail indicates that you have won a large sum of money and asks you to enter your bank account number so that the money can be transferred to you
Which of the following activities poses the greatest personal cybersecurity risk?
Making a purchase at an online store that uses public key encryption to transmit credit card information
Paying a bill using a secure electronic payment system
Reserving a hotel room by e-mailing a credit card number to a hotel
Withdrawing money from a bank account using an automated teller machine (ATM)
Which of the following best describes a Distributed Denial of Service (DDoS) attack?
An attempt by a country to deny its citizens access to the Internet
An attempt to deny users access to a Web site's resources by flooding the Web site with requests from multiple systems
An attempt by one user to deny service to another user by posting material on a social network
An attempt by a user of the Internet to get private information from a secure database
A program is expressed in a programming language. Which of the following is true of the program?
The program can also be expressed as binary code, but will be more easily understood by humans when expressed in a higher-level programming language.
The program can also be expressed as binary code, which will reduce the likelihood of errors.
The program cannot be expressed as binary code, because binary code can only be used to represent data.
Some parts of the program can be expressed as binary code, but operations must be expressed using a higher-level programming language.
Which of the following statements best describes the properties of public key encryption?
Public key encryption is an encryption method which relies on separate keys for encrypting and decrypting information.
Public key encryption is a highly secure encryption scheme that in which a single key is used by both the sender and receiver of the message.
Public key encryption makes use of certain types of problems which are easier for humans to solve than computers.
Public key encryption makes use of mathematical problems which no algorithm can be used to solve.
A flowchart is a way to visually represent an algorithm. The flowchart above uses the building blocks from the table above.
Which of the following statements best describes the behavior of the algorithm depicted in the flowchart?
Assume a always starts greater than b.
It displays the sum of a and b.
It displays the difference between a and b.
It displays the product of a and b
It runs in an infinite loop.
Consider the process of encoding and decoding a message using the following Caesar cipher encoding scheme in which the plaintext and ciphertext alphabets are offset by four positions, as shown above.
Which of the following encoded ciphertext strings decodes to an original plaintext message of “secret”?
ersecr
wigvix
kwujwl
oaynap
Which of the following best defines confidentiality in context with information and data?
The ability to limit access to information to a certain set of users
The certainty that information is accurate
The confirmation that a company will not sell your information to others
The reliability of access to information
Which of the following is true about low level computer languages?
I. Low level languages give the programmer more control over how system resources are used.
II. Code in a programming language is often translated into code in another (lower level) language to be executed on a computer.
III. Low level programming languages are designed to be easier for people to read and write.
II only
I and III only
I and II only
ii and III only
Consider the above code segment that is designed to print all numbers from a list of integer values, called grades, that are between 90 and 100, inclusive.
Which of the following modifications can be made to the code to allow it to also print numbers from a variety of different ranges of values (e.g., 70 to 80, 85 to 95, 1 to 50, etc.)?
userPassword = "swordfish"
"swordfish"
userPassword != "swordfish"
userPassword ← INPUT
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 above code is executed.
What is displayed if the elevator is currently on the 7th floor (level = 7) and the person on the elevator presses a button that says to go up 3 floors (floors = 3)?
Level 7 Level 8 Level 9
Level 8 Level 9 Cannot go up. Level 9
Level 8 Level 9 Level 10
Cannot go up.
Consider the above code segments designed to find the area of a triangle (A = 1/2 bh).
Which of the following statements about the above programs is true?
Both programs will work as intended, but Program B is more readable.
Program A will work as intended, but Program B will not work as intended.
Program B will work as intended, but Program A will not work as intended.
Neither program will work as intended.
Given the above code segment, what would be displayed if age were initialized with a value of 18?
group 1
group 2
group 1 group 2
Nothing will be displayed
Which of the following would be the most appropriate name for a variable?
variable1
t
amountOfTimeRemainingInTheGame
time_left
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?
You may never reuse someone else’s work.
You may reuse any elements that are posted publicly online as long as credit is given to their creator.
You may only reuse elements for which the original owner has granted a license to reuse, such as the Creative Commons Share Alike license.
You may always reuse anything that is posted publicly or privately online.
Consider the above code.
Assuming that before this code is run, x = 1. What would be displayed at the end?
210
16
8
1
What condition will make the above an infinite loop?
y = -108
y≠-3
y ≥ 8
y < -53
Consider the above code segment.
Which of the following best describes the result of running the code segment?
The number 0 is displayed.
The number 4 is displayed.
The number 10 is displayed.
Nothing is displayed; the program results in an infinite loop.
The volume of a rectangular prism is calculated by multiplying its length, width and height. What could be substituted into the section of the code marked < missing code > that would accurately calculate the volume based on the user input of l, w and h?
l x w x h
l * w * h
l(w)(h)
l / w / h
ASCII is a character-encoding scheme that uses a numeric value to represent each character. For example, the uppercase letter “G” is represented by the decimal (base 10) value 71. A partial list of characters and their corresponding ASCII values are shown in the table above.
ASCII characters can also be represented by binary numbers. According to ASCII character encoding, which of the following letters is represented by the binary (base 2) number 1010100?
N
P
T
W
Which of the following decimal (base-10) values is equivalent to the binary (base-2) value 101001?
22
37
41
82
What value does the above code segment display?
17
36
53
No value is ever displayed because the algorithm repeats the REPEAT UNTIL block indefinitely.
As of 2016, the selling of used digital media is illegal. Along with selling it, there are many other illegal uses of digital media. Which of the following would be a legal use of digital media?
You download an app on your smartphone that allows you to ‘strip’ the audio from any YouTube music video and permanently keep that audio in your music collection.
You make an MP3 copy of a song because the CD you bought expressly permits you to do so, and then you put your MP3 copy on the Internet, using a file-sharing network, so that millions of other people can download it.
You have a computer with a CD burner, which you use to burn copies of music you have downloaded onto writable CDs for all of your friends.
You download a song from iTunes and sync it to the cloud so that it is accessible on all of your devices.
The above procedure check is called in a program after each time a True or False question is answered. If the user types in True True False True as their answers for four questions on a quiz, what should their overall score be?
25%
50%
75%
100%
ASCII is a character-encoding scheme that uses 7 bits (8 bits if you are using the extended ASCII table) to represent each character. The decimal (base 10) values 65 through 90 represent the capital letters A through Z, as shown in the table above.
Which ASCII character is represented by the binary (base 2) number 1000001?
A
B
C
D
Which of the following is an advantage that text-based programming languages (e.g., Processing) have over block-based programming languages (e.g., Scratch)?
Text-based programming languages allow programmers to write programs in English and other natural languages.
Text-based programming languages do not require the programmer to worry about syntax, capitalization, or punctuation.
Programs written in text-based programming languages do not require debugging.
Text-based programming languages offer programmers more detailed control over lower-level functionality when writing a program.
Consider the above procedure. Which of the following best describes the behavior of the find procedure?
Displays the position of the first occurrence of target in list
Displays the positions of all occurrences of target in list
Displays the position of the last occurrence of target in list
Displays each item in list that is equal to target
The resulting image will be a grayscale version of the original image.
The overall brightness of all pixels in the resulting image will be darkened.
The resulting image will be completely white.
All of the colors of the resulting image will be inverted, like a negative, of the
original image.
In order to be inducted into a school’s National Honor Society (NHS), they must meet certain criteria for their GPA, serviceHours and grade. The expression below indicates whether a student has been accepted as a member of the NHS.
(GPA = 3.65) AND (serviceHours = 30) AND (NOT grade = 9)
Which of the following values would indicate a student that would be accepted into NHS?
GPA = 3.85, serviceHours = 45, grade = 9
GPA = 3.50, serviceHours = 100, grade = 10
GPA = 4.00, serviceHours = 15, grade = 11
GPA = 3.65, serviceHours = 30, grade = 12
Which of the following is true about program documentation?
Program documentation is only needed for programs in development; it is not needed after a program is completed.
Program documentation is useful when programmers collaborate but not when a programmer works individually on a project.
Program documentation is useful during initial program development and also when modifications are made to existing programs.
Program documentation should not be changed after it is first written.
A student is recording a song on her computer. When the recording is finished, she saves a copy on her computer. The student notices that the saved copy is of lower sound quality than the original recording. Which of the following could be a possible explanation for the difference in sound quality?
The song was saved using fewer bits per second than the original song.
The song was saved using more bits per second than the original song.
The song was saved using a lossless compression technique.
Some information is lost every time a file is saved from one location on a computer to another location.
Which of the following are benefits of using well-named variables in a computer program?
Select two answers.
The program will run faster.
The program will be easier for people to read.
The program will have a greater data storage capacity.
The program will be easier to modify in the future.
Working together to facilitate the application of multiple perspectives and diverse talents and skills is the definition of
visualtion
collaboration
ReCAPTCHA
crowdsourcing
extraction
Large amounts of structured and unstructured data that can potentially be mined, examined, and used by organizations is the definition of
usable data
data set
usable data
big data
data collection
The representation of information using a chart, diagram, image, etc. is the definition of
indexing
analytics
extraction
concatenation
visualization(s)
Chaining together or placing two or more separate things side by side so that they are treated as one is the definition of
concatenation
ReCAPTCHA
indexing
extraction
cache
A memory location to store active data temporarily to shorten data access times and reduce latency is the definition of
analytics
utility
indexing
cache
big data
A collection of numbers or values that relate to a particular subject usually portrayed in a relational database table. Example: column header and row contents for test scores for each student. This is the definition of
data set
useful data
usable data
structured data
data persistence
What is an Event?
An action that causes something to happen
An action that doesn’t do anything in the App
An action that will allow you to look up and event
Something that is happening in the calendar
What is the User Interface
Elements of which the user controls
Elements of which the coder controls
An interface with code
An interface with options
Which of the following is LEAST likely to indicate a phishing attack?
An e-mail from your bank asks you to call the number on your card to verify a transaction
An e-mail from a merchant asks that you click on a link to reset your password
An e-mail from a utility company asks you to enter your date of birth and social security number for verification purposes
An e-mail indicates that you have won a large sum of money and asks you to enter your bank account number so that the money can be transferred to you
Which of the following activities poses the greatest personal cybersecurity risk?
Making a purchase at an online store that uses public key encryption to transmit credit card information
Paying a bill using a secure electronic payment system
Reserving a hotel room by e-mailing a credit card number to a hotel
Withdrawing money from a bank account using an automated teller machine (ATM)
Which of the following best describes a Distributed Denial of Service (DDoS) attack?
An attempt by a country to deny its citizens access to the Internet
An attempt to deny users access to a Web site's resources by flooding the Web site with requests from multiple systems
An attempt by one user to deny service to another user by posting material on a social network
An attempt by a user of the Internet to get private information from a secure database
A program is expressed in a programming language. Which of the following is true of the program?
The program can also be expressed as binary code, but will be more easily understood by humans when expressed in a higher-level programming language.
The program can also be expressed as binary code, which will reduce the likelihood of errors.
The program cannot be expressed as binary code, because binary code can only be used to represent data.
Some parts of the program can be expressed as binary code, but operations must be expressed using a higher-level programming language.
Which of the following statements best describes the properties of public key encryption?
Public key encryption is an encryption method which relies on separate keys for encrypting and decrypting information.
Public key encryption is a highly secure encryption scheme that in which a single key is used by both the sender and receiver of the message.
Public key encryption makes use of certain types of problems which are easier for humans to solve than computers.
Public key encryption makes use of mathematical problems which no algorithm can be used to solve.
A flowchart is a way to visually represent an algorithm. The flowchart above uses the building blocks from the table above.
Which of the following statements best describes the behavior of the algorithm depicted in the flowchart?
Assume a always starts greater than b.
It displays the sum of a and b.
It displays the difference between a and b.
It displays the product of a and b
It runs in an infinite loop.
Consider the process of encoding and decoding a message using the following Caesar cipher encoding scheme in which the plaintext and ciphertext alphabets are offset by four positions, as shown above.
Which of the following encoded ciphertext strings decodes to an original plaintext message of “secret”?
ersecr
wigvix
kwujwl
oaynap
Which of the following best defines confidentiality in context with information and data?
The ability to limit access to information to a certain set of users
The certainty that information is accurate
The confirmation that a company will not sell your information to others
The reliability of access to information
Which of the following is true about low level computer languages?
I. Low level languages give the programmer more control over how system resources are used.
II. Code in a programming language is often translated into code in another (lower level) language to be executed on a computer.
III. Low level programming languages are designed to be easier for people to read and write.
II only
I and III only
I and II only
ii and III only
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 above code is executed.
What is displayed if the elevator is currently on the 7th floor (level = 7) and the person on the elevator presses a button that says to go up 3 floors (floors = 3)?
Level 7 Level 8 Level 9
Level 8 Level 9 Cannot go up. Level 9
Level 8 Level 9 Level 10
Cannot go up.
Consider the above code segments designed to find the area of a triangle (A = 1/2 bh).
Which of the following statements about the above programs is true?
Both programs will work as intended, but Program B is more readable.
Program A will work as intended, but Program B will not work as intended.
Program B will work as intended, but Program A will not work as intended.
Neither program will work as intended.
Given the above code segment, what would be displayed if age were initialized with a value of 18?
group 1
group 2
group 1 group 2
Nothing will be displayed
Which of the following would be the most appropriate name for a variable?
variable1
t
amountOfTimeRemainingInTheGame
time_left
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?
You may never reuse someone else’s work.
You may reuse any elements that are posted publicly online as long as credit is given to their creator.
You may only reuse elements for which the original owner has granted a license to reuse, such as the Creative Commons Share Alike license.
You may always reuse anything that is posted publicly or privately online.
Consider the above code.
Assuming that before this code is run, x = 1. What would be displayed at the end?
210
16
8
1
What condition will make the above an infinite loop?
y = -108
y≠-3
y ≥ 8
y < -53
Consider the above code segment.
Which of the following best describes the result of running the code segment?
The number 0 is displayed.
The number 4 is displayed.
The number 10 is displayed.
Nothing is displayed; the program results in an infinite loop.
The volume of a rectangular prism is calculated by multiplying its length, width and height. What could be substituted into the section of the code marked < missing code > that would accurately calculate the volume based on the user input of l, w and h?
l x w x h
l * w * h
l(w)(h)
l / w / h
ASCII is a character-encoding scheme that uses a numeric value to represent each character. For example, the uppercase letter “G” is represented by the decimal (base 10) value 71. A partial list of characters and their corresponding ASCII values are shown in the table above.
ASCII characters can also be represented by binary numbers. According to ASCII character encoding, which of the following letters is represented by the binary (base 2) number 1010100?
N
P
T
W
Which of the following decimal (base-10) values is equivalent to the binary (base-2) value 101001?
22
37
41
82
What value does the above code segment display?
17
36
53
No value is ever displayed because the algorithm repeats the REPEAT UNTIL block indefinitely.
As of 2016, the selling of used digital media is illegal. Along with selling it, there are many other illegal uses of digital media. Which of the following would be a legal use of digital media?
You download an app on your smartphone that allows you to ‘strip’ the audio from any YouTube music video and permanently keep that audio in your music collection.
You make an MP3 copy of a song because the CD you bought expressly permits you to do so, and then you put your MP3 copy on the Internet, using a file-sharing network, so that millions of other people can download it.
You have a computer with a CD burner, which you use to burn copies of music you have downloaded onto writable CDs for all of your friends.
You download a song from iTunes and sync it to the cloud so that it is accessible on all of your devices.
The above procedure check is called in a program after each time a True or False question is answered. If the user types in True True False True as their answers for four questions on a quiz, what should their overall score be?
25%
50%
75%
100%
ASCII is a character-encoding scheme that uses 7 bits (8 bits if you are using the extended ASCII table) to represent each character. The decimal (base 10) values 65 through 90 represent the capital letters A through Z, as shown in the table above.
Which ASCII character is represented by the binary (base 2) number 1000001?
A
B
C
D
Which of the following is an advantage that text-based programming languages (e.g., Processing) have over block-based programming languages (e.g., Scratch)?
Text-based programming languages allow programmers to write programs in English and other natural languages.
Text-based programming languages do not require the programmer to worry about syntax, capitalization, or punctuation.
Programs written in text-based programming languages do not require debugging.
Text-based programming languages offer programmers more detailed control over lower-level functionality when writing a program.
Consider the above procedure. Which of the following best describes the behavior of the find procedure?
Displays the position of the first occurrence of target in list
Displays the positions of all occurrences of target in list
Displays the position of the last occurrence of target in list
Displays each item in list that is equal to target
In order to be inducted into a school’s National Honor Society (NHS), they must meet certain criteria for their GPA, serviceHours and grade. The expression below indicates whether a student has been accepted as a member of the NHS.
(GPA = 3.65) AND (serviceHours = 30) AND (NOT grade = 9)
Which of the following values would indicate a student that would be accepted into NHS?
GPA = 3.85, serviceHours = 45, grade = 9
GPA = 3.50, serviceHours = 100, grade = 10
GPA = 4.00, serviceHours = 15, grade = 11
GPA = 3.65, serviceHours = 30, grade = 12
Which of the following is true about program documentation?
Program documentation is only needed for programs in development; it is not needed after a program is completed.
Program documentation is useful when programmers collaborate but not when a programmer works individually on a project.
Program documentation is useful during initial program development and also when modifications are made to existing programs.
Program documentation should not be changed after it is first written.
A student is recording a song on her computer. When the recording is finished, she saves a copy on her computer. The student notices that the saved copy is of lower sound quality than the original recording. Which of the following could be a possible explanation for the difference in sound quality?
The song was saved using fewer bits per second than the original song.
The song was saved using more bits per second than the original song.
The song was saved using a lossless compression technique.
Some information is lost every time a file is saved from one location on a computer to another location.
Which of the following are benefits of using well-named variables in a computer program?
Select two answers.
The program will run faster.
The program will be easier for people to read.
The program will have a greater data storage capacity.
The program will be easier to modify in the future.
What is an Event?
An action that causes something to happen
An action that doesn’t do anything in the App
An action that will allow you to look up and event
Something that is happening in the calendar
What is the User Interface
Elements of which the user controls
Elements of which the coder controls
An interface with code
An interface with options
If you think your computer has a virus, a good first step in solving the problem would be to:
Run a virus scan
Reformat the hard drive
Destroy the computer
Do nothing
Antivirus software is designed to protect computers from an assortment of viruses and unauthorized intrusions
True
False
A user wants to save a data file on an online storage site. The user wants to reduce the size of the file, if possible, and wants to be able to completely restore the file to its original version. Which of the following actions best supports the user’s needs?
Compressing the file using a lossless compression algorithm before uploading it
Compressing the file using a lossy compression algorithm before uploading it
Compressing the file using both lossy and lossless compression algorithms before uploading it
Uploading the original file without using any compression algorithm
Let n be an integer value. Which of the following expressions evaluates to true if and only if n is a two-digit integer (i.e., in the range from 10 to 99, inclusive)?
n = (n MOD 100)
(n ≥ 10) AND (n < 100)
(n < 10) AND (n ≥ 100)
(n > 10) AND (n < 99)
A team of programmers is designing software. One portion of the project presents a problem for which there is not an obvious solution. After some research, the team determines that the problem is undecidable. Which of the following best explains the consequence of the problem being undecidable?
The problem can be solved algorithmically, but it will require an unreasonably long amount of time.
The problem can be solved algorithmically, but it will require an unreasonably large amount of data storage.
There is no possible algorithm that can be used to solve all instances of the problem.
There are several different possible algorithms that can solve the problem, but there is controversy about which is the most efficient.
What are the contents of yourList after the code segment is executed?
[10, 30, 50, 70]
[20, 40, 60, 80]
[10, 30, 50, 70, 20, 40, 60, 80]
[20, 40, 60, 80, 10, 30, 50, 70]
Which of the following best explains how data is typically assembled in packets for transmission over the Internet?
Each packet contains data to be transmitted, along with metadata containing information used for routing the data.
Each packet contains an encrypted version of the data to be transmitted, along with metadata containing the key needed to decrypt the data.
Each packet contains only the metadata used to establish a direct connection so that the data can be transmitted.
Each packet contains multiple data files bundled together, along with metadata describing how to categorize each data file.
Which of the following are true statements about the data that can be represented using binary sequences?
I - Binary sequences can be used to represent strings of characters.
II - Binary sequences can be used to represent colors.
III - Binary sequences can be used to represent audio recordings.
I only
I and II only
II and III only
I, II, and III
Consider the following algorithms. Each algorithm operates on a list containing n elements, where n is a very large integer.
I. An algorithm that accesses each element in the list twice
II. An algorithm that accesses each element in the list n times
III. An algorithm that accesses only the first 10 elements in the list, regardless of the size of the list
Which of the algorithms run in reasonable time?
I only
III only
I and II only
I, II, and III
Which of the following best describes the impact of Creative Commons?
Creative Commons gives creators of digital content the ability to indicate how their works can be legally used and distributed, enabling broad access to digital information.
Creative Commons gives Internet users the right to legally use and distribute any previously copyrighted work, enabling broad access to digital information.
Create Commons provides lossless transmission of messages, enabling reliable distribution of digital information.
Creative Commons provides private transmission of messages, enabling secure distribution of digital information.
Which of the following best explains how IP addresses are assigned?
As a new device is connected to the Internet, it is assigned an IP address to enable communication on the network.
IP addresses are assigned only to servers that host Web sites; user devices do not require an IP address.
New devices are connected to the Internet without an IP address, but are eventually assigned an IP address once they can be verified by a certificate authority.
New devices are connected to the Internet without an IP address; IP addresses are assigned only for encrypted communications.
A system is being developed to help pet owners locate lost pets. Which of the following best describes a system that uses crowdsourcing?
A mobile application and collar that uses GPS technology to determine the pet’s location and transmits the location when the owner refreshes the application
A mobile application and collar that uses wireless technology to determine whether the pet is within 100 feet of the owner’s phone and transmits a message to the owner when the pet is nearby
A mobile application that allows users to report the location of a pet that appears to be lost and upload a photo that is made available to other users of the application
A mobile application that transmits a message to all users any time a lost pet is returned to its owner
Which of the following scenarios best exemplifies a phishing attack?
A user connects to a public wireless network. An unauthorized individual intercepts data transmitted on the network, looking for private information that can be used to gain access to the user’s accounts.
A user’s e-mail account is overwhelmed with messages containing large attachments, which causes the account to exceed the maximum amount of data allowed and temporarily prevents the user from sending and receiving new messages.
A user receives an e-mail from a sender offering technical help with the user’s computer. The e-mail prompts the user to start a help session by clicking a provided link and entering the username and password associated with the user’s computer.
A user chooses a weak password for an online account. An unauthorized individual successfully guesses the user’s password from a list of common passwords.
Which of the following actions are likely to be helpful in reducing the digital divide?
Designing new technologies intended only for advanced users
Designing new technologies to be accessible to individuals with different physical abilities
Implementing government regulations restricting citizens’ access to Web content
Having world governments support the construction of network infrastructure
The transmission control protocol (TCP) and Internet protocol (IP) are used in Internet communication. Which of the following best describes the purpose of these protocols?
To ensure that communications between devices on the Internet are above a minimum transmission speed
To ensure that private data is inaccessible to unauthorized devices on the Internet
To establish a common standard for sending messages between devices on the Internet
To validate the ownership of encryption keys used in Internet communication
Which of the following is NOT an advantage of using open-source software?
Open-source software is generally free or lower in cost than commercially available software.
The availability of source code makes it possible to customize open-source software to a user’s individual needs.
The original developer of open-source software provides free or low-cost support for users installing and running the software.
Unlike commercial software, which can become obsolete when the company that created it goes out of business, open-source software can be updated without the involvement of the original programmers.
The following procedure is intended to return the value of x times y, where x and y are integers. Multiplication is implemented using repeated additions. For which of the following procedure calls does the procedure NOT return the intended value? Select two answers.
Multiply(2, 5)
Multiply(2, -5)
Multiply(-2, 5)
Multiply(-2, -5)
The procedure NumOccurrences is intended to count and return the number of times targetWord appears in the list wordList. The procedure does not work as intended. For which of the following code segments will the call to NumOccurrences NOT return the intended value? Select two answers.
treeList ⟵ ["birch", "maple", "birch"] numOccurences(treeList, "birch")
treeList ⟵ ["birch", "maple", "oak"] numOccurences(treeList, "maple")
treeList ⟵ ["birch", "maple", "oak"] numOccurences(treeList, "oak")
treeList ⟵ ["birch", "maple", "oak"] numOccurences(treeList, "spruce")
Which of the following is true about low level computer languages?
I. Low level languages give the programmer more control over how system resources are used.
II. Code in a programming language is often translated into code in another (lower level) language to be executed on a computer.
III. Low level programming languages are designed to be easier for people to read and write.
II only
I and III only
I and II only
ii and III only
Consider the process of encoding and decoding a message using the following Caesar cipher encoding scheme in which the plaintext and ciphertext alphabets are offset by four positions, as shown above.
Which of the following encoded ciphertext strings decodes to an original plaintext message of “secret”?
ersecr
wigvix
kwujwl
oaynap
A flowchart is a way to visually represent an algorithm. The flowchart above uses the building blocks from the table above.
Which of the following statements best describes the behavior of the algorithm depicted in the flowchart?
Assume a always starts greater than b.
It displays the sum of a and b.
It displays the difference between a and b.
It displays the product of a and b
It runs in an infinite loop.
Which of the following activities poses the greatest personal cybersecurity risk?
Making a purchase at an online store that uses public key encryption to transmit credit card information
Paying a bill using a secure electronic payment system
Reserving a hotel room by e-mailing a credit card number to a hotel
Withdrawing money from a bank account using an automated teller machine (ATM)
