1. An algorithm is essentially the exact same thing as binary code. The terms are used interchangeably.
2. What is the name of this searching algorithm?
3. A binary search compares each value in turn starting at the first element.
4. The programmer wants a variable inside a function to be treated as 'global' and the following code achieves this.
5. The following statement will evaluate to ……
6. The following statement will evaluate to …..
7. In the following algorithm, the elif has _____ conditional tests.
8. What is the output of the following code?
9. Which of the following statements is correct, in reference to the following code?
10. Merge sort is known as a recursive algorithm. What is a recursive function?
11. Can you spot the place in the code for merge sort where recursion is taking place (a function calling itself)
12. Linear search runs in at worst linear time and makes at most n comparisons, where n is ….
13. Analyse the code below - what is the search criteria here?
14. In a linear search, each element of the list is checked sequentially (one after the other) starting …
15. At each step of the algorithm an element is moved from the ..
16. Typically, the sorted numbers go to the _____of the unsorted numbers.
17. In the following list what is '23'?
18. 42 is the first element in the unsorted portion and we proceed in the algorithm to …..
19. If 42 is larger than 23, we can…..
remove 42 and take it to the end of the list as it is largest (e.g. 23,4,16,8,15,42)
include 42 before the 23 (e.g. 42,23 / etc)
append 42 to the end of the 'sorted' list. (e.g. 23, 42 / 4,16,8,15
None of the above
20. What are the correct intermediate steps of the following data set when it is being sorted with the bubble sort? 15,20,10,18
All of the above are valid options
15,18,10,20 -- 10,18,15,20 -- 10,15,18,20 -- 10,15,18,20
10, 20,15,18 -- 10,15,20,18 -- 10,15,18,20
15,10,20,18 -- 15,10,18,20 -- 10,15,18,20
21. It is possible to code a bubble sort with two 'for loops' nested in each other
22. What is the maximum number of comparisons if there are 5 elements in array x?
23. What is the max. number of comparisons that can take place when a bubble sort is implemented? Assume there are n elements in the array?
24. In the following code, what is the line for i in range(n) doing?
25. In the following flow chart, if the numbers 1,2,3,4,5 are entered what is the output?
26. Indicates any type of internal operations like initialization, calculation etc.
27. Used for asking questions that can have either TRUE or FALSE (YES or NO) as an answer.
28. Indicates the starting or ending of the algorithm.
29. The following pseudocode will accept a password string as a parameter passed into the function, returning _____ if the password is a valid length or ______ if it is not valid.
30. A car dealer uses the following algorithm to determine the price to charge for cars. What is the output if p = 1000 i=2 and a = 12?