TestAS · Life Sciences
Simple algorithms and data handling as used in biology, for example in sequence analysis.
testas.de lists this topic for the Life Sciences module. In the test it comes as testlets: a short text, table or formula, then 4 to 8 questions you answer from it.
Topic list: testas.de
Full exam-length testlets from the Kollego course, generated the same way as our mocks. Answer from the material, then open each answer to check.
A triage algorithm in an emergency department
Emergency departments cannot treat patients strictly in order of arrival: a patient with a heart attack must be seen before one with a sprained ankle, even if the latter arrived earlier. Triage systems assign each patient a priority level based on a short, standardised assessment. Many of them are written as algorithms, precise sequences of decisions that always lead to the same result for the same input. Algorithms reduce variation between staff members, make decisions traceable, and can be implemented in software.
An algorithm consists of steps and decisions. In a flowchart, steps are drawn as rectangles and decisions as diamonds with two exits, yes and no. The order matters: a triage algorithm checks the most dangerous conditions first, so that a life-threatening problem is never missed because a less important question was asked earlier. Each patient follows a single path through the chart and leaves it at the first level whose condition is met.
The simplified algorithm below assigns one of five levels, from level 1 (immediate treatment) to level 5 (non-urgent). It is written in pseudocode, a structured mixture of natural language and programming constructs. The keyword IF introduces a condition, and ELSE IF is checked only if all previous conditions were false. The first condition that is true determines the result.
IF the patient is not breathing or has no pulse THEN level 1. ELSE IF the patient is unconscious, or oxygen saturation is below 90%, THEN level 2. ELSE IF pain score ≥ 8 (on a scale of 0 to 10) or heart rate > 120 per minute THEN level 3. ELSE IF temperature ≥ 39.0 °C or pain score ≥ 4 THEN level 4. ELSE level 5.
When algorithms are tested, typical inputs and borderline cases are checked. Borderline cases are values exactly at a threshold, such as a pain score of exactly 8, because errors often arise from confusing 'greater than' with 'greater than or equal to'. Testing also asks whether every possible input leads to exactly one result; an algorithm with ELSE IF chains and a final ELSE guarantees this. Finally, the order of the conditions is checked, because swapping two conditions can change the result for patients who meet both.
| Patient | Breathing and pulse | Conscious | O₂ saturation | Pain score | Heart rate | Temperature |
|---|---|---|---|---|---|---|
| P | yes | yes | 97% | 8 | 95 | 37.2 °C |
| Q | yes | yes | 88% | 2 | 110 | 38.0 °C |
| R | yes | yes | 96% | 3 | 90 | 39.4 °C |
| S | yes | yes | 98% | 2 | 80 | 36.8 °C |
| T | yes | yes | 95% | 5 | 125 | 37.0 °C |
1. Which level does patient P receive?
A: Level 3
P breathes, has a pulse, is conscious and has 97% saturation, so levels 1 and 2 do not apply. Pain score 8 meets 'pain score ≥ 8' (≥ includes 8), so level 3.
2. Which level does patient Q receive?
D: Level 2
Q breathes and has a pulse, so not level 1. The level-2 check comes next: saturation 88% is below 90%, so Q gets level 2, and the later conditions are never checked.
3. Which level does patient R receive?
A: Level 4
R: breathing, pulse, consciousness and 96% saturation rule out levels 1 and 2. Pain 3 < 8 and heart rate 90 ≤ 120 rule out level 3. Temperature 39.4 °C ≥ 39.0 °C, so level 4.
4. Which level does patient T receive?
C: Level 3
T: levels 1 and 2 do not apply (pulse present, conscious, 95%). Heart rate 125 > 120 meets the level-3 condition, and the first true condition decides: level 3, although pain 5 would also fit level 4.
5. How many of the five patients are assigned level 5?
C: One
P and T get level 3, Q level 2, R level 4. S has saturation 98%, pain 2, heart rate 80 and 36.8 °C, so no condition is true and the final ELSE gives level 5: one patient.
6. Why does the algorithm check breathing and pulse first?
A: The most dangerous conditions must never be missed
The text says the algorithm checks the most dangerous conditions first, so a life-threatening problem is never missed because a less important question came earlier. No breathing or no pulse is the most dangerous.
Working with DNA sequence data
DNA sequences are stored and analysed as strings of the letters A, C, G and T, written by convention from the 5' end to the 3' end. Bioinformatics, the use of computers to analyse biological data, relies on a few basic operations on such strings.
Because the two strands of DNA are complementary and run in opposite directions, the sequence of the other strand is found by taking the reverse complement: each base is replaced by its partner (A with T, C with G), and the result is read in reverse order so that it too runs from 5' to 3'. The reverse complement of 5'-AACG-3' is therefore 5'-CGTT-3'. Some sequences are their own reverse complement; such palindromic sequences are typical recognition sites of restriction enzymes, which cut DNA at specific short motifs. The enzyme EcoRI, for example, cuts at the sequence GAATTC.
The GC content, the percentage of G and C bases in a sequence, differs between organisms and between regions of a genome. Because G-C pairs are held together by three hydrogen bonds and A-T pairs by two, DNA with a higher GC content needs a higher temperature to separate its strands.
To compare two sequences of equal length, the simplest measure is the Hamming distance, the number of positions at which the letters differ. Real comparisons must also allow for insertions and deletions and use alignment algorithms that insert gaps where needed. Programs such as BLAST search huge databases for sequences similar to a query, which helps to identify genes and to infer their function from related, better-studied genes.
Searching for a short pattern, or motif, in a long sequence is called string matching. The simplest method checks every possible starting position in turn. In a sequence of length n, a motif of length m can start at n − m + 1 positions. More efficient algorithms skip positions that cannot match, which matters when genomes with billions of bases are searched.
Sequence data are produced at enormous scale. A single modern sequencing machine can read billions of bases in a day, and public databases now hold sequences from hundreds of thousands of species. Before analysis, raw reads must be checked for quality and assembled into longer sequences, and every step relies on the simple string operations described here.
| Name | Sequence |
|---|---|
| S1 | ATGGAATTCGCATGC |
| S2 | ATGGATTTCGCTTGC |
1. How long is sequence S1, and what is its GC content?
A: 15 bases, about 47%
S1 has 15 letters. G or C stands at positions 3, 4, 9, 10, 11, 14 and 15: 7 of 15, and 7 ÷ 15 × 100% ≈ 47%.
2. At which position (counting from 1) does the EcoRI site GAATTC begin in S1?
A: 4
S1 = ATG GAATTC GCATGC: bases 1 to 3 are A, T, G, and GAATTC fills bases 4 to 9. So the site begins at position 4.
3. What is the Hamming distance between S1 and S2?
C: 2
The Hamming distance counts positions with different letters. Compared letter by letter, S1 and S2 differ only at position 6 (A vs T) and position 12 (A vs T): distance 2.
4. What is the reverse complement of 5'-GCATGC-3'?
B: 5'-GCATGC-3'
Replace each base by its partner: GCATGC → CGTACG. Read it backwards to get 5'→3': GCATGC. The result equals the original, so the sequence is palindromic.
5. At how many positions could a 6-base motif start in a 15-base sequence?
A: 10
The text: a motif of length m can start at n − m + 1 positions. Here 15 − 6 + 1 = 10 (the last start, position 10, covers bases 10 to 15).
6. Which DNA separates into single strands at the highest temperature?
A: A fragment with 70% GC content
The text says G-C pairs have three hydrogen bonds and A-T pairs two, so DNA with more GC needs a higher temperature to separate. 70% GC is the highest.
Full Life Sciences module guide
One diagnostic, a projected score, and your first unit. No card, no time limit on the free tier.
Start free, no card needed