First 50 of 200 questions. Each one lists the choices, the correct answer, and an explanation. The checker at the top of this page saves progress in this browser when it is available.
Continue in the practice tool above to load more questions, 50 at a time.
Question 1Big Idea 1: Creative Development
A team is building an app and wants to divide the work into small, testable pieces that each do one job well. Which programming practice best supports this goal?
- Grouping related code into reusable procedures with clear purposes Correct answer.
- Writing one long procedure that handles all tasks in sequence
- Removing all comments so the code is shorter
- Copying the same code into each place it is needed
Explanation
Procedures let programmers package a single well-defined task so it can be reused and tested independently. This modular approach makes programs easier to read, debug, and extend. Copying code and building one giant procedure work against modularity.
Question 2Big Idea 1: Creative Development
Which of the following is the best example of an iterative development process?
- Building the entire app, then testing it once at the very end
- Releasing a small working version, gathering feedback, then improving it Correct answer.
- Writing a complete specification, then never revising it
- Outsourcing all design decisions to a single person upfront
Explanation
Iterative development repeats cycles of building, testing, and refining based on feedback. Each cycle produces a working increment that informs the next round of improvements. One-time testing or a frozen specification does not involve repetition.
Question 3Big Idea 1: Creative Development
A programmer writes a procedure that accepts a list of scores and returns the average. What is the role of the list of scores in this context?
- It is the return value of the procedure
- It is an argument passed into the procedure Correct answer.
- It is the name of the procedure
- It is a global variable defined inside the procedure
Explanation
Values supplied to a procedure when it is called are arguments (also called parameters). The procedure uses these inputs to compute its result. The average, not the list, would be the return value.
Question 4Big Idea 1: Creative Development
Which statement best describes the purpose of a comment in a program?
- It documents the code for human readers without affecting execution Correct answer.
- It changes how the program executes at runtime
- It automatically fixes errors in the surrounding code
- It stores temporary values during computation
Explanation
Comments are notes for people reading the code and are ignored by the interpreter or compiler. They improve readability and maintainability but do not alter program behavior. Temporary storage and error correction are handled by variables and debugging, not comments.
Question 5Big Idea 1: Creative Development
A student uses a library procedure that converts a temperature from Celsius to Fahrenheit instead of writing the conversion manually. What is a primary benefit of this choice?
- It reuses tested code and reduces the chance of introducing errors Correct answer.
- It eliminates the need to pass any arguments
- It removes the need to understand the program's overall logic
- It guarantees the program will run faster than any custom code
Explanation
Reusing a well-tested library procedure saves effort and lowers the risk of bugs compared with hand-writing the same logic. The programmer still must understand how the procedure fits into the program. Performance and argument requirements depend on the procedure, not on reuse alone.
Question 6Big Idea 1: Creative Development
In a program, a variable named total is first set to 0 and later updated inside a loop. What best describes total in this context?
- A procedure that returns a value
- A constant that cannot change value
- A comment describing the computation
- A variable whose value accumulates across iterations Correct answer.
Explanation
A variable is a named storage location whose value can be updated as the program runs. When it is updated inside a loop, it can accumulate a running result. Constants, procedures, and comments are different constructs.
Question 7Big Idea 1: Creative Development
Why is pair programming often used during the development of a program?
- It removes the need for any version control
- It guarantees the program will require no testing later
- It allows two programmers to collaborate so errors are caught and ideas are shared earlier Correct answer.
- It ensures the program uses fewer lines of code than solo work
Explanation
Pair programming pairs a driver and a reviewer so problems are spotted and design ideas exchanged in real time. This collaborative practice improves quality through early feedback. It does not eliminate testing, version control, or guarantee shorter code.
Question 8Big Idea 1: Creative Development
A programmer wants a procedure to compute the largest value in a list and make that value available to the code that called it. Which mechanism should the procedure use?
- Print the value to the screen
- Return the value to the caller Correct answer.
- Store the value in a local variable only
- Add the value to a comment
Explanation
A return statement sends a computed value back to the calling code so it can be used further. Printing only displays the value, and a purely local variable is not accessible outside the procedure. Comments never carry data.
Question 9Big Idea 1: Creative Development
Consider a procedure defined as f(x) that returns x * 2 + 1. What value does f(4) return?
- 5
- 10
- 9 Correct answer.
- 8
Explanation
Substituting x = 4 gives 4 * 2 + 1, which evaluates to 8 + 1 = 9. Multiplication is performed before addition. The other values come from misapplying the operations.
Question 10Big Idea 1: Creative Development
A programmer writes a loop that repeats a block of code as long as a condition remains true. Which concept does this illustrate?
- Sequencing of independent statements
- Iteration through repeated execution Correct answer.
- Abstraction of a complex system
- Parallel execution of procedures
Explanation
Iteration is the repeated execution of a block of code, typically controlled by a loop condition. Sequencing runs statements once in order, and abstraction hides detail rather than repeating actions. Parallel execution is a separate concept.
Question 11Big Idea 1: Creative Development
A team stores their program's source code in a shared repository so each change is recorded and can be reviewed. What practice does this describe?
- Refactoring the code for readability
- Compiling the program to machine code
- Using version control to track changes Correct answer.
- Writing unit tests for each procedure
Explanation
Version control systems record changes to source files, allow review, and let developers revert or merge work. Compilation, testing, and refactoring are distinct activities that may accompany version control but are not the same thing.
Question 12Big Idea 1: Creative Development
A programmer creates a procedure drawSquare(side) that calls a lower-level procedure drawLine(length) four times. What does this illustrate?
- Converting a program into machine code
- Replacing iteration with recursion
- Building a higher-level abstraction from simpler procedures Correct answer.
- Removing the need for any parameters
Explanation
Combining simpler procedures into a more powerful one is a form of abstraction: callers use drawSquare without worrying about the details of drawLine. This does not eliminate parameters, require recursion, or involve compilation.
Question 13Big Idea 1: Creative Development
A program uses a list of student names and needs to determine whether a particular name appears. Which approach best solves the problem?
- Store the target name in a comment
- Sort the list once and then stop
- Compare the target name to each element in the list using a loop Correct answer.
- Print the entire list to the screen
Explanation
Searching a list requires examining its elements, typically with a loop that compares each to the target. Printing or commenting does not perform a comparison. Sorting alone does not answer whether the name is present.
Question 14Big Idea 1: Creative Development
A procedure is meant to return the sum of all elements in a list, but it initializes its running total to 1 instead of 0. What is the most likely effect?
- The procedure returns a value one greater than the true sum Correct answer.
- The procedure returns zero for every list
- The procedure fails to compile
- The procedure returns exactly the true sum
Explanation
A running total should start at the additive identity, 0, so that adding elements yields the true sum. Starting at 1 adds an extra unit to the result. The program can still run and produce values, just an incorrect one.
Question 15Big Idea 1: Creative Development
A programmer notices that the same block of code appears in five different places. Which action best improves the program's design?
- Rename variables in each copy so they differ
- Add comments to each copy of the block
- Move the block into a procedure and call it from each location Correct answer.
- Delete four copies and leave one in place
Explanation
Extracting duplicated code into a single procedure removes redundancy and centralizes future changes. Leaving copies in place, even with comments or varied names, preserves the maintenance burden. Deleting copies without replacing them breaks functionality.
Question 16Big Idea 1: Creative Development
A program's behavior depends on user input that cannot be predicted in advance. Why is testing with several different inputs important?
- It guarantees the program runs in constant time
- It proves the program is correct for every possible input
- It removes the need to handle edge cases
- It reveals how the program behaves across a range of realistic conditions Correct answer.
Explanation
Testing with varied inputs exposes how a program responds to different conditions, including edge cases. Testing can increase confidence but cannot prove correctness for all possible inputs. It also does not affect runtime complexity guarantees.
Question 17Big Idea 1: Creative Development
A procedure is defined to accept two arguments and return their product. A programmer calls it with only one argument. What is the most likely outcome?
- The procedure uses a default value of 1 for the missing argument
- The procedure silently returns zero
- The call produces an error because the required argument is missing Correct answer.
- The second argument is filled from a global variable automatically
Explanation
When a procedure requires a fixed number of arguments, calling it with fewer than expected typically causes an error. Default values and automatic global substitution are not generally provided unless explicitly defined. Silent zero returns are not a standard behavior.
Question 18Big Idea 1: Creative Development
During development, a team keeps a list of known bugs and tracks which ones are fixed. Why is this record useful?
- It replaces the need for version control
- It guarantees no new bugs will appear
- It removes the need to write tests
- It helps prioritize remaining work and verify that fixes are effective Correct answer.
Explanation
A bug list documents outstanding problems so teams can prioritize fixes and confirm resolution. It complements testing and version control rather than replacing them. It cannot prevent new bugs from being introduced.
Question 19Big Idea 1: Creative Development
A programmer writes a procedure that takes a list and returns a new list containing only the even numbers from the original. If the input list is [3, 4, 7, 8, 10], what is the returned list?
- [3, 7]
- [4, 8, 10] Correct answer.
- [3, 4, 7, 8, 10]
- [4, 8]
Explanation
The procedure filters the input, keeping elements divisible by 2. From [3, 4, 7, 8, 10], the even values are 4, 8, and 10. The other options either keep odd values, drop a valid even value, or keep everything.
Question 20Big Idea 1: Creative Development
A program must compute a value that depends on an unknown number of inputs supplied at runtime. Which design choice best supports this?
- Require exactly one input in all cases
- Store inputs in a fixed set of named variables
- Hard-code each possible input into the program
- Write a procedure that processes a list of inputs of any length Correct answer.
Explanation
A procedure that iterates over a list can handle any number of inputs without knowing the count in advance. Hard-coding or fixing the number of variables limits flexibility. Processing a list scales naturally with the input size.
Question 21Big Idea 1: Creative Development
A procedure f calls itself on a smaller version of its input until a base case is reached. What is essential for this procedure to terminate?
- Each recursive call must move closer to a base case that returns without recursing Correct answer.
- The procedure must print its arguments on each call
- The procedure must use a global variable
- The procedure must avoid using any parameters
Explanation
Recursion terminates only when each call reduces the problem toward a base case that stops further calls. Without a reachable base case, the procedure recurses indefinitely. Printing, globals, and the absence of parameters do not ensure termination.
Question 22Big Idea 1: Creative Development
A team wants to compare two algorithms that solve the same problem. Algorithm A's runtime grows proportionally to the number of items, while Algorithm B's runtime grows proportionally to the square of the number of items. Which statement is most accurate?
- Both algorithms have identical growth as input size increases
- Algorithm A will always run faster for every possible input size
- Algorithm A generally scales better as the number of items grows large Correct answer.
- Algorithm B is preferable because it uses fewer lines of code
Explanation
Growth proportional to n increases more slowly than growth proportional to n squared, so Algorithm A generally scales better for large inputs. Small inputs might still favor either algorithm in practice. The comparison is about growth rate, not line count or guaranteed speed for every case.
Question 23Big Idea 1: Creative Development
A programmer claims that because a procedure passed all tests on the sample inputs, it is correct for every possible input. What is the best critique of this claim?
- The claim is valid only if the procedure uses recursion
- The claim is too strong because testing samples inputs and cannot guarantee correctness for all cases Correct answer.
- The claim is valid because passing tests proves correctness
- The claim is invalid because tests should never be used
Explanation
Testing checks behavior on specific inputs and can reveal bugs but cannot prove correctness for all possible inputs. A claim of universal correctness requires reasoning beyond sampled tests. Tests remain a valuable practice even though they are not a proof.
Question 24Big Idea 2: Data
A school stores each student's record as a single JSON object containing name, grade level, and a list of courses. Which term best describes this JSON object?
- A record with fields, one of which holds a list Correct answer.
- A network protocol for transferring files
- A binary file format for images
- A relational table with foreign keys
Explanation
Structured data can be organized as records made of named fields, and a field's value can itself be a list. The JSON object groups related values under field names, matching the definition of a record.
Question 25Big Idea 2: Data
A data set lists the daily high temperatures for a city over one year. Which value is the median?
- The difference between the highest and lowest temperatures
- The most frequently occurring temperature
- The sum of all temperatures divided by 365
- The middle value when all 365 temperatures are ordered Correct answer.
Explanation
The median is the middle value of an ordered data set, so with 365 values it is the 183rd temperature in sorted order. It is a measure of center distinct from mean and mode.
Question 26Big Idea 2: Data
A survey asks 40 students their favorite season. The counts are spring 8, summer 15, fall 10, winter 7. What fraction of responses does summer represent?
- 0.375 Correct answer.
- 0.25
- 0.15
- 0.40
Explanation
Relative frequency is the count for a category divided by the total number of responses. Here 15 divided by 40 equals 0.375, so summer accounts for 37.5 percent of responses.
Question 27Big Idea 2: Data
Which of the following best describes metadata?
- The largest value stored in a data set
- Data that has been encrypted for privacy
- Data that describes other data, such as its format or source Correct answer.
- A copy of a data set kept as a backup
Explanation
Metadata is information about data itself, such as when it was collected, its format, or its units. It helps interpret and manage the underlying data without being the data values themselves.
Question 28Big Idea 2: Data
A researcher wants to know the average height of all students at a large university but can only measure 200 students. Which practice most improves how well the sample represents the population?
- Measuring the first 200 students who enter the cafeteria
- Choosing the 200 tallest students who volunteer
- Selecting the 200 students randomly from the full enrollment Correct answer.
- Measuring 200 students from the basketball team
Explanation
A random sample gives every member of the population a chance to be selected, reducing bias. Convenience or self-selected groups tend to overrepresent particular characteristics.
Question 29Big Idea 2: Data
Which of the following is an example of unstructured data?
- A collection of free-form customer review text Correct answer.
- A spreadsheet of employee salaries by department
- A table of product prices and quantities
- A list of student IDs and grade levels
Explanation
Unstructured data lacks a predefined tabular model, and free-form text is a classic example. Tabular data with consistent fields is structured.
Question 30Big Idea 2: Data
A programmer uses a procedure that takes a list of numbers and returns the largest one. What is the best description of this procedure?
- It converts the list into text
- It filters the list to remove duplicates
- It sorts the list into ascending order
- It computes a summary value from the data Correct answer.
Explanation
Finding the maximum reduces a collection of values to a single summary result. Procedures that extract such aggregate information are common tools for analyzing data.
Question 31Big Idea 2: Data
A data set of test scores contains one value of 1000 while all other scores fall between 40 and 95. What effect does this value have on the mean compared with the median?
- It raises the median more than it raises the mean
- It lowers both the mean and the median equally
- It raises the mean more than it raises the median Correct answer.
- It has no effect on either the mean or the median
Explanation
The mean uses every value, so an extreme outlier pulls it strongly toward that value. The median depends only on position in sorted order, so it shifts little when one value is extreme.
Question 32Big Idea 2: Data
A city publishes a data set of daily bike-share rides. Which question is best answered by analyzing this data set?
- How much a new bicycle costs to manufacture
- Why riders prefer one brand of bicycle
- Which day of the week has the highest average number of rides Correct answer.
- Whether riders enjoy riding in the morning
Explanation
A good data question must be answerable with the variables actually recorded. A data set of ride counts by day supports comparing averages across days of the week.
Question 33Big Idea 2: Data
A data set of 1,000 values is sorted, and a value falls at the 90th percentile. What does this mean?
- The value occurs exactly 90 times
- About 90 percent of the values are less than or equal to it Correct answer.
- The value is 90 units above the mean
- The value is the largest in the data set
Explanation
A percentile describes position relative to the rest of the distribution. The 90th percentile is the value at or below which roughly 90 percent of observations fall.
Question 34Big Idea 2: Data
A cleaning procedure is applied to a data set containing ages recorded as -5, 0, 12, 34, and 999. Which action is most appropriate for handling the -5 and 999 entries?
- Delete the entire data set because it contains errors
- Replace both values with the average of the valid ages
- Flag them as likely errors and investigate before deciding Correct answer.
- Keep both values because all data should be preserved
Explanation
Values that are impossible or implausible for the field signal data-entry or collection problems. Flagging and investigating them lets analysts correct or exclude them with justification rather than guessing.
Question 35Big Idea 2: Data
Two classes take the same test. Class A has a mean of 72 and Class B has a mean of 80. A student concludes that every student in Class B scored higher than every student in Class A. Why is this conclusion invalid?
- Class size must be identical to compare means
- Means cannot be compared between different groups
- A higher mean does not guarantee every value is higher Correct answer.
- The mean of Class B might have been computed incorrectly
Explanation
A mean summarizes a whole group, so overlapping distributions can still have different means. Some students in Class A may have outscored many in Class B.
Question 36Big Idea 2: Data
A data set of customer purchases is stored in two separate tables, one for customers and one for orders, linked by a customer ID. What is the main benefit of this organization?
- It encrypts the order data automatically
- It guarantees the data contains no errors
- It prevents duplicate customer details from being repeated in every order Correct answer.
- It removes the need to back up the tables
Explanation
Linking tables by a shared key avoids storing redundant customer information in each order. This reduces inconsistency and storage while keeping the data connected through the key.
Question 37Big Idea 2: Data
An analyst computes the mean of a data set and finds it equals the median. What can be concluded about the distribution?
- The range of the data set is zero
- The distribution is perfectly symmetric around every value
- The distribution may be roughly symmetric, but other shapes can also produce this Correct answer.
- The data set contains no repeated values
Explanation
When mean and median coincide, the distribution is often approximately symmetric, but this is not a guarantee. Some skewed or irregular distributions can also produce equal mean and median.
Question 38Big Idea 2: Data
A program processes a list of sensor readings and must report how many readings exceed a threshold. Which approach correctly counts them?
- Sum all readings and divide by the threshold
- Report the difference between the largest and smallest readings
- Initialize a counter to zero and add one each time a reading exceeds the threshold Correct answer.
- Sort the readings and report the last value
Explanation
Counting requires a counter that increments once per qualifying element as the list is traversed. This produces the number of readings above the threshold.
Question 39Big Idea 2: Data
A researcher collects data by asking only shoppers at an expensive electronics store about their monthly technology spending. Which concern most directly affects the validity of conclusions?
- The sample is biased toward high spenders Correct answer.
- The data set is too small to compute a mean
- The responses are stored as text rather than numbers
- The survey was conducted during a single month
Explanation
Sampling only from an expensive electronics store overrepresents people likely to spend more on technology. Conclusions drawn from such a biased sample will not generalize to the broader population.
Question 40Big Idea 2: Data
A data set records the number of pets per household: 0, 1, 1, 2, 2, 2, 3, 7. Which statement about the mode is true?
- The mode is 7 because it is the largest value
- The mode is 2 because it appears most often Correct answer.
- There is no mode because values repeat
- The mode is 2.25 because it is the mean
Explanation
The mode is the value that occurs most frequently in the data set. Here 2 appears three times, more than any other value.
Question 41Big Idea 2: Data
A data visualization shows a bar chart where the vertical axis begins at 90 rather than 0. What effect can this have on viewers?
- It makes the chart impossible to interpret
- It makes small differences between bars appear larger than they are Correct answer.
- It converts the chart into a scatter plot
- It guarantees the data are inaccurate
Explanation
A truncated axis compresses the visible range, so modest differences look dramatic. Honest charts usually start bar scales at zero to avoid exaggerating comparisons.
Question 42Big Idea 2: Data
A student wants to compare the distribution of incomes across five neighborhoods, where each neighborhood has many households. Which visualization best shows the spread and center of each group side by side?
- A table listing only each neighborhood's name
- A set of box plots, one per neighborhood Correct answer.
- A single pie chart of all incomes combined
- A line graph of one household over time
Explanation
Box plots display median, quartiles, and range, making them well suited for comparing distributions across groups. Placing one per neighborhood allows direct visual comparison of spread and center.
Question 43Big Idea 2: Data
A data set of 200 values has a mean of 50 and a standard deviation of 2. A second data set also has a mean of 50 but a standard deviation of 10. What does the comparison indicate?
- The second data set has a larger maximum value
- The first data set contains more values
- The two data sets have identical distributions
- The second data set has values more spread out from the mean Correct answer.
Explanation
Standard deviation measures typical distance of values from the mean. A larger standard deviation means the values are more dispersed, even when the means match.
Question 44Big Idea 2: Data
A program must find whether a target value appears in a sorted list of 1,000,000 numbers. Which approach is most efficient in the worst case?
- Repeatedly halving the search range by comparing with the middle element Correct answer.
- Checking each element from the start until the target is found
- Sorting the list again before searching
- Comparing the target with every element twice
Explanation
Binary search exploits sorted order by eliminating half the remaining elements at each step, requiring about 20 comparisons for a million items. Sequential scanning may require a million comparisons.
Question 45Big Idea 2: Data
Two analysts summarize the same data set. One reports the mean, the other reports the median. For a strongly right-skewed distribution, which statement is generally true?
- The median is greater than the mean
- The mean and median are always equal
- The mean is greater than the median Correct answer.
- The median cannot be computed for skewed data
Explanation
In a right-skewed distribution, a long tail of large values pulls the mean upward. The median, based on position, stays closer to the bulk of the data, so the mean exceeds the median.
Question 46Big Idea 2: Data
A data set of 10,000 records has 3 percent missing values in a key field. An analyst removes every record with a missing value. What is the most significant risk of this approach?
- The data set will contain duplicate records
- The remaining records may be systematically different from the removed ones Correct answer.
- The remaining values will all become negative
- The file size will increase
Explanation
Dropping incomplete records can introduce bias if missingness is related to the values themselves. The cleaned data then no longer represents the original population accurately.
Question 47Big Idea 2: Data
A researcher finds a strong correlation between daily ice cream sales and drowning incidents. Which conclusion is most defensible?
- The correlation proves the data are fabricated
- Eating ice cream causes drowning
- Drowning causes increased ice cream sales
- The two variables are associated, possibly through a third factor such as warm weather Correct answer.
Explanation
Correlation measures association, not causation. A lurking variable such as hot weather can drive both ice cream sales and swimming activity, explaining the observed relationship.
Question 48Big Idea 2: Data
A data set contains values 4, 8, 15, 16, 23, 42. An analyst computes the interquartile range. Which quantity does this measure?
- The spread of the middle 50 percent of the data Correct answer.
- The single most common value
- The average distance of all values from the mean
- The total of all values in the data set
Explanation
The interquartile range is the difference between the third and first quartiles, capturing the spread of the middle half of the data. Because it ignores the extreme quarters, it resists the influence of outliers.
Question 49Big Idea 2: Data
A data set contains the values 12, 15, 18, 22, 25. What is the mean of this data set?
- 19
- 18.4 Correct answer.
- 20
- 18
Explanation
The mean is the sum of all values divided by the number of values. Sum = 12+15+18+22+25 = 92; 92/5 = 18.4.
Question 50Big Idea 2: Data
A dataset contains the values 3, 7, 7, 2, 9, 1, 4. What is the range of this dataset?
- 7
- 9
- 8 Correct answer.
- 6
Explanation
The range is the difference between the maximum and minimum values. Max = 9, min = 1, so range = 9 - 1 = 8.