Chapter 1.5: Computation and Computational Thinking

Computation and Computational Thinking · Study Questions
Computation and computer scienceHistoryTuring machineKnowledge and EuclidComputational thinking
Sercan KÜLCÜ · Giresun University · Computer Engineering

Multiple Choice · Introduction

Question 1: What Is Computation?

Which of the following best describes the concept of computation?

B: Computation is not limited to arithmetic; searching, sorting, deciding and transforming are also rule-based data processing. An algorithm followed with pen and paper is computation too (C is wrong); a text that is not run performs no operation by itself (D is wrong).

Multiple Choice · Computer Science

Question 2: Technology and Responsibility

A company’s hiring software, trained on data from past years, systematically gives lower scores to a certain group of candidates with similar qualifications. Which area of responsibility is this primarily about?

C: Making sure that data and algorithms do not produce discriminatory results is about fairness. Bias in past data can be carried into the model; so the results are audited separately by group.

Multiple Choice · History

Question 3: The Stored Program

Which fundamental feature distinguishes a stored-program computer from a fixed-program machine?

B: In the stored-program idea, instructions are stored like data in memory; loading a new program gives the same machine a new task. C and D are features of fixed-program machines; speed and memory size (A) are not the distinguishing feature.

Step-by-Step Trace · Computation Models

Question 4: Turing Machine: 1011 + 1

The machine from the lecture that adds 1 to a number works on the tape 1011 (binary 11); the head is at the far right. What are the tape, head and state at each step?

tape□1011q0

Start: the head is on the rightmost 1.

tape□1011q0

Read 1, state q0 → rule 1 will be applied.

tape□1010q0

0 written, the head moved left (the carry continues).

tape□1000q0

Read 1 again → rule 1: write 0, move left.

tape□1000q0

Read 0 → rule 2 will be applied: the carry ends at this digit.

tape□1100HALT

1 written and the machine halted.

tape□1100HALT

Tape 1100 = 12 = 11 + 1 ✓. Rule 3 was never used on this input.

state = q0, head at the far right
repeat:
  read = symbol under the head
  (q0, 1) → write 0, move left, q0
  (q0, 0) → write 1, HALT
  (q0, □) → write 1, HALT
print(tape)

Output Question · Computation Models

Question 5: Turing Machine: 1001 + 1

The machine that adds 1 works on the tape 1001 (binary 9); the head is at the far right. In how many steps does it halt, and what number is left on the tape?

state = q0, head at the far right
repeat:
    read = symbol under the head
    (q0, 1) → write 0, move left, q0
    (q0, 0) → write 1, HALT
    (q0, □) → write 1, HALT
print(tape)
Show answer

Tape: 1010 = 10 · 2 steps

stepreadruletape
11write 0, left1000
20write 1, HALT1010

It ends at the first 0 of the carry; the digits to the left are never touched. Rule 3 (blank cell) is not used on this input.

Multiple Choice · Computation Models

Question 6: The Universal Turing Machine

What distinguishes a universal Turing machine from an ordinary Turing machine?

C: A universal machine takes another machine’s description as input and does what that machine would do; this is the theoretical basis of the stored-program idea. An infinite tape and a two-way head exist in every Turing machine; no Turing machine reads several cells at once, and the symbol set is not limited to 0 and 1.

Multiple Choice · Computation Models

Question 7: The Limits of Computers

Which of the following limits is theoretical: it cannot be overcome either with a faster processor and more memory or by allowing unlimited time?

A: The halting problem is a limit of computability: such an algorithm does not exist in theory and cannot be written however powerful the hardware is. B, C and D are resource (time, memory, energy) limits; with enough resources they can in principle be overcome, and they can be eased with better hardware or algorithms.

Multiple Choice · Knowledge and Algorithm

Question 8: Imperative Knowledge

Which of the following is an example of imperative knowledge?

B: Imperative knowledge describes how to reach a result in steps; algorithms turn this knowledge into explicit, finite steps. A, C and D are declarative knowledge that tells what is true.

Step-by-Step Trace · Knowledge and Algorithm

Question 9: Approximating a Square Root: x = 10

The square-root algorithm from the lecture runs with x = 10 and guess = 1. What are the error and the new guess in each round, and what value is printed? (Round to 4 decimal places.)

Rough initial guess.

|1 − 10| = 9 > 0.01 → continue.

(1 + 10/1) / 2 = 5.5

|30.25 − 10| = 20.25 → continue. The error grew but the guess is moving in the right direction.

(5.5 + 1.8182) / 2 ≈ 3.6591

|13.3889 − 10| ≈ 3.3889 → continue.

(3.6591 + 2.7329) / 2 ≈ 3.1960

|10.2144 − 10| ≈ 0.2144 → continue.

(3.1960 + 3.1289) / 2 ≈ 3.1625

|10.0011 − 10| ≈ 0.0011 ≤ 0.01 → the loop ends.

In 4 rounds the guess got very close to √10 ≈ 3.1623.

x = 10
guess = 1
while |guess * guess - x| > 0.01
   guess = (guess + x / guess) / 2
print(guess)

Step-by-Step Trace · Knowledge and Algorithm

Question 10: Euclid: GCD(252, 105)

GCD(252, 105) is called. How do a, b and r change in each round, and what does the function return?

a252b105

Call: a = 252, b = 105.

105 ≠ 0 → round 1.

a105b42

252 = 2 × 105 + 42 → r = 42; a = 105, b = 42.

42 ≠ 0 → round 2.

a42b21

105 = 2 × 42 + 21 → r = 21; a = 42, b = 21.

21 ≠ 0 → round 3.

a21b0

42 = 2 × 21 + 0 → r = 0; a = 21, b = 0.

0 ≠ 0 is false → the loop ends.

GCD(252, 105) = 21 (252 = 12 × 21, 105 = 5 × 21). 3 rounds.

GCD(a, b)
  while b ≠ 0
    r = a mod b
    a = b
    b = r
  return a

Multiple Choice · Knowledge and Algorithm

Question 11: When the Smaller Number Comes First

What happens if the same Euclid algorithm is called with GCD(18, 48) (smaller number first)?

C: Round 1: 18 mod 48 = 18 → a = 48, b = 18; the numbers swap places. Then it continues like GCD(48, 18): 48 mod 18 = 12, 18 mod 12 = 6, 12 mod 6 = 0. In total 4 rounds, the result is 6. Only one extra round is spent.

Multiple Choice · Computational Thinking

Question 12: Which Component?

A programmer reviews the student, staff and visitor registration forms and notices that the name, ID number and email fields are repeated in all three. Which computational thinking component is this?

D: Finding similarities and repetitions is pattern recognition. Collecting the common fields in a single “Person” model and leaving the differing details only in the types that need them is abstraction, the next step.

Multiple Choice · Computational Thinking

Question 13: The Metro Map

A metro map shows the order of stations and transfer points; it does not show real distances, streets or buildings. Which computational thinking component is this an example of?

B: Abstraction hides details unnecessary for the purpose and keeps the important structure. For the passenger, the station order and transfers matter; real distance does not affect this decision.

Classic Question · Computational Thinking

Question 14: Decomposing a Library System

Decompose a library lending system: at least four subtasks and the input/output of each. Which fields are common to member and staff records (pattern), and how are they abstracted?

Show answer Lending systemMember loginBook searchLendingReturn / fine
  • Member login: member no + password → session / error
  • Book search: title, author → list of books and whether on the shelf
  • Lending: member, book → record + due date (error if the book is not on the shelf)
  • Return / fine: record, return day → days late × fee

Pattern: name, ID number, email, phone exist in both records. Abstraction: these are gathered in a common “Person” model; member no and loan count are kept separately for members, department and authority for staff.

Multiple Choice · Computational Thinking

Question 15: Testing the Edge Cases

You are testing the algorithm that finds the largest value in a list. Which test set best covers the edge cases?

B: Smallest (single item), unusual (all negative, equal values) and invalid (empty list) inputs expose problems such as a wrong initial value or a missing error case. The other options test only normal cases.

The End

Computation and Computational Thinking: Study Questions
Lecture slides: Chapter 1.5: Computation and Computational Thinking · Lecture notes
1 / 1 Sercan KÜLCÜ. All rights reserved.