Six exam-style questions through Activity 2.10, weighted toward searching. These sets are cumulative, so anything earlier is still fair game.
Question 4 is in exam notation, and its list starts at index 1. Read which notation a question is in before you count anything.
Guessing beats leaving it blank. There is no penalty for a wrong answer on the AP exam, so a blank is a guaranteed zero where a guess is not.
Four have exactly one correct answer, one asks you to select all that apply, and the last is about data or the impact of computing rather than about code.
What does the following C# display?
int[] items = { 4, 9, 4, 7 };
Console.WriteLine(Find(4));Console.WriteLine(Find(5));
int Find(int target){ for (int i = 0; i < items.Length; i++) { if (items[i] == target) { return i; } }
return -1;}0 then 02 then -10 then -10 then 4A sorted list holds 16 items. What is the greatest number of comparisons a binary search could need to find an item, or to find out that it is not there?
Which of these are true of binary search?
This is written in exam notation. What does it display?
aList ← [3, 6, 9, 12, 15]i ← 1total ← 0REPEAT UNTIL(i > LENGTH(aList)){ total ← total + aList[i] i ← i + 2}DISPLAY(total)45182427A correct binary search method is given an array that is not sorted. Which is most likely to happen?
A city publishes its bus arrival times as open data, so anyone can build an app with it. Residents without a smartphone or home internet cannot use any of those apps. The gap between those two groups is best described as:
Six answers, each marked sure or unsure, plus how far you got when the timer went off.