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. 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?
5. A car dealer uses the following algorithm to determine the price to charge for cars. What is the output if p = 5000, i = 3, a = 10
6. A car dealer uses the following algorithm to determine the price to charge for cars. What is the output if p = 8000, i = 0, a = 5
7. Algorithms are a great way of automating computer decisions. However, automating processes can lead to errors.
8. Complete the first two lines of the trace table for this algorithm.
9. The programmer wants a variable inside a function to be treated as 'global' and the following code achieves this.
10. The following statement will evaluate to ……
11. The following statement will evaluate to …..
12. In the following algorithm, the elif has _____ conditional tests.
13. What is the output of the following code?
14. Which of the following statements is correct, in reference to the following code?
15. Merge sort is known as a recursive algorithm. What is a recursive function?
16. Can you spot the place in the code for merge sort where recursion is taking place (a function calling itself)
17. Linear search runs in at worst linear time and makes at most n comparisons, where n is ….
18. Analyse the code below - what is the search criteria here?
19. In a linear search, each element of the list is checked sequentially (one after the other) starting …
20. At each step of the algorithm an element is moved from the ..
21. Typically, the sorted numbers go to the _____of the unsorted numbers.
22. In the following list what is '23'?
23. 42 is the first element in the unsorted portion and we proceed in the algorithm to …..
24. If 42 is larger than 23, we can…..
include 42 before the 23 (e.g. 42,23 / etc)
None of the above
append 42 to the end of the 'sorted' list. (e.g. 23, 42 / 4,16,8,15
remove 42 and take it to the end of the list as it is largest (e.g. 23,4,16,8,15,42)
25. What are the correct intermediate steps of the following data set when it is being sorted with the bubble sort? 15,20,10,18
15,10,20,18 -- 15,10,18,20 -- 10,15,18,20
All of the above are valid options
10, 20,15,18 -- 10,15,20,18 -- 10,15,18,20
15,18,10,20 -- 10,18,15,20 -- 10,15,18,20 -- 10,15,18,20
26. It is possible to code a bubble sort with two 'for loops' nested in each other
27. What is the maximum number of comparisons if there are 5 elements in array x?
28. 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?
29. In the following code, what is the line for i in range(n) doing?
30. Can you analyse the flow chart and describe what it does?
31. What flow chart symbol is executed if the email ID and password are NOT correct?
32. Analyse the following flow chart and predict what it does.
33. In the following algorithm, how many INPUT/OUTPUT boxes (parallelograms) would be in use?
34. The following algorithm is supposed to print out the times table of the number entered but there is an error. What is it?
35. For the following algorithm, if the user enters '3', what will happen?