### The questions of Test_2

#### with two possible answers - one correct (yes) and one incorrect (no)

Mark the correct/incorrect assertions about recursion.
(yes) A recursive computation solves a problem by using the solution of the same problem with the simpler inputs.
(no) In all cases the recursive solution is much slower that its iterative counterpart.

Replace the dots ... with the proposed statement and mark "yes" the cases when the string "121" is contained in the program output.
void ret121(int i)
{
...

if (i/10 != 0) ret121(i/10);
}
int main()
{
ret121(122);
return 0;
}
(yes) cout << i;
(no) cout << i%10;

Mark the correct/incorrect assertions about sorting and searching.
(yes) Selection sort is based upon finding the minimum value in a range of indexes and placing that value at the front of the vector.
(no) Merge sort is O(log n) algorithm.

If it takes 4 seconds to sort 10000 records for both sorts (merge sort is really faster, of course) then
(yes) it will take approx 40 minutes to merge sort 1000000 records.
(no) it will take < 10 hours to selection sort 2000000 records.

Count the number N(b) of the visits of elements, required to carry out a search search the value b, using binary search algorithm. Suppose that we search in the array a:
int a = { 14, 43, 76, 100, 115, 290, 400, 511, 512, 601 };
Your answer is the value N(b) mod 2 for b given below:
(1) b=10
(0) b=43

Count the number of visits of array elements required to carry out a sort using selection sort algorithm. Mark with "yes" the cases when this number is given after the array elements.
(yes) {5, 8, 7} 7
(no) {5, 7, 8} 7

Mark with "yes" the cases when the number in the parentheses is the number of swaps in selection sort algorithm for a given array..
(yes) {1, 2, 4, 5} (0)
(no) {1, 4, 2, 5} (2)

We have the following mutual recursive functions:
int s(int n)
{
if (n != 0) return n + m(n - 1);
else return 1;
}
int m(int n)
{
if (n != 0) return n * s(n - 1);
else return 0;
}
Calculate the value of the following expression:
(no) s(0) == 0
(yes) s(2) == 3

We have the following recursive function:
bool s_is_p(string s, int start, int end)
{
if (start >= end) return true;
if (s[start] == s[end]) return s_is_p(s, start + 2, end - 2);
else return false;
}
Guess the return value when the function is called as follows:
s_is_p(s, 0, s.length() - 1);
The value of a string s is given below.
(true) aaaa
(false) helper

We have a linked list and an iterator:
list<int> bip;
list<int>::iterator it;

The list contains 10 elements and the iterator points to the second element of the list. Mark correct/incorrect (about syntax or logic) expressions:
(yes)*it > 0
(no) *it != *bip.end()