APCSP Practice Test
What is the minimum number of bits you would need to encode the 26 letters of the alphabet plus a space - a total of 27 characters? A. 2 bits B. 3 bits C. 5 bits D. 6 bits
C. 5 bits
Approximately how much bigger (how many more bytes) is a megabyte than a kilobyte? A. 1,000 times B. 100,000 times C. 1,000,000 times D. 1,000,000,000 times
A. 1,000 times
Pick the two expressions involving the Modulo operation that compute to the exact same value (choose 2) A. 9 MOD 8 B. 1 MOD 16 C. 52 MOD 32 D. 9 MOD 64
A. 9 MOD 8 B. 1 MOD 16 NOTE: Modulo: A modulo is an operation that helps find the remainder of a number. Specifically, given two numbers, x and y, the result of the modulo operation is the remainder after doing x divided by y. General example: x%y is read as "x MOD y" the remainder after x/y y goes into x a certain number of times, and the remaining number is left For the question choices: 9 MOD 8 : 8 goes into 9 one time, with a remainder of 1 1 MOD 16: 16 goes into 16 zero times, with a remainder of 1 52 MOD 32: 32 goes into 52 once, with a remainder of 20 9 MOD 64: 64 goes into 9 zero times, with a remainder of 9 Since 9 MOD 8 and 1 MOD 16 both have a remainder of 1, they compute to the same value
8 bits is enough to represent 256 different numbers. How many total bits do you need to represent 512 (twice as many) numbers? A. 9 bits B. 10 bits C. 16 bits D. 17 bits
A. 9 bits
A middle school is expanding to open a high school next year, doubling the total number of students. The school keeps a database in which each student's unique ID number is stored as an 8 bit number called studentID. Before the arrival of the new students almost every 8 bit number has already been assigned to a student. Which is the most accurate description of how the school could modify the way studentID is represented in the database to ensure each incoming student receives a unique ID? A. Add a bit to studentID to double the number of IDs that the database can represent. B. Double the number of bits in studentID to double the number of IDs that the databases can represent. C. Keep using an 8-bit number for studentID but reserve the first bit to indicate middle school or high school. D. Remove a bit from studentID to make room for incoming students.
A. Add a bit to studentID to double the number of IDs that the database can represent. NOTE: Doubling the number of bits would obviously make room for more student IDs, but it's inaccurate to say that that doubles the number of possible IDs. If the number of bits went from 8 to 16, it's 256 TIMES AS MANY possible ids. 8 bits = 256 values and 16 bits = 65,536 IDs.
Programming languages have some similarities and differences to the "natural" language you use in everyday speech. Select the two true statements about programming languages: A. Ambiguities in natural language necessitate the creation of programming languages for controlling a computer B. Compared to the number of words in a natural language, the number of defined words in a programming language is very small. C. The number of defined words in a programming language is about the same as the number of words in a natural language. D. There are typically many possible ways to interpret an instruction written in a programming language.
A. Ambiguities in natural language necessitate the creation of programming languages for controlling a computer B. Compared to the number of words in a natural language, the number of defined words in a programming language is very small. NOTE: "Natural" languages can be interpreted in many ways; however, computers need a specific set of instructions in order to work. To successfully communicate with a computer, programming languages are created with limited defined words and little ambiguity so computers can read and process code a certain way. Unlike natural languages, there is only one way to interpret written code for a computer for a given programming language.
Which of the following is FALSE about element IDs? A. An element with a unique ID must always have an event handler associated with it. B. Any element that needs to be triggered by onEvent must have a unique ID. C. Two or more onEvent calls may reference the same ID. D. While not a requirement, IDs should be meaningful and descriptive. E. IDs allow a programmer to reference interface elements within their code.
A. An element with a unique ID must always have an event handler associated with it. NOTE: Unit 5 Lesson 1 An element must be given a unique ID so a program can reference it; however, it does not need an event handler (lines of code that is executed due to an event such as mouse clicks, keyboard presses, and so forth). For example, a screen has a button and an image on it. Both the button and the image have unique element IDs (such as "button1" and "image1"). The button has an event handler because the user would need to click it for code to run; however, the image does not have an event handler because it displays an image without needing an action from the user and thus, does not necessarily have an event handler associated with it.
Which of the following is FALSE about event-driven programs? A. Event-driven programs do not implement algorithms. B. Some portions of an event-driven program may never execute while the program is running. C. An event-driven program is written to respond to specified events by executing a block of code or function associated with the event. D. The order in which an event-driven program will run cannot always be known ahead of time. E. Event-driven programs can be run multiple times with different outcomes, based on user interactions.
A. Event-driven programs do not implement algorithms. NOTE: Unit 5 Lesson 1 An "Event-driven program" is a program that runs in relation to an event, such as user actions (mouse clicks, button presses, etc.) Depending on what the event is, multiple functions can be run in a certain order (as an algorithm) to execute a task. Or, a program can run with a specific flow depending on the event. This flow can be determined with a written algorithm. For example, a program is written to fix the size of an image by making it bigger with a click of a button. When the button is clicked, there can be code inside the event block that implements an algorithm that adds 10 pixels onto the current image.
An artist makes an RGB raster image in which each pixel color is encoded with 12-bits --- 4 bits each for red, green and blue. Which of the following correctly shows the hexadecimal value for Red as a 12-bit representation. A. F00 B. 00F C. FF00 D. FF0000
A. F00 NOTE: The correct answer is F00. A single hex digit is used to represent a 4-bit sequence - since there are 16 possible 4-bit sequences and 16 different hex digits 0-F. So 3 hex digits represents 12 bits, and the first digit represents the intensity of Red in an RGB image.
How does a computer resolve a domain name into an IP address? A. It asks a DNS server for the corresponding IP address. B. It scans addresses until it finds the one it's looking for. C. It uses a Border Gateway Protocol to get the address from a nearby computer. D. It creates an IP address for the domain, and shares it with the closest DNS.
A. It asks a DNS server for the corresponding IP address.
For this scenario related to turtle drawing, indicate whether it is better to write a loop or a function (or a set of functions) to handle the task: Drawing 100 tiny dots in a line A. Loop B. Function(s)
A. Loop NOTE: The main action is in this problem is drawing a dot and moving one way to draw multiple dots in a line. A loop can be used to repeat "drawDot()" 100 times in a row.
For this scenario related to turtle drawing, indicate whether it is better to write a loop or a function (or a set of functions) to handle the task: Drawing a hexagon (six-sided shape) A. Loop B. Function(s)
A. Loop NOTE: To draw a hexagon, a six straight lines are drawn with 120 degrees between each line. In other words, a loop can be used to draw one line and turn 120 degrees, repeated six times.
The colors of pixels in a digital image are often represented by red, green, and blue values between 0 and 255 (an RGB triplet). A photographer is manipulating a digital image to lighten it because of the RGB values in the image are less than 100, making it very dark. He does this by adding 20 to the R, G, and B values of each pixel, then overwriting the original image. What type of transformation is the photographer using on the digital image? A. Lossless transformation B. Lossy transformation C. Multiband transformation D. Chrome Sampling transformation
A. Lossless transformation NOTE: The answer is "lossless" transformation because there is a computational process you can perform on the transformed data to recover the original (namely, subtract 20). The question is carefully formulated to ensure that this is true. This question is tricky for a few reasons: it is carefully formulated with starting assumptions and values that ensure the transformation is lossless. If you applied this transformation willy-nilly it might be lossless (see below). it applies the terms lossy and lossless outside the context they are usually presented (compression) because of the fact that the data is being transformed and overwritten, you might be tricked into thinking that the data is "lost". But the transformation itself is lossless because you can apply a computational process to the transformed data to recover every bit of the original information. It would be "lossy" if the transformation did something that would not let you recover every bit. For example: If the question stated that you add 200 to each RGB channel, it might be lossy, because if, say, one of the RGB values was (75, 57, 99), adding 200 to each would max out the values at 255 - since an RGB value cannot be greater than 255 - the resulting transformation would be the RGB value (255, 255, 255). Reversing the process, subtracting 200 from each of the transformed values does not restore the original. Since there is no process or computation you can perform on the transformed data to recover the original, it is "lossy".
A raw digital sound file samples a sound wave at some interval and measures the height of the wave at each point. Thus, raw sound is recorded as a list of numbers. In very broad terms the MP3 audio compression algorithm identifies frequencies and volume levels - low and high - that are outside the range of human hearing and removes the data representing these frequencies from the original. This technique results in a smaller audio file that sounds exactly the same to the human ear. This technique is an example of what type of compression? A. Lossy compression B. Lossless compression C. Fast Fourier Transform compression D. Tailored compression
A. Lossy compression
Which of the following statements best describes the properties of public key encryption? A. Public key encryption is an encryption method which relies on separate keys for encrypting and decrypting information. B. Public key encryption is a highly secure encryption scheme that in which a single shared key is used by both the sender and receiver of the message. C. Public key encryption makes use of certain types of problems which are easier for humans to solve than computers. D. Public key encryption makes use of mathematical problems which no algorithm can be used to solve.
A. Public key encryption is an encryption method which relies on separate keys for encrypting and decrypting information.
Fill in the blank of the following statement: "______ encryption is a method of encryption involving one key for both encryption and decryption." A. Symmetric B. Asymmetric C. Public key D. SSL
A. Symmetric NOTE: Symmetric Encryption: A scheme in which the key to encrypt data is the same as the key to decrypt. Asymmetric Encryption: Used in public key encryption, it is a scheme in which the key to encrypt data is different from the key to decrypt. Public Key: This is used prevalently on the web, it allows for secure messages to be sent between parties without having to agree on, or share, a secret key. It uses an asymmetric encryption scheme in which the encryption key is made public, but the decryption key is kept private. SSL: (Secure Sockets Layer) is the standard security technology for establishing an encrypted link between a web server and a browser. This link ensures that all data passed between the web server and browsers remain private and integral.
According to the domain name system (DNS), which of the following is a subdomain of the domain example.com? A. about.example.com B. example.co.uk C. example.com.org D. example.org
A. about.example.com
What is the 4-bit number for the decimal number ten (10)? A. 0010 B. 1010 C. 0110 D. 0101
B. 1010
Consider the following numbers given in Binary (BIN), Decimal (DEC), and Hexadecimal (HEX) representations: BIN: 1110 DEC: 13 HEX: F Which of the following lists the numbers in order from least to greatest? A. BIN: 1110, DEC: 13, HEX: F B. DEC: 13, BIN: 1110, HEX: F C. DEC: 13, HEX: F, BIN: 1110 D. HEX: F, DEC: 13, BIN: 1110
B. DEC: 13, BIN: 1110, HEX: F
Consider the following numbers given in Binary (BIN), Decimal (DEC), and Hexadecimal (HEX) representations: BIN: 1110 DEC: 13 HEX: F Which of the following lists the numbers in order from least to greatest? A. BIN: 1110, DEC: 13, HEX: F B. DEC: 13, BIN: 1110, HEX: F C. DEC: 13, HEX: F, BIN: 1110 D. HEX: F, DEC: 13, BIN: 1110
B. DEC: 13, BIN: 1110, HEX: F
Which of the following are actions a programmer could take when debugging a segment of code that would most likely lead to finding a problem and fixing it? (choose two) A. Change the names of variables within the program and run the program again. B. Display the value of variables at various points during the program. C. Ask a friend or collaborator to look over the code segment to see if they are able to find any errors. D. Delete the code and re-type it to make sure there were no spelling errors and that it was written correctly.
B. Display the value of variables at various points during the program. C. Ask a friend or collaborator to look over the code segment to see if they are able to find any errors. NOTE: Unit 5 Lesson 4 Debugging a program by printing out the current values with console.log and seeing what the program is internally doing at a certain moment will be helpful. Asking for help from another person is also a good way of debugging, especially if you've been working on your code for a long time and need a fresh pair of eyes. On the other hand, changing variable names will not help because you are only renaming the problem rather than finding and fixing the problem. Computers read code line by line, so rewriting chunks of code is the same as rewriting the same problem.
For this scenario related to turtle drawing, indicate whether it is better to write a loop or a function (or a set of functions) to handle the task: Drawing out the letters of a word "HELLO" A. Loop B. Function(s)
B. Function(s) NOTE: Loops are good to use when specific actions are repeated; however, in this case, since there are four different letters in "HELLO" it is best to write each function to draw each letter.
For this scenario related to turtle drawing, indicate whether it is better to write a loop or a function (or a set of functions) to handle the task: Drawing a circle of any size at any point on the screen A. Loop B. Function(s)
B. Function(s) NOTE: Since the drawing of the circle is inconsistent in size and in the placement of it, it is best to use a function and pass in different parameters for a particular circle (smaller/larger circle, placement of the circle) rather than using a loop.
The various protocols in use on the internet are said to operate in layers in which the protocol(s) at each layer solve one problem related to networked communication, and higher layers are built on top of, and rely on, the lower layers to do their jobs. From the list provided choose the two (2) answers that correctly describe which internet protocol relies on the other. For example: if protocol A relies on protocol B, it means that A is a higher level protocol than B, and thus protocol B must exist and work properly in order for protocol A to do its job. Select two answers. A. TCP/IP relies on HTTP B. HTTP relies on TCP/IP C. DNS relies on TCP/IP D. TCP/IP relies on DNS
B. HTTP relies on TCP/IP C. DNS relies on TCP/IP
To uncompress data back into its original binary state, you simply reverse the process. This technique is an example of what type of compression? A. Lossy compression B. Lossless compression C. Fast Fourier Transform compression D. Tailored compression
B. Lossless compression
Which of the following BEST describes how protocols on the Internet (e.g. IP, TCP, HTTP) make use of abstraction to accomplish their respective purposes? A. High level protocols take into account specific implementation details of lower level protocols to ensure they are compatible. B. Low level protocols can provide functionality to high level protocols without revealing the details of how this is accomplished. C. Low level protocols are written in binary while high level protocols are written in hexadecimal. D. High level protocols can take on the role of a low level protocol in the event of failure in the system.
B. Low level protocols can provide functionality to high level protocols without revealing the details of how this is accomplished.
Why are parameters useful when programming? A. Parameters determine the number of times the function will run. B. Parameters allow for more flexible, generalized behaviors in functions. C. Parameters are useful for teams of programmers because they help define the boundaries of the problem they are trying to solve. D. Parameters change the order of operations within a function.
B. Parameters allow for more flexible, generalized behaviors in functions. NOTE: Incorrect answers: Parameters can change the behavior inside a function, but the function only runs the number of times it is called and is not always based on the parameters given. Parameters can help define boundaries within the function, but is not restricted to teams of programmers. An individual programmer can used parameters as well. Once code is written, it is read line by line in order. The input of a parameter will not change the order the lines run in. Correct answer: Ultimately, parameters are great for noting specific inputs for a particular function, allowing flexible outcomes within a function. For example: say you want a function to draw some squares but with different side lengths. The function drawSquare(s) where s is the side length. The programmer can then easily call drawSquare(3); drawSquare(8); drawSquare(76); For squares of side length 3, 8, and 76 without having repetitive chunks of code in their program.
Which of the following is NOT true about TCP/IP packets? A. Packets are numbered so if they arrive out of order the message can be reassembled. B. TCP guarantees that no packets are ever dropped. C. Packets can be routed on different paths from sender to receiver. D. Messages are broken into packets to improve reliability of the internet.
B. TCP guarantees that no packets are ever dropped.
A bakery collects data on sales. Each sales record includes the date of the sale and some metadata about the items that were part of the sale. The data includes: the names of the items sold, the types of items sold, the number of each item sold, and the price of each item sold. Which of the following CANNOT be determined from the bakery's data set? A. The total income from the sales of the bakery received in the past month. B. Which customer most frequently purchases bread. C. The item bought in the highest quantity in the past week. D. Days when certain items sell the most.
B. Which customer most frequently purchases bread.
Which of the following scenarios is most characteristic of a phishing attack. A. You accidentally run a piece of code that automatically spreads from one computer to another, exploiting a common vulnerability B. You get an email from the IT support desk that asks you to send a reply email with your username and password to verify your account C. You get an unwanted email trying to sell you a low quality product or service that seems "fishy." D. You accidentally install a piece of software that monitors your activity to steal personal information like your passwords, date of birth, social security number, etc.
B. You get an email from the IT support desk that asks you to send a reply email with your username and password to verify your account
Consider the code segment below: What are the values of a, b, and c after this code segment has been run? A. a:4, b:4, c:4 B. a:4, b:8, c:8 C. a:4, b:8, c:12 D. a:4, b:8, c:16 E. a:0, b:3, c:4
B. a:4, b:8, c:8 NOTE: Unit 5 Lesson 4 Solve this problem by going through the lines of code while keeping track of the value of each variable. It is important to note that if a variable is assigned a new value, the lines of code that reference that variable afterwards also references the new value. At the very beginning, a = 0, b = 3, c = 4 a = a + c which equals 0 + 4 = 4. Thus, variable "a" is changed to the value 4 Now, the value of "a" is set to 4 b = a + c which equals 4 + 4 = 8. Variable "b" now equals 8 c = a + c which equals 4 + 4 = 8 By the end of the program, a = 4, b = 8, and c = 8
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? A. 2 times as many values can be represented. B. 32 times as many values can be represented. C. 2^32 times as many values can be represented. D. 32^2 times as many values can be represented.
C. 2^32 times as many values can be represented. NOTE: Every time you add a single bit to a binary number, you multiply by 2 the number of numbers you can represent. So for example, a 2-bit number can represent 4 numbers (0 - 3), and a 3-bit number can represent 8 numbers (0 - 7). So if you're going from a 32-bit to a 64-bit number, you are multiplying the number of numbers you can represent by 2, 32 times, so 2^32 is the correct answer.
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? A. 2 times as many values can be represented . B. 32 times as many values can be represented. C. 2^32 times as many values can be represented. D. 32^2 times as many values can be represented.
C. 2^32 times as many values can be represented. NOTE: Every time you add a single bit to a binary number, you multiply by 2 the number of numbers you can represent. So for example, a 2-bit number can represent 4 numbers (0 - 3), and a 3-bit number can represent 8 numbers (0 - 7). So if you're going from a 32-bit to a 64-bit number, you are multiplying the number of numbers you can represent by 2, 32 times, so 2^32 is the correct answer.
Choose the answer that is NOT a feature of Public Key Cryptography: A. A key for decrypting is never made public B. Using public key guarantees that only the intended recipient can decrypt the message C. A Public Key database ensures 3rd party accountability of security D. Allows secure communication without establishing a *shared* encryption key ahead of time.
C. A Public Key database ensures 3rd party NOTE: Public-key cryptography is any cryptographic system that uses pairs of keys. Public keys may be distributed and paired with private keys which are known only to the owner. Since the public and private keys are given by the owner, no third parties should be held accountable for the security of the information.
What is one important naming convention of functions? A. A function name should indicate how long the function takes to run. B. Two functions with similar behavior should be given identical names to indicate the relationship between them. C. A function name should be as descriptive as possible to indicate what the function does. D. Function names should be organized alphabetically. E. The function name should begin with a number that indicates the order in which it should be executed.
C. A function name should be as descriptive as possible to indicate what the function does. NOTE: The most important part of naming a function is that it describes what the function does so that the original developer and other developers can quickly and easily have an understanding of the code. With a descriptive name for the function, this helps with the readability and manageability of their code. Although some functions have identical code within them, functions should not have identical names. Note: As functions can be shifted throughout the development of a program, numbering the functions or organizing them alphabetically are not crucial in their naming conventions.
The Internet Engineering Task Force defines protocols and standards for how the Internet works. The members of IETF are: A. An international coalition of government agencies who oversee the Internet in their countries. B. A collection of leaders of the Tier 1 Internet service providers. C. A loosely organized collection of citizens and engineers. D. Political leaders and heads of state.
C. A loosely organized collection of citizens and engineers.
Which of the following statements are true about routers and routing on the Internet. Choose two answers. A. Protocols ensure that a single path between two computers is established before sending packets over it. B. Routers are hierarchical and the "root" router is responsible for communicating to sub-routers the best paths for them to route internet traffic. C. A packet traveling between two computers on the Internet may be rerouted many times along the way or even lost or "dropped". D. Routers act independently and route packets as they see fit.
C. A packet traveling between two computers on the Internet may be rerouted many times along the way or even lost or "dropped". D. Routers act independently and route packets as they see fit.
What is a Distributed Denial of Service (DDoS) attack? A. A coordinated effort by a group to simultaneously attempt to gain entry to foreign government's servers or systems B. An effort by network engineers to focus all systems on catching a user or computer that has illegally gained access. C. An attempt to compromise a single target by flooding it with requests from multiple systems. D. An attempt to harass or extort all customers of one or more Internet Service Providers (ISPs).
C. An attempt to compromise a single target by flooding it with requests from multiple systems.
Biologists often attach tracking collars to wild animals. For each animal, the following geolocation data is collected at frequent intervals. The time The date The location of the animal Which of the following questions about a particular animal could NOT be answered using only the data collected from the tracking collars? A. Approximately how many miles did the animal travel in one week? B. Does the animal travel in groups with other tracked animals? C. Do the movement patterns of the animal vary according to the weather? D. In what geographic locations does the animal typically travel?
C. Do the movement patterns of the animal vary according to the weather?
Which of the following is NOT true about functions in programming? A. Functions are reusable programming abstractions. B. Functions help reduce the complexity of writing and maintaining programs. C. Functions cannot make calls to other functions within the same program. D. Functions help break a problem into logical chunks. E. Once defined, a function can be called many times from different parts of a program.
C. Functions cannot make calls to other functions within the same program. NOTE: This is a tricky question because the correct answer effectively makes a double-negative. It is NOT true that functions CANNOT call other functions. In other words: functions can call other functions. Students should be very familiar with this fact after completing this unit since writing and calling functions from other functions is basically the primary focus. This answer refers to the fact that in defining a function you can call other functions that you have written. For example: function drawFlower(){ drawpetal(); drawpetal(); drawpetal(); drawpetal(); } Assuming that drawpetal() is some other function you wrote (and does something) this is an example of one function calling another.
Which of the following most accurately describes Moore's Law: A. Moore's Law describes a relationship of boolean logic statements involving AND and OR. B. Moore's Law is the principle that one should assume that any traffic on the Internet is insecure. C. Moore's Law is the observation that computing power tends to double every two years. D. Moore's Law explains why cracking modern cryptography is a "computationally hard" problem.
C. Moore's Law is the observation that computing power tends to double every two years. NOTE: Definition of Moore's Law: A predication made by Gordon Moore in 1965 that computing power will double every 1.5-2 years, it has remained more or less true ever since.
When programmers work together, what is an example of how abstraction in programming can promote collaboration? A. Team members can rely on one another to explain their code. B. Programmers can write functions without needing to know what they do or how they should work. C. Programmers can use functions created by their partners, relying on the functionality without needing to know the specific details of how the function is implemented. D. In order for programmers to work together, they must work in the same room. E. Abstraction allows programmers to brainstorm more creative solutions to problems.
C. Programmers can use functions created by their partners, relying on the functionality without needing to know the specific details of how the function is implemented. NOTE: Abstraction in programming: Where the programmer makes their code more readable by hiding irrelevant material in their code. It allows an easier interaction with the program. With this in mind, when programmers work together it is imperative that one's code is easy to read at first glance. Most notably, it should be clear to every team member what a function does so the programmer does not need to explain their code multiple times. Abstraction and clean code makes team programming more efficient.
A certain social media Web site allows users to post messages and to comment on other messages that have been posted. When a user posts a message, the message itself is considered data. In addition to the data, the site stores the following meta data. The time the message was posted The name of the user who posted the message The names of any users who comment on the message and the times the comments were made For which of the following goals would it be more useful to analyze the data instead of the metadata? A. To determine the users who post messages most frequently B. To determine the time of day that the site is most active C. To determine the topics that many users are posting about D. To determine which posts from a particular user have received the greatest number of comments
C. To determine the topics that many users are posting about
The next question refers to hexadecimal which is a base-16 number system - a number system that uses one of 16 possible digits for each place value. 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 below. Decimal ASCII 80 P 81 Q 82 R 83 S 84 T 85 U 86 V 87 W 88 X 89 Y 90 Z A. A B. L C. V D. Y
C. V NOTE: In order to calculate the value of the base-16 number 56, it is 5*16^1 + 6*16^0 = 86, which maps to 'V' in the table
Under which of the following conditions is it most beneficial to use a heuristic approach to solve a problem? A. When the problem can be solved in a reasonable time and an approximate solution is acceptable. B. When the problem can be solved in a reasonable time and an exact solution is needed. C. When the problem cannot be solved in a reasonable time and an approximate solution is acceptable. D. When the problem cannot be solved in a reasonable time and an exact solution is needed.
C. When the problem cannot be solved in a reasonable time and an approximate solution is acceptable.
A coffee shop is considering accepting orders and payments through their phone app and have decided to use public key encryption to encrypt their customers' credit card information. Is this a secure form of payment? A. No, public key encryption allows the credit card information to be read by the pubic. B. No, the internet protocols are open standards and thus everything sent over the internet is sent "in the clear." C. Yes, public key encryption is built upon computationally hard problems that even powerful computers cannot easily solve. D. Yes, public key encryption is secure because it transmits credit card information in binary.
C. Yes, public key encryption is built upon computationally hard problems that even powerful computers cannot easily solve.
Jasmine is writing a shopping app. She has created a variable to keep track of the number of items in the shopping cart. Every time someone clicks the "addItemButton", she would like the variable to increase by 1. var carTotal = 0; onEvent("addItemButton", "click", function() { //missing code console.log(carTotal); What code should Jasmine insert where it says <missing code> in order for her app to work? A. cart total = 1; B. cartTotal + 1; C. cartTotal = cartTotal +1; D. var cartTotal = cartTotal + 1; E. var cartTotal + 1;
C. cartTotal = cartTotal +1; NOTE: Unit 5 Lessons 4,5 Since Jasmine wants to increase the cartTotal by one every time the "addItemButton" is clicked, the new cartTotal should be the current cartTotal plus one. In other words, cartTotal = cartTotal + 1; Since the variable cartTotal is already initialized in line 1, the word "var" is not necessary because that would create a new local variable instead of adding on to the existing cartTotal.
What is the best term for "data about the data" A. megadata B. superdata C. metadata D. predata
C. metadata
Jose is writing a reply function for a text messaging app. He'd like to swap the sender and receiver so that the value currently in variable From ends up as the value in To and To ends up in From Which of the following code segments will correctly swap the values as described? A. to = from; from = to; B. from = var temp; to = temp; from = to; C. var temp = from; from = to; to = from; D var temp = from; from = to; to = temp; E var temp = to; from = to; to = temp;
D var temp = from; from = to; to = temp; NOTE: General idea: a temporary variable must be made to contain one of the existing information before switching the variable information. Switching "to = from" and then "from = to" is incorrect because both variables would then equal "from". A "temp" variable is created and points to one value, "from" Since "from" value is stored within "temp", it is safe to write "from = to" "to" needs to point to the value of "from" BUT cannot be "to = from" because at this point, "from" stores the value of "to" Therefore, "to = temp" because "temp" holds the original value of "from" Note: It may be helpful to draw out boxes containing "Bruce Wayne" and "James Bond", and change the arrows "from", "to", and "temp" to visualize the problem. Optional: For further understanding, read up on the term "reference semantics"
What is the output to the console after the following code segment is executed? 1 var x = 10; 2 increase(); 3 x = x+3; 4 console.log(x); 5 function increase(){ 6 var x = 5; 7 } A. 5 B. 8 C. 10 D. 13 E. Error. Cannot make a new variable x inside function increase()
D. 13 NOTE: Unit 5 Lesson 5 - application of local v. global Going through each line of code: 1: A variable x is set to the value 10 2: The function "increase()" is called where a separate local variable that is also named "x" is set to the value 5 3: Exiting the function "increase()", in line 3 the value of x is still 10 because the local variable inside "increase()" is not accessible outside outside the function. Thus, in line 3, x = x + 3 which equals 10 + 3 = 13 Printing the value of x, the computer outputs "13"
The world is currently in a transition to use IPv6, a newer version of the IP protocol that uses 128-bit addresses instead of 32-bit addresses used by IPv4. What is the main problem that IPv6 was created to solve? A. 32-bit addresses could not accommodate the increased size and amount of data traveling on the Internet as it has grown in popularity. B. IPv6 will allow problems with IPv4's address hierarchy to be resolved. C. IPv4 proved unreliable in some cases where network redundancy could not be ensured. D. 32-bit addresses could not ensure that every internet-connected device can receive a unique IP address.
D. 32-bit addresses could not ensure that every internet-connected device can receive a unique IP address.
What is the best explanation for digital data is represented in computers in binary? A. The binary number system is the only number system flexible enough to allow for representing data other than numbers. B. As a consequence of history: early pioneers of computing were making secret codes in binary, and this simply evolved into modern computing. C. It's impossible to build a computer machine that uses anything but binary to represent numbers. D. It's easier, cheaper, and more reliable to build machines and devices that only have to distinguish between binary states.
D. It's easier, cheaper, and more reliable to build machines and devices that only have to distinguish between binary states.
A user clicks on a website, and it begins to load immediately, but it takes a long time to load completely and pictures appear slowly, one by one. Which of the following is demonstrated through this situation? A. High bandwidth, high latency B. Low bandwidth, high latency C. High bandwidth, low latency D. Low bandwidth, low latency
D. Low bandwidth, low latency
A programmer is writing a system that is intended to be able to store large amounts of personal data. As a programmer develops the data system, which of the following is the LEAST likely to impact the programmer's choice in designing the structure of the system? A. Maintaining privacy of the information stored in the data set. B. Scalability of the system. C. Structuring the metadata of the information for analysis. D. The frequency of a particular item occurring in a data set.
D. The frequency of a particular item occurring in a data set.
A programmer is writing a system that is intended to be able to store large amounts of personal data. As the programmer develops the data system, which of the following is LEAST likely to impact the programmer's choices in designing the structure of the system? A. Maintaining the privacy of the information stored in the data set. B. Scalability of the system. C. Structuring the metadata of the information for analysis. D. The frequency of a particular item occurring in a data set.
D. The frequency of a particular item occurring in a data set.
Which of the following is a true statement about data compression? A. Data compression is only useful for files being transmitted over the internet. B. Regardless of the compression technique used, once a data file is compressed, it cannot be restored to its original state. C. Sending a compressed version of a file ensures that the contents of the file cannot be intercepted by an unauthorized user. D. There are trade-offs involved in choosing a compression technique for storing a transmitting data.
D. There are trade-offs involved in choosing a compression technique for storing a transmitting data.
The next questions refers to the hexidecimal (base 16) number system: Number bases, including binary, decimal, and hexadecimal, are used to view and represent digital data. Which of the following is NOT true about representing digital data? A. At one of the lowest levels of abstraction, all digital data can be represented in binary using only combinations of the digits zero and one. B. Hexadecimal is used to represent digital data because hexadecimal representation uses only 1 digit to represent groups of 4 binary digits. C. Binary can be used to represent more complex, higher level abstractions, including but not limited to numbers, characters, and colors. D. There is a limit to the number of things that can be represented in binary data at which point switching to hexadecimal representation is necessary.
D. There is a limit to the number of things that can be represented in binary data at which point switching to hexadecimal representation is necessary.
A school starts tracking which websites each computer in the school is visiting by monitoring the packets leaving the school. A sample of the information they have collected appears below: IP Address Time URL 1.1.1.1 11:05:23 example.com 1.5.1.8 11:05:29 news.com 1.1.5.1 11:06:13 sports. com Which of the following is MOST likely to be answerable using all the data collected by this monitoring? A. Which students are visiting social media sites from school B. Which classes are assigning the most homework using the computers C. Which programs students are running on the lab computers D. Which websites are most frequently visited before and after school hours from a school computer.
D. Which websites are most frequently visited before and after school hours from a school computer.
Select the answer that lists the units of bytes in ascending order (from smallest to largest) A. gigabyte, megabyte, terabyte B. megabyte, terabyte, kilobyte C. gigabyte, terabyte, megabyte D. kilobyte, gigabyte, terabyte
D. kilobyte, gigabyte, terabyte
What is displayed by the console.log statement after the following code segment executes? 1 var a = 3; 2 var b = 6; 3 var c = 10; 4 a = b / a; 5 b = c - a; 6 c = b / a; 7 console.log("value is: "+c); A. value is: 2 B. value is: 2.3333333 C. value is: 3 D. value is: 4 E. value is: c
D. value is: 4 NOTE: Unit 5 Lesson 4 Solve this problem by going through the lines of code while keeping track of the value of each variable. It is important to note that if a variable is assigned a new value, the lines of code that reference that variable afterwards also references the new value. At the very beginning, a = 3, b = 6, c = 10 a = b / a which equals 6 / 3 = 2. Thus, variable "a" is changed to the value 2 Now, the value of "a" is set to 2 b = c - a which equals 10 - 2 = 8. Variable "b" now equals 8 c = b / a which equals 8 / 2 = 4 By the end of the program, value of c = 4
A programmer wrote an essay for his history class, and realized he has confused the names of Benjamin Franklin and Alexander Graham Bell. Instead of going through the whole paper and changing the names, he used the following incorrect algorithm in an attempt replace every occurrence of "Benjamin Franklin" with "Alexander Graham Bell" and vise versa: - First, change all occurrences of "Benjamin Franklin" to "apple" - Then, change all occurrences of "apple" to "Alexander Graham Bell". - Then, change all occurrences of "Alexander Graham Bell" to "Benjamin Franklin". Here is an example of one of the sentences from the paper: Alexander Graham Bell was born 141 years before Benjamin Franklin, so he was never able to telephone his neighbors. Which of the following is the result of running the described incorrect algorithm on the sentence above? A. Benjamin Franklin was born 141 years before Alexander Graham Bell, so he was never able to telephone his neighbors. B. apple was born 141 years before Benjamin Franklin, so he was never able to telephone his neighbors. C. Alexander Graham Bell was born 141 years before apple, so he was never able to telephone his neighbors. D. Benjamin Franklin was born 141 years before Benjamin Franklin, so he was never able to telephone his neighbors. E. Alexander Graham Bell was born 141 years before Alexander Graham Bell, so he was never able to telephone his neighbors.
E. Alexander Graham Bell was born 141 years before Alexander Graham Bell, so he was never able to telephone his neighbors. NOTE: Unit 5 Lesson 4 Strategy: Go through the algorithm and keep track of the changes for each line Start "Alexander Graham Bell was born 141 years before Benjamin Franklin, so he was never able to telephone his neighbors." Change all "Benjamin Franklin" to "apple" Current: "Alexander Graham Bell was born 141 years before apple, so he was never able to telephone his neighbors." Change all "apple" to "Alexander Graham Bell" Current: "Alexander Graham Bell was born 141 years before Alexander Graham Bell, so he was never able to telephone his neighbors. Change all "Alexander Graham Bell" to Benjamin Franklin" Final: "Benjamin Franklin was born 141 years before Benjamin Franklin, so he was never able to telephone his neighbors." The algorithm is incorrect because the last two steps should be switched.
What is the output to the console after the following code segment is executed? 1 fiveMore(); 2 function fiveMore(){ 3 var x = 5; 4 } 5 var y = 3 + x; 6 console.log(y); A. -2 B. 3 C. 5 D. 8 E. Error. Unknown Identifier: x
E. Error. Unknown Identifier: x NOTE: Unit 5 Lesson 5 - application of local scope and debugging The function "fiveMore()" is called. Inside this function, a new variable "x" is set to 5 The computer exits this function and moves on to line 5 where a variable y is created The value of y is set to "3 + x" However, the variable x was initiated locally inside "fiveMore()" and is not accessible outside of the function. Therefore, there is an error because the variable x does not exist outside the method. 13.
Which one of the following statements about functions is TRUE A. A function can change names over the course of a program. B. Code can be added or removed dynamically from a function while the program is running. C. Functions can be called using different names depending on where in the program they are called. D. Two functions can be given identical names as long as their code is identical. E. Two functions in a single program can have different names but contain identical code.
E. Two functions in a single program can have different names but contain identical code. NOTE: The incorrect answers: When a program is running, the function names cannot be changing and code cannot be dynamically changed. Once a program is running, the program has to finish running or the user manually stops the program in order to edit the lines. Once a function is named, it must be called using the given name. If a function is called using a different name that does not exist, an error will occur. Functions should never have identical names. The correct answer: Multiple functions can contain identical code as long as the names are different. Functions have to be named differently in order for the program to know which function to correctly run, it does not matter if the same lines of code are in multiple functions.
Explain how abstraction allows for the creation of increasingly complex systems. Reference top-down design strategy in your response.
NOTE: What to look for: A general understanding that abstraction allows programmers to hide details By hiding details, programmers are able to work with complex systems in small pieces without having to pay attention to every detail at once An explanation of how top down design implements abstraction Example: Through the use of abstraction, a programmer is able to take one large idea, and break it down into smaller pieces. In the context of top-down design, this means that the programmer can create one function that is made up of a set of smaller sub functions. After determining the details of those sub functions, the programmer no longer needs to take into account how they work, knowing that they will work in when called. For example when drawing a snowflake, the programmer may use top down design to split it into separate branches. Each of those branches may have sub functions that determine the detail to be repeated. This allows programmers to develop complex systems while managing complexity at multiple levels of abstraction.
Two students, Kaleb and Hunter, are arguing in class about an App Lab project. Kaleb states, "Huh, a button and an image are basically the same thing!". Hunter replies, "That doesn't make any sense at all!". Explain what Kaleb may have meant by that statement.
NOTE: Unit 5 Lesson 2 What to look for: A button and an image are both UI elements. Both have positions. Both can have background images. Both can respond to the same set of events. For example, if a programmer has written an event handler for when a button is clicked, she could write an analogous event handler to perform the same action when an image is clicked (or even just switch the ID of the event handler from the id of the button to the id of the image).