apscp final

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

displays true if x is negative and displays nothing otherwise.

procedure mystery y << x< 0 if y display y

The song was saved using fewer bits per second than the original song.

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?

Do the movement patterns of the animal vary according to the weather?

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?

Creating the negative of an image by creating a new RGB triplet for each pixel in which each value is calculated by subtracting the original value from 255. The negative of an image is reversed from the original; light areas appear dark, and colors are reversed.

Digital images are often represented by the red, green, and blue values (an RGB triplet) of each individual pixel in the image. A photographer is manipulating a digital image and overwriting the original image. Which of the following describes a lossless transformation of the digital image?

8

A sorted list of numbers contains 200 elements. Which of the following is closest to the maximum number of list elements that will need to be examined when performing a binary search for a particular value in the list?

different countries may organize data in different ways

A team of researchers wants to create a program to analyze the amount of pollution reported in roughly 3,000 counties across the United States. The program is intended to combine county data sets and then process the data. Which of the following is most likely to be a challenge in creating the program?

users might enter abbreviations for the names of the cities and users might misspell the name of the city

A student is creating a Web site that is intended to display information about a city based on a city name that a user enters in a text field. Which of the following are likely to be challenges associated with processing city names that users might provide as input?

2^32 times as many values can be represented

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?

1, 2 and 3

For which of the following lists can a binary search be used to search for an item in the list? ["blue", "green", "jade", "mauve", "pink"] [5, 5, 5, 5, 6, 7, 8, 8, 8] [10, 5, 3, 2, -4, -8, -9, -12]

prints all positive odd integers that are less than or equal to the max

PROCEDURE printNums (max) count << 1 REPEAT UNTIL (count > max) DISPLAY (count) count << count + 2 which of the following is the most appropriate documentation to appear with. the printNums procedure?

An overflow error will occur because 4 bits is not large enough to represent 29, the sum of14 and 15.

A certain programming language uses 4-bit binary sequences to represent nonnegative integers. For example, the binary sequence 0101 represents the corresponding decimal value 5. Using this programming language, a programmer attempts to add the decimal values 14 and 15 and assign the sum to the variable total. Which of the following best describes the result of this operation?

how many programming statements the program contains

A programmer is writing a program that is intended to be able to process large amounts of data. Which of the following considerations is LEAST likely to affect the ability of the program to process larger data sets?

The remainder when dividing a whole number by 2, and the value of a Boolean variable

Which of the following can be represented by a single binary digit?

technology companies can spend less effort developing new processors because processing speed will always improve at the observed rate

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?

Determining the likelihood that the photo was taken at a particular public event

A digital photo file contains data representing the level of red, green, and blue for each pixel in the photo. The file also contains metadata that describes the date and geographic location where the photo was taken. For which of the following goals would analyzing the metadata be more appropriate than analyzing the data?

Step 3: Increase the value of position by 1. Step 4: Repeat steps 2 and 3 until the value ofposition is greater than n.

A list of numbers has n elements, indexed from 1 to n. The following algorithm is intended to display the number of elements in the list that have a value greater than100. The algorithm uses the variables count and position. Steps 3 and 4 are missing. Step 1: Set count to 0 and position to 1. Step 2: If the value of the element at index position is greater than 100, increase the value of count by 1. Step 3: (missing step) Step 4: (missing step) Step 5: Display the value of count. Which of the following could be used to replace steps 3 and 4 so that the algorithm works as intended?

the cost of a food item available for order

A student is creating an application that allows customers to order food for delivery from a local restaurant. Which of the following is LEAST likely to be an input provided by a customer using the application?

Step 1: Assign each student a unique integer from 1 to 30. Step 2: Generate a random integer n from 1 to 30. Step 3: Select the student who is currently assigned integer n and display the student's name. Step 4: The student who was selected in the previous step is assigned 0. All other students are reassigned a unique integer from 1 to 29. Step 5: Generate a new random integer n from 1 to 29. Step 6: Select the student who is currently assigned integer n and display the student's name.

A teacher has a goal of displaying the names of 2 students selected at random from a group of 30 students in a classroom. Any possible pair of students should be equally likely to be selected. Which of the following algorithms can be used to accomplish the teacher's goal?

1 and 2 only

A user who is organizing a meal with a group selects all the members of the group from the user's contact list. The application then recommends one or more nearby restaurants based on whether the restaurant can accommodate all of the group members' allergies and dietary restrictions. Suppose that Alejandra is using DineOutHelper to organize a meal with Brandon and Cynthia. Which of the following data are needed for DineOutHelper to recommend a restaurant for the group? Each group member's list of food allergies or dietary restrictions Alejandra's geographic location The usernames of the people on Brandon and Cynthia's contact lists

3

A user who is organizing a meal with a group selects all the members of the group from the user's contact list. The application then recommends one or more nearby restaurants based on whether the restaurant can accommodate all of the group members' allergies and dietary restrictions. Suppose that Alejandra is using DineOutHelper to organize a meal with Brandon and Cynthia. Which of the following data is not provided by Alejandra but is necessary for DineOutHelper to recommend a restaurant for the group? Brandon's contact list Information about which restaurants Brandon and Cynthia have visited in the past Information about which food allergies and dietary restrictions can be accommodated at different restaurants near Alejandra

Four bits are enough to store the eight directions.

A video game character can face toward one of four directions: north, south, east, and west. Each direction is stored in memory as a sequence of four bits. A new version of the game is created in which the character can face toward one of eight directions, adding northwest, northeast, southwest, and southeast to the original four possibilities. Which of the following statements is true about how the eight directions must be stored in memory?

J

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 ?

2 times as many items can be uniquely identified.

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?

numberOfAbsences = 5, gradePointAverage = 3.8

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?

9

Consider the 4-bit binary numbers 0011, 0110, and 1111. Which of the following decimal values is NOT equal to one of these binary numbers?

Decimal 5, binary 1011, decimal 12, binary 1101

Consider the following numeric values. Binary 1011 Binary 1101 Decimal 5 Decimal 12 Which of the following lists the values in order from least to greatest?

1001 0100

Each student that enrolls at a school is assigned a unique ID number, which is stored as a binary number. The ID numbers increase sequentially by 1 with each newly enrolled student. If the ID number assigned to the last student who enrolled was the binary number 1001 0011, what binary number will be assigned to the next student who enrolls?

Finding the fastest route that visits every location among nlocations, which requires n! possible routes be examined.

For which of the following situations would it be best to use a heuristic in order to find a solution that runs in a reasonable amount of time?

IF(score < 50) { bonus ← 0 } ELSE { IF(score > 100) { bonus ← score * 10 } ELSE { bonus ← score } } and IF(score > 100) { bonus ← score * 10 } ELSE { IF(score ≥ 50) { bonus ← score } ELSE { bonus ← 0 } }

In a certain game, the integer variable bonus is assigned a value based on the value of the integer variable score. If score is greater than 100, bonus is assigned a value that is 10 timesscore. If score is between 50 and 100 inclusive, bonus is assigned the value ofscore. If score is less than 50, bonus is assigned a value of 0. Which of the following code segments assigns bonus correctly for all possible integer values of score ?

Displays the value of (x + y) / x.The value of the parameter x must not be 0.

PROCEDURE calculate (x,y) result << x +y result << result/x DISPLAY result which of the following is the most appropriate documentation to appear with the calculate procedure?

1 and 3

Some programming languages use constants, which are variables that are initialized at the beginning of a program and never changed. Which of the following are good uses for a constant?I. To represent the mathematical value π (pi) as 3.14II. To represent the current score in a gameIII. To represent a known value such as the number of days in a week

The position of the runner is sampled at regular intervals to approximate the real-word position, and a sequence of bits is used to represent each sample.

The position of a runner in a race is a type of analog data. The runner's position is tracked using sensors. Which of the following best describes how the position of the runner is represented digitally?

Having all three students write code independently and then having one student combine the code into a program

Three students in different locations are collaborating on the development of an application. Which of the following strategies is LEAST likely to facilitate collaboration among the students?

(overallGPA ≥ 3.0) AND (scienceGPA > 3.2)

To qualify for a particular scholarship, a student must have an overall grade point average of 3.0 or above and must have a science grade point average of over 3.2. Let overallGPA represent a student's overall grade point average and let scienceGPA represent the student's science grade point average. Which of the following expressions evaluates totrue if the student is eligible for the scholarship and evaluates to false otherwise?

newList << Combine (list1, list2) newList << Sort (newList) newList << RemoveDuplicates (newList)

Two lists, list1 and list2, contain the names of books found in two different collections. A librarian wants to create newList, which will contain the names of all books found in either list, in alphabetical order, with duplicate entries removed. For example, if list1 contains ["Macbeth", "Frankenstein", "Jane Eyre"] and list2 contains ["Frankenstein", "Dracula", "Macbeth", "Hamlet"], then newList will contain ["Dracula", "Frankenstein", "Hamlet", "Jane Eyre", "Macbeth"]. The following procedures are available to create newList. Which of the following code segments will correctly create newList?

Procedural abstraction provides an opportunity to give a name to a block of code that describes the purpose of the code block and procedural abstraction makes it easier for people to read computer programs.

Which of the following are benefits of procedural abstraction?

1, 2, and 3

Which of the following are true statements about the data that can be represented using binary sequences? Binary sequences can be used to represent strings of characters. Binary sequences can be used to represent colors. Binary sequences can be used to represent audio recordings.

A lossless compression algorithm can guarantee reconstruction of original data, while a lossy compression algorithm cannot.

Which of the following is an advantage of a lossless compression algorithm over a lossy compression algorithm?

The code segment displays the value of 2(53) by initializing result to 2 and then multiplying result by 5 a total of three times.

result << 2 repeat 3 times result << result x 5 display result

Returns a copy of numList with the elements at indices j and k interchanged.The values of j and k must both be between 1 andLENGTH(numList), inclusive.

In the following procedure, the parameter numList is a list of numbers and the parameters j and k are integers. PROCEDURE swapListElements(numList, j, k) { newList ← numList newList[j] ← numList[k] newList[k] ← numList[j] RETURN(newList) } Which of the following is the most appropriate documentation to appear with the swapListElements procedure?

The total number of items purchased on a given date can be determined by searching the data for all transactions that occurred on the given date and then adding the number of items purchased for each matching transaction.

The owner of a clothing store records the following information for each transaction made at the store during a 7-day period. The date of the transaction The method of payment used in the transaction The number of items purchased in the transaction The total amount of the transaction, in dollars Customers can pay for purchases using cash, check, a debit card, or a credit card. Using only the data collected during the 7-day period, which of the following statements is true?

number

The variable age is to be used to represent a person's age, in years. Which of the following is the most appropriate data type for age ?

code segment iterates through myList, comparing each element to all subsequent elements in the list.

contains duplicates << false REPEAT UNTIL ( j > myList -1) k << j+1 REPEAT UNTIL ( k > LENGTH myList) IF (myList(j) = myList(k) containsDuplicates << true k << k + 1 j << j + 1 DISPLAY containsDuplicates

The conclusion is incorrect; using the test case [0, 1, 4, 5] is not sufficient to conclude the program is correct.

sum << numList [1] FOR EACH value IN numList sum << sum + value DISPLAY sum In order to test the program, the programmer initializes numList to [0, 1, 4, 5]. The program displays 10, and the programmer concludes that the program works as intended. Which of the following is true?


Ensembles d'études connexes

The Heart Part 1- Chambers and Valves

View Set

Capstone ClassMarker TCOLE Practice Test

View Set

JS Arrays, Modern JavaScript & a little TypeScript Execute Program

View Set

Chapter 2 - Sets and Venn diagrams

View Set

RPA 2 - Ch. 3 Keogh & Small Employer Plans

View Set

Normal Distributions and Z-Score

View Set

Floral; Chapter 19; History of Floral Design

View Set