AP CompSci Midterm

Ace your homework & exams now with Quizwiz!

3

"You win!" never displays. What line is responsible for this error?

Yes a computer can evaluate expressions to something between true and false. They can also answer "maybe" depending on the variables and code put in.

Can a computer evaluate an expression to something between true and false? Can you write an expression to deal with a "maybe" answer?

affects the sequential flow of control by executing different statements based on the value of a Boolean expression

Choose the correct definition for Conditional Statement

HTTP and the World Wide Web both rely on other layers of protocols for sending information on the Internet The World Wide Web is a collection of pages and files that is shared between computers using HTTP

Choose the two statements that best describe the relationship between HTTP and the World Wide Web

9

Convert the binary (base-2) number 1001 to decimal (base-10).

10100

Convert the decimal (base-10) number 20 to binary (base-2).

Sequential programs work step by step and event-driven programs are interactive.

What is the difference between a sequential program and an event-driven program?

16

What number will be output by the console.log command on line 5?

35

What number will be output by the console.log command on line 5?

100

What number will be output by the console.log command on line 7?

30 or more

What text will be output by the program?

Output D

What text will be output by the program?

blue

What will the "background-color" of the "topButton" be when the program is finished running?

The score is: 4

What will the value of score be at the end of the program? Note: <- is used to represent a left facing arrow

I don't think this statement is always true because it can represent a different number in a different program.

"The binary pattern 01000001 represents the number 65." Write a brief response explaining whether you believe this statement is always true. Explain your reasoning.

Redundant networks are more reliable

An Internet Service Provider (ISP) is a company that builds the routers and wired connections that allow individuals to access the Internet. An ISP is considering adding additional redundant connections to its network. Which of the following best describes why the company would choose to do so?

Lossless compression occured, meaning that the words you used multiple times are combined together to not take up as much space.

An author is preparing to send their book to a publisher as an email attachment. The file on their computer is 1000 bytes. When they attach the file to their email, it shows as 750 bytes. The author gets very upset because they are concerned that part of their book has been deleted by the email address. If you could talk to this author, how would you explain what is happening to their book?

The IP address makes it easier for devices to connect and communicate on the internet because the devices can sense there is something nearby to connect to.

Describe how the Internet Protocol (IP) allows devices to easily connect and communicate on the Internet.

Depending on the sampling size it makes the picture more clear, depending on the RGB pixels you can have more or less shades to work with, and then the binary sequences make the image actually appear.

Describe how the process of sampling, RGB pixels, and binary sequences work together to display a digital color image.

One path would be going from A to E to C to D. Another path would be going from A to B to D.

Describe two different paths that a message could take from Person A to Person D

The amount increases

Each time we add another bit, what happens to the amount of numbers we can make?

The packets may arrive out of order

Emilee is watching an online video. The video is being sent to her laptop by a server over the Internet which splits the video into packets and sends them in the order they appear in the video. Which of the following is true about how the packets will arrive at her computer?

Creative Commons license is different from regular copy right because it's more loose and allows the owner to give out their art for others to use.

How is a Creative Commons license different from a regular copyright?

6

How many bits would be needed to count all of the students in class today?

256

How many total numbers can be represented with an 8-bit binary (base-2) system?

It's a pattern of numbers that can have a certain amount of shapes and places.

How would you explain a number system to someone who had never seen numbers before?

blue

If the user does NOT click the button what color will "topButton" be when this program finishes running?

investigating and reflecting

In which of the following stages of the development process is a team MOST likely to interview a potential user of an app?

A single direct connection is established between any two devices connected to the Internet

Jesse purchases a new smartphone and is immediately able to use it to send a photo over the Internet to a friend who lives in a different country. Which of the following is NOT necessary to make this possible?

Input - The user clicks a button Output - A song is played User Interface - A screen with buttons, images, and text

Match term with the example

Programming language is very specific while natural language isn't specific and has tons of different meanings.

What is the difference between a programming language and natural (every-day) language?

It is possible that the data travels through any of the devices in the network before arriving at device E

This diagram shows a number of computing devices connected to the Internet with each line representing a direct connection. Device A is attempting to send data over the Internet to Device E. Which of the following is true of how the data will travel through the network?

3

This diagram shows a number of computing devices connected to the Internet with each line representing a direct connection. What is the MINIMUM number of paths that would need to be broken to prevent Computing Device A from connecting with Computing Device E?

checkWin

This function chooses the screen to display based on the score. What is the correct way to call this function?

fault-tolerance

Two devices are connected to the Internet and communicating with one another. A squirrel chews through one of the wires in the network that is currently being used by the devices to communicate. The network immediately begins using a different path through the network and communication continues as normal. This situation best exemplifies which principle?

The benefits of building redundancy into a network is that is decreases the risk of network failure, if one server fails to transfer the information the backup server will take the charge to continue it. Potential issues with it are denial of service and cyber attacks.

What are the benefits of building redundancy into a network? What are the potential issues with building redundancy?

The binary system uses only two digits (1 and 0) and the decimal system uses ten digits (0 through 9).

What are the similarities and differences between the binary and decimal systems?

The most specific case first means the most selective part of the if-else-if statement or the case that will help determine the cases of the others. It's important to put the most specific case first because the computer runs code from top to bottom and if the most selective part is anywhere but the top then this will create massive bugs.

When creating an if-else-if statement you should always make your first condition the most specific. Write a short paragraph responding to the questions below. -What does it mean to put the most specific case first? -Why is it important to put the most specific case first? What types of errors does it help avoid?

num1 == num2

When this function is called, the smaller of two numbers is displayed. What Boolean expression would not work in line 12 in order to accomplish this goal?

No because there are infinite amounts of bits that can be used.

When using bits to represent fractions of a number, can you create all possible fractions? Why or why not?

The photo is a digital representation of the analog painting

When visiting a museum Lian takes a photo of a painting with a smartphone which stores the photo as an image file. Which of the following best describes the differences between the painting itself and the photo of the painting stored on the smartphone?

Line 2

Which line of code in this program is MOST likely to result in an error?

In sequential programming commands run in the order they are written. In event-driven programming some commands run in response to user interactions or other events.

Which of the following BEST describes the differences between sequential and event-driven programming?

Transmission Control Protocol (TCP)

Which of the following Internet protocols is MOST important in reassembling packets and requesting missing packets to form complete messages?

HyperText Transfer Protocol (HTTP)

Which of the following Internet protocols is used to request and send pages and files on the World Wide Web?

A computer represents data as bits which is either a 0 or a 1

Which of the following best describes how computing devices represent information?

The protocols of the Internet are open and used by all devices connected to the network

Which of the following best describes the protocols used on the Internet?

Describing the requirements for how a program will work or users will interact with it

Which of the following best describes the purpose of a design specification?

IP addresses provide a unique number for identifying devices that send and receive information on the Internet

Which of the following best describes the purpose of an IP address?

11000000

Which of the following binary (base-2) numbers is LARGEST?

People from some racial or ethnic groups have unequal access to computing technology.

Which of the following is MOST likely to be an outcome of the digital divide?

Comments enable programmers to track their work throughout the development process

Which of the following is NOT a reason to include comments in programs

Common abstractions that are represented by computing devices include numbers, characters, and color.

Which of the following is NOT true of how computers represent complex information?

Functions are called once but can be declared many times

Which of the following is true of functions?

With a fixed number of bits some numbers are too large to represent in a computer which will lead to overflow errors.

Which of the following is true of how computers represent numbers?

Packet metadata is used to route and reassemble information travelling through the Internet

Which of the following is true of how packets are sent through the Internet?

The protocols of the Internet were designed to scale as new devices are added

Which of the following is true of how the Internet has responded to the increasing number of devices now using the network?

B. Lossy compression algorithms are typically better than lossless compression algorithms at reducing the number of bits needed to represent a piece of data.

Which of the following is true of lossy and lossless compression algorithms?

Information does not travel in one piece, but rather as a datastream of packets.

Which of the following is true regarding the way information is transmitted on the Internet?

A. A state makes voter registration forms available only by visiting a government website

Which of the following situations is most likely to cause issues arising from the digital divide?

So when we start coding, we know what parts of the app we are editing.

Why is it important for element IDs to have meaningful names?

Text messages and music are best compressed with lossless compression. Images and videos are best compressed using lossy compression.

You've been given a new cell phone with a 2 gigabyte data plan. You plan to use your phone for text messages, images, video, and music. Which of these categories are best compressed using lossless compression? Which of these categories are best compressed using lossy compression? Why?

The pixelation widget only goes to 255x255 pixels, so maybe a sample size around there to get the best digital representation.

Your computer science teacher asks you to sample a black and white image that is 4" x 6". How would you sample the image to provide a good digital approximation using the pixelation widget? What sample size would you use? How would your decision affect the digital representation?

16

Your computer uses 4 bits to represent decimal numbers (0, 1, 2, 3 and so on) in binary. What is the SMALLEST number for which an overflow error occurs?

a b c b c

hat will be the order of letters printed to the console when this program is run?


Related study sets

Cell Transport/Enzymes Honors Biology Test 2022

View Set

Texas Life and Health: Taxes, Retirement, and Other Insurance Concepts

View Set

Chapter 44: The Child With Cancer ?s

View Set

Gastritis, PUD, GI CA, Bariatric sx

View Set

Hesi questions (random) fundamentals

View Set