ap comp sci unit 1

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Consider the following code segment, which uses the variables r, s, and t. r ← 1 s ← 2 t ← 3 r ← s s ← t DISPLAY (r) DISPLAY (s) What is displayed as a result of running the code segment?

2 3

What is the value of result after running the program?

3y

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.

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 of the following best describes the behavior of the two programs?

Both program I and program II display the correct sum.

An author is considering publishing an e-book using a Creative Commons license. In which of the following situations would it be better for the author to use a Creative Commons license instead of a traditional copyright? The author wants to make the e-book available as a free download. The author wants to prevent people from sharing copies of the e-book on peer-to-peer networks. The author wants to allow people permission to use and modify the e-book.

I and III

The programmer wants to reduce the number of operations that are performed when the program is run. Which change will result in a correct program with a reduced number of operations performed?

Interchanging line 7 and line 8

What is displayed as a result of running the program?

November

A program is expressed in a programming language. Which of the following is true of the program?

The program can also be expressed as binary code, but will be more easily understood by humans when expressed in a higher-level programming language.

An online store uses 6-bit binary sequences to identify each unique item for sale. The store plans to increase the number of items it sells and is considering using 7-bit binary sequences. Which of the following best describes the result of using 7-bit sequences instead of 6-bit sequences?

2 times as many items can be uniquely identified.

A flowchart is a way to visually represent an algorithm. The flowchart below uses the following building blocks.

5

A programmer completes the user manual for a video game she has developed and realizes she has 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."

Both online newspapers and social media sites are used to distribute information on the Internet. Which of the following best describes an advantage that online newspapers have over social media sites?

The ability to provide credibility to the information distributed

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

The elevator moves when the door is closed and the elevator is called to the floor that it is not currently on. Which of the following Boolean expressions can be used in a selection statement to cause the elevator to move?

(onFloor1 AND callTo2) OR (onFloor2 AND callTo1)


Kaugnay na mga set ng pag-aaral

What Events occurred after the victory at Trenton

View Set

Chapter 2: Beginnings of English America, 1607-1660

View Set

Enzymes and hormones of the digestive System

View Set

Chapter 5: Price Controls and Quotas: Meddling with Markets

View Set

What Are Natural Resources? Practice - 100%

View Set