Algorithms and Data Structures, Exams of Nursing

Various algorithms and data structures, including techniques for swapping values, searching over data sets, using boolean expressions in selection statements, and analyzing the behavior of programming procedures. It covers topics such as migration patterns of birds, online voting, and the benefits of high-level programming languages over low-level languages. The document also explores concepts related to computer networking, data compression, and cybersecurity risks. Overall, the document provides insights into fundamental computer science principles and their practical applications.

Typology: Exams

2023/2024

Available from 08/13/2024

answerhub
answerhub 🇺🇸

4

(16)

5.4K documents

1 / 76

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
APCSP AP EXAM 2024/2025 WITH 100%
ACCURATE SOLUTIONS
We want to create an algorithm called swapValues. Given two
variables x and y the result should have the values of x and y
swapped. Which of the following algorithms correctly swaps the
values of x and y?
y ← x
temp ← x
x ← y
x ← y
y ← x
temp ← x
x ← y
y ← temp
temp ← x
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c

Partial preview of the text

Download Algorithms and Data Structures and more Exams Nursing in PDF only on Docsity!

APCSP AP EXAM 2024/2025 WITH 100%

ACCURATE SOLUTIONS

We want to create an algorithm called swapValues. Given two variables x and y the result should have the values of x and y swapped. Which of the following algorithms correctly swaps the values of x and y? y ← x temp ← x x ← y x ← y y ← x temp ← x x ← y y ← temp temp ← x

y ← temp y ← x - Precise Answer ✔✔temp ← x x ← y y ← temp The figure below represents a network of physically linked computers labeled A through F. A line between two computers indicates that the computers can communicate directly with each other. Any information sent between two computers that are not directly connected must go through at least one other computer. For example, information can be sent directly between computers A and B, but information sent between computers A and C must go through other computers. Which of the following statements are true about this network: I - The network is fault tolerant. If a single connection fails, any two devices can still communicate. II - Computers B and F need to first communicate with at least one other device in order to communicate with each other. I only

A music application searching over a user's library to determine if a particular song exists An online retail store analyzing customers' viewing habits to suggest other products based on the purchasing history of other customers - Precise Answer ✔✔An online retail store analyzing customers' viewing habits to suggest other products based on the purchasing history of other customers A bank uses a computer program during the night to tell if the alarm should be rung. Sensors in the bank set the following Boolean variables: vaultClosed: set to true if the bank vault is closed; otherwise false heardNoise: set to true if a microphone heard noise; otherwise false sawMovement: set to true if a camera saw movement in the bank; otherwise false

The automatic alarm should notify the police if there is noise and movement in the bank, or if the bank vault is open. Which of the following boolean expressions can be used in a selection statement to ring the alarm? NOT vaultClosed OR (heardNoise AND sawMovement) heardNoise AND vaultClosed NOT vaultClosed AND sawMovement heardNoise AND sawMovement - Precise Answer ✔✔NOT vaultClosed OR (heardNoise AND sawMovement) Consider the code segment below. PROCEDURE Mystery (word, list) {

Display the index of word in list - Precise Answer ✔✔Return whether or not word is in list Biologists are researching the migration patterns of birds. They have attached tracking collars to several wild birds. For each bird, the following geolocation data is collected at frequent intervals. The time The date The location of the bird Which of the following questions about the group of tracked birds COULD be answered using only the data collected from the tracking collars? How many new birds were born into the group during the month of July? In what month do the birds tend to travel the farthest?

Do the migration patterns of the birds vary according to weather? What is the most common cause of death for this group of birds? q - Precise Answer ✔✔ 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 this increases the likelihood of errors The program can also be expressed as binary code, which is what the program will be translated to in order to execute on the computer The program cannot be expressed as binary code

How many states have computer science as the most common major for female students? Do students attending college in the United States tend to have higher grade point averages than students in other countries? Which state has the highest graduation rate for computer science majors? - Precise Answer ✔✔How many states have computer science as the most common major for female students? The figure below represents a network of physically linked computers labeled A through F. A line between two computers indicates that the computers can communicate directly with each other. Any information sent between two computers that are not directly connected must go through at least one other computer. For example, information can be sent directly between computers A and B, but information sent between computers A and C must go through other computers. What is the minimum number of connections that must be broken or removed in the network before computer E can no longer communicate with computer F?

4 - Precise Answer ✔✔ 2 A city government is attempting to reduce the digital divide between groups with differing access to computing and the Internet. Which of the following actions is MOST likely to be effective in this purpose? Providing a way for citizens to vote online in local elections

Which of the following will NOT affect the results when the code segment is executed? Switching line 3 and line 7 Change line 3 to x ← y Remove the else statement and run line 7 no matter what Change line 3 to x ← -1 * y + x - Precise Answer ✔✔Change line 3 to x ← y Which of the following programs is most likely to benefit from the use of a heuristic? A program that determines whether or not a given number exists in a list

A program that sorts a list of numbers from least to greatest A program that counts the number of characters in an essay A program that computes the best move to play in a board game

  • Precise Answer ✔✔A program that computes the best move to play in a board game Which of the following statements are true about using a high- level programming language instead of a lower-level language? I - Some algorithms can only be expressed in low-level languages, and cannot be expressed in any high-level languages II - Code in a high-level language is often translated into code in a lower-level language to be executed on a computer I only

Users in a certain location may no longer be able to access the Website The Website may be able to provide content to its users that is relevant to their location - Precise Answer ✔✔Users in a certain location may no longer be able to access the Website According to the domain name system (DNS), which of the following is a subdomain of the domain test.com? test.gov test.co.edu test.com.biz info.test.com - Precise Answer ✔✔info.test.com

In the program below, the initial value of a is 0 and the initial value of b is 1. IF (b = 0) { IF (b = 1) { DISPLAY ("Karel") } } ELSE { IF (a = 1) { DISPLAY ("Tracy") } ELSE { DISPLAY ("Dog") }

length ← LENGTH (list) i ← 1 REPEAT length TIMES { if (list[i] = target) { REMOVE(list, i) } ELSE { i ← i + 1 } } RETURN (list) } This procedure returns the list without the first instance of the given target This procedure returns the list without any instance of the given target

This procedure returns the list where each instance of the given target is replaced by the index. This procedure returns the number of times the target appears in the list - Precise Answer ✔✔This procedure returns the list without any instance of the given target Given the following algorithms, which one uses selection? Given a list of integers, display the length of the list. Given two numbers display the larger of the two. Given two numbers display the average of the two.