UNIT 4: Javascript Control Structures AP Classroom Qs

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

II & III [actual D]

A numeric test score is to be converted to a letter grade of A, B, or C according to the following rules: A score greater than 90 is considered an A; a score between 80 and 90, inclusive, is considered a B; and any other score is considered a C. Which of the following code segments will assign the correct letter grade to grade based on the value of the variable score ? II, I & II, I & III, OR II & III

7 [actual C]

A store uses binary numbers to assign a unique binary sequence to each item in its inventory. What is the minimum number of bits required for each binary sequence if the store has between 75 and 100 items in its inventory? 5, 6, 7, or 8

I & III [actual B]

Assume that the variables alpha and beta each are initialized with a numeric value. Which of the following code segments can be used to interchange the values of alpha and beta using the temporary variable temp ? I & II, I & III, II & III, OR I & II & III

C [actual D]

Consider a game in which a player flips a fair coin three times. If all three coin flips have the same result (either all heads or all tails) the player wins. Otherwise, the player loses. Which of the following code segments best simulates the behavior of the game? A, B, or C

spin<- RANDOM (1, 4) [actual B]

Consider a game where a player spins a wheel divided into four identical sections, labeled A, B, C, and D. If the player spins A, the score is 10. If the player spins B, the score is 5. If the player spins C or D, the score is -1. The following code segment is intended to implement the game. Which of the following could be used as a replacement for <MISSING STATEMENT> so the code segment works as intended? spin<- RANDOM (1, 3) spin<- RANDOM (1, 4) spin<- RANDOM (1, 6) spin<- RANDOM (1, 8)

9 [actual C]

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? 3, 6, 9, or 15

first = 100, second = 100 [actual A]

What are the values of first and second as a result of executing the code segment? first = 100, second = 100 first = 100, second = 200 first = 200, second = 100 first = 200, second = 200

C

Which of the following is NOT a benefit of collaborating to develop a computing innovation? A, B, or C

ivory [actual A]

A color in a computing application is represented by an RGB triplet that describes the amount of red, green, and blue, respectively, used to create the desired color. A selection of colors and their corresponding RGB triplets are shown in the following table. Each value is represented in decimal (base 10). According to information in the table, what color is represented by the binary RGB triplet (11111111, 11111111, 11110000) ? Ivory, light yellow, neutral grey, or vivid yellow

B (only image without a grey box above the triangle)

A gray square represents a possible final location of the robot after the code segment is executed. Which of the following represents all possible final locations for the robot?

C

Which of the following activities poses the greatest personal cybersecurity risk? A, B, OR C

A

Which of the following best exemplifies the use of keylogging to gain unauthorized access to a computer system? A, B, OR C

C

Which of the following best exemplifies the use of multifactor authentication to protect an online banking system? A, B, OR C

B

Which of the following best explains how an analog audio signal is typically represented by a computer? A, B, or C

C [actual D]

Which of the following code segments can be used to interchange the values of the variables num1 and num2 ? A, B, or C

3 [actual C]

Which of the following initial values of the variable y would result in the variable z being set to 2 after the code segment is executed? 1, 2, 3, OR 4

x & z [actual C]

Which of the variables have the value 50 after executing the code segment? x, y, x & z, OR x & y & z

C

An algorithm is intended to display the following output. red red blue red red blue red red blue Which of the following code segments can be used to display the intended output? A, B, or C

B

An individual receives an e-mail that appears to be from an insurance company. The message offers a low insurance rate, and prompts the recipient to click a link to learn more. Which of the following is most indicative that the e-mail is part of a phishing attempt? A, B, OR C

B

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? A, B, or C

B and C

Directions: For the question or incomplete statement below, two of the suggested answers are correct. For this question, you must select both correct choices to earn credit. No partial credit will be earned if only one correct choice is selected. Select the two that are best in each case. Which of the following can be represented by a single binary digit? Select two answers. A, B, and/or C

A

Directions: The question or incomplete statement below is followed by four suggested answers or completions. Select the one that is best in each case. A student is writing a program to model different real-world events using simulations. Which of the following simulations will generate a result that would best be stored using a Boolean variable? A, B, or C

3 4 [actual C]

Directions: The question or incomplete statement below is followed by four suggested answers or completions. Select the one that is best in each case. Consider the following program, which uses the variables , , and ... What is displayed as a result of executing the program? 1 3, 3 3, 3 4, or 4 4

A

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? A, B, or C

A and D

In a certain video game, the variable maxPS represents the maximum possible score a player can earn. The maximum possible score depends on the time it takes the player to complete the game. The value of maxPS should be 30 if time is greater than 120 and 50 otherwise. Which of the following code segments correctly sets the value of maxPS based on the value of time ? Select two answers. A, B, C, and/or D

C [actual D]

In the following code segment, score and penalty are initially positive integers. The code segment is intended to reduce the value of score by penalty. However, if doing so would cause score to be negative, score should be assigned the value 0. For example, if score is 20 and penalty is 5, the code segment should set score to 15.If score is 20 and penalty is 30, score should be set to 0. The code segment does not work as intended. Line 1: IF(score - penalty < 0) Line 2: { Line 3: score ←← score - penalty Line 4: } Line 5: ELSE Line 6: { Line 7: score ←← 0 Line 8: } Which of the following changes can be made so that the code segment works as intended? A, B, or C

B

StreamPal is an audio-streaming application for mobile devices that allows users to listen to streaming music and connect with other users who have similar taste in music. After downloading the application, each user creates a username, personal profile, and contact list of friends who also use the application. The application uses the device's GPS unit to track a user's location. Each time a user listens to a song, the user can give it a rating from 0 to 5 stars. The user can access the following features for each song that the user has rated. A list of users on the contact list who have given the song the same rating, with links to those users' profiles A map showing all other users in the area who have given the song the same rating, with links to those users' profiles A basic StreamPal account is free, but it displays advertisements that are based on data collected by the application. For example, if a user listens to a particular artist, the application may display an advertisement for concert tickets the next time the artist comes to the user's city. Users have the ability to pay a monthly fee for a premium account, which removes advertisements from the application. Which of the following is most likely to be a data privacy concern for StreamPal users? A, B, OR C

C

The cost of a customer's electricity bill is based on the number of units of electricity the customer uses. For the first 25 units of electricity, the cost is $5 per unit. For units of electricity after the first 25, the cost is $7 per unit. Which of the following code segments correctly sets the value of the variable cost to the cost, in dollars, of using numUnits units of electricity? A, B, or C

down [actual D]

The player controls in a particular video game are represented by numbers. The controls and their corresponding binary values are shown in the following table. The numeric values for the controls can also be represented in decimal (base 10). What control is represented by the decimal value 15 ? Arrow to... left, right, up, or down

24 [actual C]

The player controls in a particular video game are represented by numbers. The controls and their corresponding binary values are shown in the following table. The numeric values for the controls can also be represented in decimal (base 10). What is the decimal value for the jump control? 3, 12, 24, or 48


Ensembles d'études connexes

Ch. 8 Fundamentals of US Healthcare

View Set

Prophet Muhammad Reaches Out to Arabia and Beyond

View Set

RNSG 1111 Unit 4 Study Set #4 Practice Questions

View Set

Chapter 3 - Book Review & Quiz Questions

View Set

Chapter 16: Allocation of Support-Department Costs, Common Costs, and Revenues

View Set

Practice Exam 1: Missed Questions

View Set

Chapter 1 - 5 Midterm (Windows Admin I)

View Set