AP Computer Science Exam Study Guide

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

What is an Algorithm?

Precise sequence of instructions for processes that can be implemented in a programming language.

function start(){ //this array is filled with several Rectangle objects var rectangleArray = [...]; //your code here ... } function updateRectangle(rect){ //changes the color of rect to a random color rect.setColor(Randomizer.nextColor()); } We have an array of Rectangles called rectangleArray & a function updateRectangle(rect) that takes a single rectangle as a parameter & changes it's color to a random color. How can we easily change the color of every rectangle inside rectangleArray? What method can we use to find the index of a particular element in an array?

for(var i = 0; i < rectangleArray.length; i++){ updateRectangle(rectangleArray[i]); } indexOf.

How many times should you call the start function when writing your program? What is top down design?

0. Designing your program by starting with the biggest pieces.

What is an array (or list)? What is the index of the very first item in an array? What index refers to the "end" of an array?

An ordered collection of items. 0. The highest index.

Consider the following numbers: The decimal value 1010 The binary value 10012 Hexadecimal value C16 Which of the following lists the number in order from least to greatest? Which of the following statements are true about the Internet? I - The Internet connects devices & networks all over the world II - The Internet helps people collaborate to solve problems III - The Internet helps people communicate IV - There are no negative consequences of the Internet, it is purely positive What is the bitrate of a system? What is the latency of a system? How is the bandwidth of a network measured?

10↓10, 1001↓2, C↓16. I, II, & III. Amount of data (in bits) can be send. Time it takes for bit to travel. Bitrate.

How many different digits are used in the Hexadecimal number system? A computer program uses 3 bits to represent integers. When the program adds the decimal (base 10) numbers 6 & 2, the result is 0. Which of the following is the best explanation for this result? Which number system is used to store information digitally in a computer? An online store uses 8-bit binary values to identify each unique item for sale. The store plans to increase number of items it sells & is considering changing to 9-bit binary values. Which of the following best describes the result of using 9-bit values instead of 8-bit values?

16. Overflow error occurred. Binary (base 2). 2 times as many items.

In the following code, what will be the last number to print to the screen before the program finishes? for (var i = 0; i < 10; i++) { if (i % 2 == 0) { println(i); } else { println(2 * i); } } What statement can we use inside of a loop to end it? Which of the following is correct loop & a half structure?

18. break. while(true){ //code if(condition){ break; } //code }

A news website uses 32-bit integers to count the number of times an article has been viewed. The website is becoming more popular, & expects some of the articles to exceed the number of views that can be represented with 32 bits. In anticipation of this, the website is planning to change to 64-bit integers for the view counter. Which of the following best describes the result of using 64-bit integers instead of 32-bit integers? Refer to the ASCII table from Question 7. Which ASCII character is represented by the decimal (base 10) number 72? 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 binary (base 2) value 0100 0111, which is equivalent to the decimal (base 10) value 71. A subset of characters & their corresponding ASCII values are shown in the table below: ASCII characters can also be represented by hexadecimal (base 16) numbers. According to the ASCII character encoding, which of the following characters is represented by the hexadecimal (base 16) number 6E16?

2↑32. H. n.

An IPv4 address has 32 bits, so there are 232 (over 4 billion) possible IPv4 addresses. Since the Internet is gaining devices quickly, we will soon surpass 232 unique devices on the Internet. In anticipation of all the new Internet devices, we are in the process of switching to IPv6, which uses 128 bits for a single address. That's 96 extra bits to represent one address! Which of the following statements correctly describes how many more addresses will be possible to represent by switching from IPv4 to IPv6? A city government is attempting to reduce the digital divide between groups with differing access to computing & the Internet. Which of the following actions is LEAST likely to be effective in this purpose? Consider the following network diagram: *Diagram* Each box represents a device connected to the network, each line represents a direct connection between two devices. Which of the following statements are true about this network: I - The network is fault tolerant. If one connection fails, any two devices can still communicate. II - Computers C and E need to first communicate with at least one other device in order to communicate with each other.

2↑96. Putting helpful tips for operating computers. I only.

What is printed by the following code? function printNumbers(first, second, third){ println(first); println(second); println(third); } function start(){ var middle = 5; printNumbers(4, middle, 6); } Which statement allows us to return values from functions? What is printed when the following code is run? function doubleNumber(x){ return 2*x; } function start(){ var y = 4; var doubledY = doubleNumber(y); var result = doubleNumber(doubledY); print(result); }

4 5 6 Return. 16.

How many possible values can be created with only 2 bits? What is a pixel? What is the value of 9F16 in binary? What is the range of values (expressed in decimal) that each color channel can have?

4. A small tiny dot of a picture. 1001 1111↓2. ↓10 - 255↓10.

Which of the following statements is an example of computer readable data? Which of the following statements is NOT a benefit of using computers to process data? What is data? I. Computer readable information II. Information collected about the physical world III. Programs that process images IV. Graphs and charts Which of the following statements is true about data visualizations?

A digital spreadsheet filled with measurements. Websites can spy on people. I & II. Visualizations take many forms.

What is the Internet Protocol (IP)? Suppose we used an Internet Addressing protocol that used 4 bits to encode a single address. How many devices would be supported on the Internet? How many unique addresses would there be? What is the function of the Domain Name System (DNS)? Which of the following are true about Internet routing? I - For any two points on the Internet, there exists only one path between the two points II - Routing on the Internet is fault tolerant & redundant

A protocol that defines the structure of an Internet address. 16. Translate domain names into IP addresses. II only.

What information is contained in a packet? What is a DNS spoofing attack? What is the purpose of the Digital Millennium Copyright Act? Two computers are built by different manufacturers. One is running a Web server & the other is running a Web browser. Which of the following best describes whether these two computers can communicate with each other across the Internet?

A small part of a digital message & metadata. A hacker overwrites the data. Criminalize the act of circumventing. The computers can communicate directly because Internet communication uses standard protocols.

Suppose you have written a web page using HTML & CSS and it is hosted at the URL yourdomain.com/home.html Which of the following statements is true about which devices can view your website? I. Styling with CSS is more scalable than using style on each HTML tag that you want to style II. You can create styles with CSS that are not possible using style on an HTML tag

Any browser on any device will be able to view your webpage. I only.

Which of the following is true about lossless data compression? What types of data should be compressed with the Run Length Encoding algorithm? What types of data does the algorithm perform well with? Which of the following are true about Public Key Encryption? I: It requires all senders & receivers to have their own public key & their own private key II: A message encrypted with a person's public key can only be decrypted with the same person's private key III: A public key can be shared with anyone IV: Public key encryption is the most common form of encryption for internet communication

Compressed data can be restored. Text with many repeated characters. I, II, III, & IV.

Each of the following answer choices describes a basketball game. Which answer choice describes the game with the lowest level of abstraction? Why do we use if statements in JavaScript? Why do we use if/else statements in JavaScript?

First, Steph Curry flexed his left & right quad muscles. To do something only if a condition is true. To either do something if a condition is true or do something else.

Suppose you want to make a visualization that shows how many students bought certain quantities of candy from the vending machine during the month of September. Of the choices below, which chart would best convey this information to the person looking at the graph? Which of the following are ways that data is collected about you: I - Websites store data that tracks how you use the website II - Websites store cookies in your browser so that the next time you visit the website things like your profile login & recent activity are saved III - Some apps store geolocation information from your phone to track your location IV - Transaction data is stored by credit card companies when you purchase things with a credit card

Histogram. I, II, III, & IV.

Which of the following are true about Symmetric Key Encryption? I: The same key is used for both encryption & decryption II: The sender & receiver must exchange a shared key in private before using symmeric key encryption to communicate III: Symmetric key encryption is the most common form of encryption for internet communication Which of the following statements are true about Caesar's Cipher? I: Caesar's Cipher is a form of Symmetric Encryption II: Caesar's Cipher is a "hard" encryption to crack

I & II only. I only.

News reporting agencies often want to find the public's opinion on current events. One particular agency is considering two different strategies to collect this data by collecting responses to online surveys. The two strategies are outlined below. Strategy One: 1. Uses a database to store all of the survey responses 2. Stores some data as text & some data as numbers 3. Will track extra information about the survey taker that won't be publicly visible Strategy Two: 1. Uses a single spreadsheet to store all of the survey responses 2. Stores all data as numbers 3. Will not track any information other than the survey responses Which of the following statements is the most accurate comparison of these strategies?

I, II, III, & IV.

Which of the following statements are true about the Internet? I - The Internet connects devices & networks all over the world II - There are no negative consequences of the Internet, it is purely positive III - The Internet helps people communicate IV - The Internet helps people collaborate to solve problems

I, III, & IV.

Laura will go to her friend's house if she has less than two hours of homework or if it is the weekend. Otherwise, she will stay home & study. In which of the following cases will Laura stay home to study? Which decimal value is equal to the binary number 1012?

Laura has 2.5 hours of homework on Thursday. 5↓10.

Which of the following activities poses the greatest personal cybersecurity risk? Which of the following is considered an unethical use of computer resources? Which of the following would pose the greatest threat to a user's personal privacy if it were to be leaked to the public? A user enters a Web address in a browser, & a request for a file is sent to a Web server. Which of the following best describes how the file is sent back to the user?

Purchasing a couch by emailing. Searching online for the answers to CodeHS. User's browsers cookies. The packets must be reassembled by the user's computer.

What is Repetition/Iteration?

R: Structure, or loop, is used when a program needs to repeatedly process one or more instructions until some condition is met. I: Another word for repetition.

CSS rules have a selector that defines which HTML elements the rule applies to. We've learned about the following CSS Selectors: Select by tag name Select by class name Select by id name Which of the following ranks the selectors from highest precedence to lowest precedence?

Select by id name, select by class name, select by tag name. (backwards)

What is Abstraction? What is Binary #? What is World Wide Web?

Simplified & general representation of some complex object or process. Example: Google Maps. A number written in the binary system, a system that uses only two digits, 0s & 1s. Application that runs on the Internet. system of interlinked resources.

What is the first step of viewing a web page as described in the video? What is the second step of viewing a web page as described in the video? What is the third step of viewing a web page as described in the video? What is the fourth step of viewing a web page as described in the video?

The URL. The Request. The Response. Rendering the page.

Consider the following program code: var i = 1; var sum = 0; while(i < 5) { sum += i; } println(sum); What is the result of running this program code?

The program results in infinite loop.

Why do we use while loops in JavaScript? What do we use control structures for in JavaScript? Which of the below are examples of control structures? (I) if (II) if/else (III) while (IV) for What is a parameter?

To repeat some code while a condition is true. Control the flow of the program, how the commands execute. I, II, III, & IV. Input into a function.

What is the purpose of using a for loop in code? To ask the user of the program for a number, which function should you use? In the following code, we create a circle & add it to the screen. What is the meaning of the x variable? var x = 20; var circle = new Circle(x); add(circle);

To repeat something a fixed number of times. Both readInt and readFloat are for numbers. Radius of the circle.

After the following code runs, what is the value of isWeekend? var isSaturday = true; var isSunday = false; var isWeekend = isSaturday || isSunday; What kind of statement allows us to run a block code only if a certain condition is true? What kind of statement allows us to run one block of code if one condition is true, & a separate block of code otherwise?

True. If Statement. If/else statement.

What does URL stand for? Which of the following statements are true about styling your web pages with CSS: I. Styling with CSS is more scalable than using style= on each HTML tag that you want to style II. You can create styles with CSS that are not possible using style= on an HTML tag

Uniform Resource Locator. I only.

A group of scientists has developed a simulation that simulates traffic in a city based on several factors. Which of the following statements is most likely something that can be learned from this simulation? What is data abstraction? What is the number base of the binary number system? In the binary value 1002, what is the place value of the 1? What is the value of 1310 in binary? How many bits are used to encode a character according to the ASCII encoding scheme?

Which roads need maintenance. Process of simplifying complicated data. 2. 4s place. 1101↓2. 8 bits.

Which of the following successfully switches the values of the variables x & y? Temp may be used as a temporary variable if necessary. Which of the following is an example of metadata about a webpage? Why do we use CSS?

temp = x; x = y; y = temp; The title of the webpage. Allows us to add style, separate content, & modify.

What is the domain of this URL: www.example.com/home.html Which of the following best describes the difference between the domain & path of a URL?

www.example.com. Domain specifies where the browser's request should be sent. Path specifies exactly what file is being requested.


Ensembles d'études connexes

UNIT 4: Formation of a Valid Contract

View Set

Anatomy and Physiology Chapter 1

View Set

Personal Financial Literacy: Unit 3

View Set

URI Econ 201 Final Study Questions

View Set

Why Atmosphere is Important and Composition of Earth

View Set