AP Computer Science Principles Semester 1 Exam Review
Nandita is working on a digital photography project and noticed that the color of the soccer field in her photo is the wrong shade of green. To create the correct shade of green, her teacher has recommended the following primary color proportions... Twice as much Blue as Red Twice as much Green as Blue #5B9B80 #3CF078 #1A4A2A #1A6834
#3CF078 #1A6834
The field of Computer Science was developed in the
1940's
A video streaming Web site uses 32-bit integers to count the number of times each video has been played. In anticipation of some videos being played more times than can be represented with 32 bits, the Web site is planning to change to 64-bit integers for the counter. Which of the following best describes the result of using 64-bit integers instead of 32-bit integers?
2^32 times as many values can be represented.
How many bits are used in the address of an IPv4 packet?
32
Consider the following compound Boolean expression: ( num ≠ 3 ) AND ( num ≠ 4 ) AND ( num ≠ 5 ) For which of these values of num is the expression false?
4
A flowchart is a way to visually represent an algorithm. The flowchart below uses the following building blocks. what is displayed as the result?
5
In order to manage complexity, programmers often create a function or procedure which combines several programming statements. This is an example of what programming concept?
Abstraction
According to Blown to Bits, koans ..are truths about bits. ...provoke meditation and enlightenment. ...are oversimplifications. All of the above
All of the above
A computer program uses 3 bits to represent integers. When the program adds the decimal (base 10) numbers 5 and 3, the result is 0. Which of the following is the best explanation for the result?
An overflow error occurred.
Consider the following code segment below. IF (onTime){ DISPLAY "Hello." } ELSE{ IF (absent){ DISPLAY "Is anyone there?" } ELSE{ DISPLAY "Better late than never." } } If the variables onTime and absent both have the value false, what is displayed as a result of running the code segment?
Better late than never.
Which set of numbers contains equivalent values?
Binary 1110, Hexadecimal E, Decimal 14
Consider the code segment below. Line 1: IF (a = 0) Line 2: { Line 3: b a + 10 Line 4: } Line 5: ELSE Line 6: { Line 7: b a + 20 Line 8: } Which of the following changes will NOT affect the results when the code segment is executed?
Changing line 3 to b 10
Which of the following is the best example of sequencing?
Code will start at line 1, then execute line 2, then line 3, and so on, until it reaches the last line of the program.
Consider the following numbers. Binary 1100 Decimal 11 Hexadecimal D Which of the following lists the numbers in order from least to greatest?
Decimal 11, Binary 1100, Hexadecimal D
A programmer completes the user manual for a video game she has developed and realized she had reversed the roles of goats and sheep throughout the text. Consider the programmer's goal of changing all occurrences of "goats" to "sheep" and all occurrences of "sheep" to "goats." The programmer will use the fact that the word "foxes" does not appear anywhere in the original text. Which of the following algorithms can be used to accomplish the programmer's goal?
First, change all occurrences of "goats" to "foxes."Then, change all occurrences of "sheep" to "goats."Last, change all occurrences of "foxes" to "sheep."
Which of the following has the greatest potential for compromising a user's personal privacy?
Group of cookies stores by users web browser
The various protocols used on the internet operate in layers in which the protocol at each layer rely on the protocols at the lower layers to do their jobs, and higher layers (higher level of abstraction) are built on top of the lower layers (lower level of abstraction).
HTTP is a higher level of abstraction than TCP/IP DNS is a higher level of abstraction than TCP/IP
Some programming languages use constants, which are variables that are initialized at the beginning of a program and never change. Which of the following are good uses for a constant? To represent the mathematical value (pi) as 3.14 To represent the current score in a game To represent a known value such as the number of days in a week
I and III only
Consider the following procedure: PROCEDURE min (num1, num2, num3) { <missing code> } The procedure min is intended to return the smallest of three numbers. Which of the following is a replacement for <missing code> so it works as intended?
IF (num1 < num2) { RETURN num1 } ELSE { IF (num2 < num3) { RETURN num2 } ELSE { RETURN num3 } }
Select the two options that are factually correct about IPv4 and IPv6 addresses.
IP stands for Internet Protocol IPv4 uses 32-bit addresses and IPv6 uses 128-bit addresses
Internet Protocol version 4 (IPv4) uses a 32 bit binary number to represent an IP address. Internet Protocol version 6 (IPv6 ) uses a 128 bit binary number to represent the same. Which one of the following BEST describes the reason for this changeover in IP address representation?
IPv6 allows for 2^96 times more IP addresses. This will ensure that we will have enough IP addresses to handle the exponential demand for future IP addresses.
ASCII is a character-encoding scheme that uses 7 bits to represent each character. The decimal (base 10) values 65 through 90 represent the capital letters A through Z, as shown in the table below. What ASCII character is represented by the binary (base 2) number 1001010 ?
J
Which is the following is required when correcting compilation errors.
Knowledge of the programming language
Which of the following is NOT a true statement about an IP address?
Not every digital device connected to the Internet needs an IP address to pinpoint its location and to differentiate it from other devices.
The code fragment below is intended to display "odd" if the positive number num is odd. IF (<MISSING CONDITION>){ DISPLAY "odd" }
Num Mod 2 = 1
Which of the following is a true statement about program documentation?
Program documentation is useful during initial program development and also when modifications are made to existing programs.
Often programs are expressed in a programming language. Which of the following is also true of programs? Programs can be expressed as machine code, but programs are more easily understood by humans when expressed in a higher-level programming language. Programs can be expressed as bits, which reduces the likelihood of errors. Programs cannot be expressed as machine code, because machine code is not understood by computers. Some parts of a program can be expressed as bits, but most computers only understand hexadecimal.
Programs can be expressed as machine code, but programs are more easily understood by humans when expressed in a higher-level programming language.
Two students are playing Battleship on the Internet and are having trouble coordinating their moves. What should the students use to improve their communication?
Protocol
Which of the following are advantages of using procedures? Select two answers.
Reduced debugging time Reduced coding time
Historically, it has been observed that computer processing speeds tend to double every two years. Which of the following best describes how technology companies can use this observation for planning purposes?
Technology companies can set research and development goals based on anticipated processing speeds.
Which of the following can be represented by a single binary digit? The position of the minute hand of a clock The answers to a True/False question The value of a Boolean variable The volume of a car radio
The answers to a True/False question The value of a Boolean variable
A school library allows students to borrow laptops. A computer program is used to count the number of times a particular laptop has been borrowed from the library (borrows) and the number of times the same laptop has been returned to the library (returns). Which of the following indicate that a particular laptop is not currently borrowed?
The difference between borrows and returns is zero. The sum of borrows and returns is a positive even number.
Which of the following is true about number system conversions?
The number base equals the amount of its number symbols.
The diagram below shows a circuit composed of two logic gates labeled OR and AND. Each gate takes two inputs and produces a single output. If the inputs A and C are both true, which of the following best describes the output of the AND gate?
The output will be true no matter what the value of input B is.
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
Which of the following is a true statement about data compression?
There are trade-offs involved in choosing a compression technique for storing and transmitting data.
What is the primary function of the Internet?
To connect devices and networks all over the world.
What is the primary reason program components are documented?
To maintain and develop programs with the assistance of other developers
Under which of the following conditions is it most beneficial to use a heuristic approach to solve a problem?
When the problem cannot be solved in a reasonable time and an approximate solution is acceptable
Complete the following sentence: A(n) ______________ is a set of steps we follow to complete a task while a(n) ____________ is a procedure intended to provide a reasonable, though not necessarily best, solution.
algorithm, heuristic
Data Leaks
are a primary target of identity thieves.
The innovation of the Internet
began as a government and university project called ARPANET
Biometric data...
could be collected by an airport security scan.
Trudy is writing a program to input student grades from a particular test. It will also use the variable count to keep track of the number of times a user enters the particular score of 85. Of the steps below, which should appear earliest in her pseudocode?
count <- 0
Which of the following are benefits of using well-named variables in a computer program?
easier for future modification easier for people to read
computers are
fast
A(n) ____ uses symbols and shapes connected by lines to illustrate the steps of a program
flowchart
The algorithm below is used to simulate the results of flipping a coin 4 times. Consider the goal of determining whether the simulation resulted in a equal number of heads and tails. Step 1: Initialize the variables heads_counter and flip_counter to 0. Step 2: A variable coin_flip is randomly assigned a value of either 0 or 1. If coin_flip has the value of 0, the coin flip result is heads, so heads_counter is incremented by 1. Step 3: Increment the value of flip_counter by 1. Step 4: Repeat steps 2 and 3 until flip_counter equals 4.
heads_counter = 2
machine language
is a sequence of bits
computer's main unit
is also called the central processing unit.
Libel Tourism
is used to inhibit free speech
RAM, or random access memory,
is volatile
Values that are keyed directly into source code are called ____.
literals
Central High School keeps a database of information about each student, including the numeric variables numberOfAbsences and gradePointAverage. The expression below is used to determine whether a student is eligible to receive an academic award. (numberOfAbsences 5) AND (gradePointAverage > 3.5) Which of the following pairs of values indicates that a student is eligible to receive an academic award?
numberOfAbsences = 5, gradePointAverage = 3.8
Given the variable name assigned a string literal "ABRAHAM", which of the following JavaScript statements would display the name correctly capitalizing the first letter only?
print(name[0] + name.slice(1).toLowerCase()); print(name[0] + name.substr(1, name.length-1).toLowerCase());
In the process of digging, a landscaping company cuts a fiber line. Transmission of Internet traffic is still possible through additional pathways that provide alternate routes between the source and destination. The additional pathways describe a concept known as:
redundancy
____ operators are used to compare two values.
relational
Moore's Law
states that computing capacity doubles every couple of years.
The code segment below is intended to swap the values of the variables first and second using a temporary variable, temp. Which of the following can be used to replace < MISSING CODE > so the code segment works as intended?
temp <-- first
What is the difference between the encryption key and the decryption key in a symmetric key encryption system?
the keys are identical