Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Computer Science Aptitudes Test 2021

Climb Foundation

December 6, 2021 — 9:00 AM

• The test duration is 3 hours, with an additional 30 minutes for scanning and uploading
all scripts.

• There are 12 questions, each equally weighted. Your best six questions are considered.
You can choose the questions to answer. All questions attempted are marked. Partial
answers and rough work are also considered and cannot disadvantage you.

• Start a new question on a new page – do not answer multiple questions on the same
page.

• Show sufficient justification for every answer in order to make your solutions clear to
the Examiner.

• Calculators, phones, watches, smart-glasses, other electronic devices, beyond those


strictly required for taking the test, are not permitted.

• Do not discuss test questions with others (e.g. individuals from the same or another
school, the Internet, or elsewhere), especially before March next year. You would
disadvantage yourself.

It is recommended that you:

• first read through all the questions,

• aim for 6 questions.

Good luck!

1
CSAT 2021 Climb Foundation

1. The integers 1 to n are arranged in a circle, in order, clockwise. A robot starts on 2, and moves one
place anti-clockwise to 1. At every subsequent step it moves clockwise a number of places equal
to its position before the previous step. For example, if n = 3, the sequence of positions would be
2, 1, 3, 1, 1, 2, 3, 2, 2, 1, 3, . . . , where the sub-sequence 2, 1 appears after every 8 steps.
You note the positions visited and observe that the sub-sequence 2, 1 appears after every 20 steps,
and not sooner.
(a) What three values must occur in the sequence immediately before 2, 1?
(b) What are the possible values of n? There are three possibilities.
2. We say that a continuous function f has a fixed point c if f (c) = c. Furthermore, we say that c is
attractive if for some α, β > 0 and x0 ∈ (c − α, c + β), the infinite composition f (f (. . . f (x0 ) . . . ))
converges to c. For example, the function f (x) = 2x has no attractive points, even though x = 0
is a fixed point.
(a) Find the fixed points of f (x) = (A/x + x)/2, where A > 0 is a constant and x ̸= 0 is real.
(b) Find the attractive points of f . Specifically, find the largest α, β such that the fixed points are
attractive, and prove the convergence from any starting point x0 in the respective interval.
3. A CSAT expression consists of a series of symbols separated by + or − operations and brackets. At
each step you replace all symbols simultaneously with other CSAT expressions according to fixed
rules (written A → E, meaning “replace symbol A with expression E ”). You calculate a score after
each step by assigning each symbol an integer value (written A : 1, meaning “A has value 1”) and
evaluating the final arithmetic expression.
For example the starting CSAT expression A with rules A → A + B and B → B + B would give
the sequence of steps A + B, A + B + B + B, A + B + B + B + B + B + B + B, . . . . If A : 0 and
B : 1 this gives the sequence of scores 1, 3, 7, 15, . . . .
(a) Find a non-recursive form for the sequence of scores given by the starting CSAT expression A
and with rules A → A + B and B → (A − B) with values A : 1 and B : 1.
(b) Give rules, symbols, values and a starting CSAT expression, that yield the Triangular numbers
as the sequence of scores: T0 = 1, Tn = Tn−1 + n for n > 1 i.e. 1, 3, 6, 10, 15, 21, . . . .
(c) Give rules, symbols, values and a starting CSAT expression, that yield the Fibonacci numbers
as the sequence of scores: F1 = F2 , Fn = Fn−1 + Fn−2 for n > 2 i.e. 1, 1, 2, 3, 5, 8, . . . .
4. (a) Show that for any integer n ≥ 0 there is exactly one integer m such that:
√ √
9 + 8n − 3 ≤ 2m ≤ 1 + 8n − 1

(b) Let f (x, y) = 12 x2 + x + 2xy + 3y + y 2 for integer x, y ≥ 0. Using part (a), or otherwise,


show that there is exactly one pair x, y such that f (x, y) = n for any integer n ≥ 0.
5. (a) On a 3 by 3 grid, how many ways are there to mark 5 squares?

In the game ‘Noughts and Crosses’ (also known as ‘Tic Tac Toe’ or ‘Xs and Os’), players X and
O take turns to mark empty cells in a 3 by 3 grid with their symbol. X goes first. A player wins
if they get three of their symbols in a row, column or diagonal. The game is drawn otherwise.
(b) How many different board configurations are there containing exactly 3 Xs and 3 Os, without
X having won?
(c) If the players play randomly, what is the probability of a draw? Hint: You may want to avoid
calculating the probability that X wins or that O wins.

In each part given your answer as a single number or fraction.

2
Climb Foundation CSAT 2021

6. The decimal representation of any fraction has either a finite number of digits, or a pattern of digits
that repeats to infinity, e.g. 13 = 0.33333 . . . .
1
(a) Show that for any integer p > the fraction p can be written as an infinite geometric series, by
giving an expression in terms of p.
1
(b) By multiplying two infinite geometric series, show that the representation in base b of
(b − 1)2
contains all digits up to b − 1 except the digit b − 2. Here b > 2 is an arbitrary base, and we
extend the understanding of “digit” to mean any b different numbers from 0 to b − 1.

7. Let f : R 7→ R be a function with a single global maximum at f (q) with x ≤ q ≤ y. The value of
f increases strictly monotonically up to the maximum and then decreases strictly monotonically
thereafter. You know x and y and are trying to estimate q to an accuracy ±0.5. The only actions
you can perform (repeatedly) are: evaluate f (z) for any z that you may construct using arbitrary
arithmetic, and compare the results of such evaluations and decide how to proceed. Explain the
steps of an efficient procedure to estimate q ± 0.5 such that:
(a) You minimise the number of comparisons in the worst case scenario.
(b) You minimise the number of evaluations of f in the worst case scenario.

8. You are moving across a grid of n × n points. You first step to the right, and at every subsequent
step you move up or right. Give an expression in terms of n for the number of different paths you
could take in total from anywhere on the left side to anywhere on the right side
(a) without restriction.

(b) such that |yi − yj | ≤ |xi − xj |, where (xi , yi ) and xj , yj are the coordinates of any two points
on the path.

9. An agent is trying to crack a computer with a password containing only digits 0 to 9. When a
password consisting of the digits d1 d2 . . . dn is entered, the computer calculates the sequence of
integers a0 , a1 , . . . , an according to the rules:

a0 = 0
ai = f (ai−1 , di ) for i > 0,

where f is some integer-valued function. The computer accepts the password as correct only if
an = x for some fixed x. The agent knows x and can call f with any inputs. The agent does not
know n and cannot test passwords on the computer.
(a) The agent realises that f (y, z) > y for all integers y, z. Explain the steps of an optimal
procedure for the agent to find a working password. State clearly how the password is found.
You should minimise the number of calls to f in the worst case scenario.
(b) Give an expression for the number of calls to f made by your procedure in the worst case
scenario.
(c) Another agent has created a procedure P which they claim uses fewer calls to f than your an-
swer in the worst case scenario, without more knowledge of the behaviour of f . By considering
the calls to f made by P , prove that they are wrong using a contradiction argument.

3
CSAT 2021 Climb Foundation

10. Let the function f be defined over positive integers as:

f (1) = 1
f (p) = 1 + f (p − 1) for all primes p,
f (p1 p2 . . . pn ) = f (p1 ) + f (p2 ) + · · · + f (pn ) for all pi primes, not necessarily distinct.

(a) Prove that f (n) ≤ n for all n.


(b) Prove that 21+f (n) ≤ n3 for all n ≥ 2. Note: part a is not meant as intermediary result.

11. Given an integer p ≥ 2, there exists an integer n ≥ 0 and a set of integers a0 , . . . an ≥ 1 such that
p = 2a0 + 2a0 +a1 + · · · + 2a0 +···+an .
 
(a) Let f be a recursive function given by f (k) = 1+f k − 2⌊log2 k⌋ , where k > 0 and f (0) = −1.
 
Prove that f (p) = n. Hint: You may wish to investigate ⌊log2 2b + 2b+c ⌋ for integers b, c > 0.
 
(b) Let g be a recursive function over positive integers with g 2k = k for all integers k ≥ 1.
Give a recursive definition for g similar to f such that g(p) = a0 .
(c) Construct a function h (recursive or otherwise) over positive integers such that h(p) = an .
(d) Given some constant integer r, construct a recursive function φ depending on r, such that
φ(p) = a0 rn + a1 rn−1 + · · · + an . Hint: You are allowed to reuse f , g, and h.

12. Let f : R 7→ R be a function with the property that f ◦ f = f .


(a) Prove that each of the following three conditions is necessary, and that all three together are
sufficient, in order for f to be continuous:
1. There exists α < β such that f (x) = x for all x ∈ [α, β]. For completeness, α, β are
allowed to tend to −∞, +∞ respectively.
2. There exists only one such interval, i.e. there are no disjoint intervals such that f (x) = x
on those intervals and f (x) ̸= x between those intervals.
3. f (y) ∈ [α, β] for all y.
(b) Prove that if f is differentiable then f is either a constant function or the identity function.

You might also like