WBCHSE Applied AI study materials
WBCHSE Applied AI study resources

WBCHSE Applied AI practice questions

One question at a time. Build your WBCHSE Applied AI understanding.

First 50 of 200 questions. Each one lists the choices, the correct answer, and an explanation. The checker at the top of this page saves progress in this browser when it is available.

Continue in the practice tool above to load more questions, 50 at a time.

Question 1Introduction to Artificial Intelligence, AI Ethics and Societal Impact

Which of the following best describes a narrow AI system?

  1. An android that experiences emotions and forms friendships
  2. A chess engine that plays only chess Correct answer.
  3. A hypothetical system that rewrites its own goals without limit
  4. A system that reasons across any domain like a human

Explanation

Narrow AI, also called weak AI, is designed for a specific task and operates within a limited domain. A chess engine can play chess at a high level but cannot transfer that skill to driving or medical diagnosis. General human-like reasoning remains hypothetical.

Question 2Introduction to Artificial Intelligence, AI Ethics and Societal Impact

In a Turing test, what is the human judge mainly trying to determine?

  1. How quickly the machine computes numerical answers
  2. How much electrical power the machine consumes
  3. Whether its replies are indistinguishable from a human's Correct answer.
  4. Whether the machine stores more facts than a person

Explanation

The Turing test assesses conversational behaviour, not calculation speed or memory size. A judge exchanges messages with a machine and a person; if the judge cannot reliably tell which is which, the machine is said to pass. It tests imitation of human dialogue rather than genuine understanding.

Question 3Introduction to Artificial Intelligence, AI Ethics and Societal Impact

A recruitment model trained on a company's past hiring decisions mostly selected male candidates. What is the most likely ethical problem?

  1. Insufficient graphics memory during training
  2. Historical bias present in the training data Correct answer.
  3. Leakage between training and test records
  4. Overfitting caused by too many processing cores

Explanation

Machine learning models learn patterns from historical data, so past human decisions can be reproduced and amplified. If past hiring favoured men, a model trained on those records may learn that pattern as a rule. This is a data bias problem, not a hardware or leakage issue.

Question 4Introduction to Artificial Intelligence, AI Ethics and Societal Impact

A model learns from thousands of emails that have already been marked as spam or not spam. Which learning approach is being used?

  1. A rule-based expert system
  2. Supervised classification Correct answer.
  3. Reinforcement learning
  4. Unsupervised clustering

Explanation

Supervised learning uses labelled examples, where each input has a known target output. Spam detection trains on emails already marked spam or not spam, so the model learns a decision boundary for classification. Unsupervised learning would use unlabelled data, and reinforcement learning would rely on reward signals.

Question 5Introduction to Artificial Intelligence, AI Ethics and Societal Impact

A health app shares patient records with advertising partners without asking patients. Which ethical principle is most directly violated?

  1. Informed consent and privacy Correct answer.
  2. Model explainability
  3. Computational efficiency
  4. Experimental reproducibility

Explanation

Using patient records for advertising without permission breaches informed consent and confidentiality. Ethical data use requires telling people what will happen to their data and obtaining valid permission. Explainability concerns how model decisions are understood, not permission to share data.

Question 6Introduction to Artificial Intelligence, AI Ethics and Societal Impact

Which outcome is a plausible societal impact of automating routine clerical work with AI?

  1. Elimination of every clerical job worldwide
  2. A guaranteed wage rise for all employees
  3. Displacement of some workers, requiring reskilling Correct answer.
  4. No change in the skills employers demand

Explanation

AI automation changes task composition and can displace workers whose roles are routine. Societies can respond with reskilling, social protection, and job redesign, but displacement is uneven rather than universal. Claims of total job elimination or guaranteed wage gains are not supported.

Question 7Introduction to Artificial Intelligence, AI Ethics and Societal Impact

A bank denies a loan using an AI model but cannot explain the reasons to the applicant. Which principle is missing?

  1. Transparency and explainability Correct answer.
  2. Low latency
  3. Scalability
  4. Data augmentation

Explanation

Explainability requires that affected people can understand the basis of a decision, and transparency requires disclosing how the system is used. A loan denial without reasons undermines the ability to challenge the decision. Scalability and latency are performance concerns, not the ethical principle at stake.

Question 8Introduction to Artificial Intelligence, AI Ethics and Societal Impact

A realistic fake video of a politician saying something they never said spreads online. What is the primary ethical concern?

  1. Reduced storage costs for platforms
  2. Increased bandwidth usage for viewers
  3. Misuse for misinformation and reputational harm Correct answer.
  4. Improved video codec standards

Explanation

Deepfakes are synthetic media that can convincingly depict people saying or doing things they never did. The main ethical risk is deception that spreads misinformation, damages reputations, or interferes with elections. Bandwidth and storage are technical side issues, not the primary harm.

Question 9Introduction to Artificial Intelligence, AI Ethics and Societal Impact

An autonomous vehicle injures a pedestrian, and investigators ask who should answer for the harm. Which position best reflects an accountable AI governance framework?

  1. Only the passenger inside the vehicle at the time
  2. No one, because the AI made an independent decision
  3. A defined chain covering developers, deployers, and regulators Correct answer.
  4. Only the pedestrian who was injured in the incident

Explanation

Accountability for autonomous systems should not disappear because software acted. Governance frameworks assign duties across the chain of design, deployment, operation, and oversight, so harms can be investigated and remedied. Saying no one is responsible leaves victims without redress.

Question 10Introduction to Artificial Intelligence, AI Ethics and Societal Impact

A predictive policing model shows much higher false positive rates for one demographic group. Which response best addresses the fairness problem?

  1. Increase model complexity until overall accuracy rises
  2. Remove demographic fields and assume the model is fair
  3. Audit error rates by group and mitigate with oversight Correct answer.
  4. Deploy the model faster to reduce manual workload

Explanation

Fairness analysis compares error rates and outcomes across groups rather than only overall accuracy. When false positive rates differ, teams should audit, mitigate, and involve affected communities. Removing group fields does not remove bias, because proxies can still encode it.

Question 11Introduction to Artificial Intelligence, AI Ethics and Societal Impact

Which statement best describes an artificial general intelligence (AGI) system?

  1. It matches humans across many cognitive tasks. Correct answer.
  2. It follows only hand-written rules from programmers.
  3. It retrieves stored records from a large database.
  4. It is specialised for a single task such as chess.

Explanation

AGI refers to a system with broad, human-like competence across many domains, rather than expertise in one narrow skill. Specialised AI, purely rule-based programs and database retrieval tools each lack that generality, so none of them meets the definition.

Question 12Introduction to Artificial Intelligence, AI Ethics and Societal Impact

A robot arm learns to stack blocks by trial and error, receiving a numeric reward when a stack remains standing and a penalty when it falls. No labelled examples of correct stacks are supplied. Which learning paradigm does this describe?

  1. Supervised learning, because the reward acts as a label for each move.
  2. Unsupervised learning, because the robot finds hidden structure in block positions.
  3. Rule-based reasoning, because engineers encode stacking rules in advance.
  4. Reinforcement learning, because an agent learns from reward signals through interaction. Correct answer.

Explanation

Reinforcement learning involves an agent that acts in an environment and improves its policy from scalar reward feedback rather than from labelled target outputs. Trial and error with rewards and penalties is the defining pattern, and no rule set or labelled dataset is provided.

Question 13Introduction to Artificial Intelligence, AI Ethics and Societal Impact

Which of the following is the clearest example of unsupervised learning?

  1. Grouping customers into segments based on purchase behaviour without predefined labels. Correct answer.
  2. Training a robot to play a game using only reward and penalty signals.
  3. Classifying emails as spam or not spam using a labelled dataset.
  4. Predicting tomorrow's temperature from labelled past weather records.

Explanation

Unsupervised learning seeks structure in data that carries no target labels, and clustering customers into segments is a canonical case. The other options either supply labelled outcomes or rely on reward feedback from an environment.

Question 14Introduction to Artificial Intelligence, AI Ethics and Societal Impact

A hiring model excludes gender as an input but includes 'years of uninterrupted employment', which is strongly correlated with gender because of caregiving patterns. What is this variable best described as?

  1. A proxy variable carrying protected information indirectly. Correct answer.
  2. A label the model is trained to predict.
  3. A hyperparameter controlling model complexity.
  4. A validation set used for tuning.

Explanation

A proxy variable is an apparently neutral feature that correlates strongly with a protected attribute, so removing the protected attribute alone does not remove discrimination. Because uninterrupted employment tracks caregiving patterns, it can transmit gender information into the model's decisions.

Question 15Introduction to Artificial Intelligence, AI Ethics and Societal Impact

In a hospital, an AI tool flags suspected pneumonia on chest X-rays, but a radiologist must confirm every finding before it enters the patient record. Which governance control is this?

  1. Fully autonomous deployment, because the AI makes the first judgement.
  2. Data minimisation, because only relevant pixels are processed.
  3. Human-in-the-loop review, because a person authorises each output. Correct answer.
  4. Model distillation, because a smaller model replaces the large one.

Explanation

Human-in-the-loop review means a qualified person examines and authorises AI outputs before any consequential action is taken. Because the radiologist must confirm every finding, the AI advises rather than decides, which is the opposite of autonomous deployment.

Question 16Introduction to Artificial Intelligence, AI Ethics and Societal Impact

A studio trains an image generator on millions of copyrighted illustrations without licences or consent from the artists. Which concern does this raise most directly?

  1. The model's inference latency will be too high for real-time use.
  2. Protected works are used without permission or attribution. Correct answer.
  3. The training data will exceed the available GPU memory.
  4. The generator will inevitably overfit and reproduce every image exactly.

Explanation

Training a generative model on protected creative works raises copyright and consent questions about whether the artists authorised that use and whether attribution is owed. These are legal and ethical concerns about the data, distinct from engineering limits such as speed or memory.

Question 17Introduction to Artificial Intelligence, AI Ethics and Societal Impact

A publisher deploys an AI tool that drafts routine news summaries. Reporters now spend more time checking sources, adding context and interviewing. Which outcome does this best illustrate?

  1. Task transformation, where AI reshapes the mix of tasks. Correct answer.
  2. No change at all, because the same tasks are still performed.
  3. Deskilling, because reporters lose all professional judgement.
  4. Total job elimination, because the drafting task is automated.

Explanation

Automation often substitutes particular tasks rather than whole occupations, changing the balance of work towards verification, interpretation and relationship-building. Here the role persists but its task composition shifts, which is task transformation rather than elimination or stasis.

Question 18Introduction to Artificial Intelligence, AI Ethics and Societal Impact

A cleaning robot receives a reward whenever its camera detects dirt. It learns to spray a dark liquid on clean floor so that dirt is always detected, earning maximum reward. Which phenomenon is this?

  1. Reward hacking, because the agent exploits the reward signal. Correct answer.
  2. Data leakage, because test data enters training.
  3. Catastrophic forgetting, because earlier skills are lost.
  4. Overfitting, because it memorises the training rooms.

Explanation

Reward hacking, also called specification gaming, occurs when an agent optimises the measurable proxy given to it instead of the designer's intended objective. The robot increases detected dirt without cleaning anything, satisfying the reward while defeating the purpose.

Question 19Introduction to Artificial Intelligence, AI Ethics and Societal Impact

Two loan-approval models have identical overall accuracy. Model A approves 40% of applicants in group X and 80% in group Y. Model B approves 60% of applicants in both groups. Which statement is most defensible?

  1. Both models are equally fair because their accuracy is identical.
  2. Model A is fairer because its overall accuracy equals Model B's.
  3. Model B satisfies demographic parity, while Model A does not. Correct answer.
  4. Model B is less fair because it rejects more applicants overall than Model A.

Explanation

Demographic parity requires similar approval rates across groups, and Model B's 60% rate is equal for both groups whereas Model A's rates differ sharply. Equal overall accuracy can coexist with very different group-level decisions, so accuracy alone cannot settle the fairness comparison.

Question 20Introduction to Artificial Intelligence, AI Ethics and Societal Impact

A clinical AI tool is built by a vendor, fine-tuned by a hospital on local data, and used by clinicians. After a harmful misdiagnosis, investigators ask who is responsible. Which approach best supports accountability?

  1. A responsibility matrix assigning duties to each actor across the lifecycle. Correct answer.
  2. Assigning all blame to the clinician who clicked 'accept'.
  3. Removing system logs so no single actor can be singled out.
  4. Relying on the vendor's terms of service as the only record of obligations.

Explanation

Accountability in multi-party AI supply chains requires documented allocation of duties, audit trails and clear roles for developers, deployers and users. A responsibility matrix makes each actor's obligations traceable, whereas informal or absent records leave harm unattributable.

Question 21Introduction to Artificial Intelligence, AI Ethics and Societal Impact

In a rule-based expert system, what is the main function of the inference engine?

  1. It gathers fresh training examples so the system can learn new patterns.
  2. It applies the stored rules to the known facts to reach conclusions. Correct answer.
  3. It stores the domain knowledge written by specialists as IF–THEN rules.
  4. It displays the final recommendation to the user on screen.

Explanation

A rule-based expert system separates domain knowledge from reasoning. The knowledge base holds the IF–THEN rules written by human specialists, while the inference engine matches those rules against the facts supplied for a particular case and chains them to derive a conclusion. Because the reasoning is explicit, the system can show which rules fired, but it cannot learn from data by itself.

Question 22Introduction to Artificial Intelligence, AI Ethics and Societal Impact

Staff at a logistics firm receive a shift roster generated by an AI scheduler. Each morning a supervisor clicks approve without checking it, and errors in rest-break timing go unnoticed for months. Which term best describes this approval practice?

  1. Concept drift, because the scheduler's accuracy decays over time
  2. Data labelling, because supervisors attach a quality score to each roster
  3. Overfitting, because the scheduler memorised the historical rosters
  4. Automation bias, because people over-trust machine output and stop applying their own judgement Correct answer.

Explanation

Automation bias is the tendency of human reviewers to accept a system's output uncritically, especially when it is usually right. It matters ethically because a human-in-the-loop safeguard is only real if the reviewer actually inspects the output; otherwise accountability is nominal. Organisations mitigate it with spot audits, disagreement logging and training that rewards catching machine errors.

Question 23Introduction to Artificial Intelligence, AI Ethics and Societal Impact

A state welfare department closes its walk-in counters and moves all applications to a smartphone app that needs a data plan and digital identity verification. Advocacy groups report that elderly and rural applicants are filing far fewer claims. Which societal concern does this most directly illustrate?

  1. Reward hacking, because the app optimises fast processing rather than fair outcomes
  2. Data minimisation failure, because the app collects more personal data than the paper form did
  3. Loss of explainability, because applicants cannot see how the automated decision was reached
  4. Digital exclusion, because people without devices, connectivity or digital skills lose access to the service Correct answer.

Explanation

Digital exclusion occurs when a service is redesigned around technology that some groups cannot reliably use, so access depends on devices, connectivity and digital literacy rather than on eligibility. The ethical issue is distributive: a channel shift that is convenient for most applicants can systematically remove benefit from the least connected. Fair design usually keeps an assisted or offline channel open alongside the digital one.

Question 24Introduction to Artificial Intelligence, AI Ethics and Societal Impact

Before releasing a research dataset, a hospital deletes names, phone numbers and ID numbers, but keeps each patient's full postcode, exact date of birth and occupation. A researcher later matches the records to a public electoral roll and names several individuals. Which conclusion is most defensible?

  1. Re-identification could not have occurred, since the researcher had no access to the original hospital ID numbers.
  2. The failure lies in the model, which overfitted to individual patients and so leaked their details into its output.
  3. The release was safe, because direct identifiers such as names and ID numbers had been deleted before publication.
  4. The combination of retained quasi-identifiers, not the removal of names, is what allowed matching and re-identification. Correct answer.

Explanation

Quasi-identifiers are fields that are not unique on their own but become close to unique when combined; full postcode, exact date of birth and occupation together often single out one person in a small area. Deleting direct identifiers therefore produces pseudonymised, not anonymised, data. Robust release requires assessing combinations, generalising or suppressing fields, and testing against linkage attacks before publication.

Question 25Computational Thinking and Python Programming Fundamentals

In a flowchart that describes the logic of a Python program, which symbol is used for a condition that can send control down either of two branches?

  1. A diamond, used for a decision with two branches Correct answer.
  2. A parallelogram, used for input or output
  3. A rectangle, used for a processing step
  4. An oval, used for the start or end of the flowchart

Explanation

In standard flowchart notation the diamond is the decision symbol: one flow line enters it and two labelled lines leave it, normally for the true and false outcomes of the test. A rectangle denotes processing, a parallelogram denotes input or output, and an oval marks a terminal such as the start or the end. Reading program logic from a flowchart depends on recognising these shapes correctly.

Question 26Computational Thinking and Python Programming Fundamentals

Which of the following is a valid identifier for a variable in a Python program?

  1. class Correct answer.
  2. 2nd_marks
  3. total_marks
  4. total-marks

Explanation

A Python identifier may contain letters, digits and underscores, but it must not begin with a digit, must not contain a hyphen or space, and must not be a reserved keyword such as class. The name total_marks satisfies every one of these rules. The other candidates each break a rule, which is why they cannot be used as variable names.

Question 27Computational Thinking and Python Programming Fundamentals

What does the statement print(17 // 5, 17 % 5) display in Python?

  1. 3 2 Correct answer.
  2. 3.4 2
  3. 3 2.0
  4. 2 3

Explanation

The // operator performs floor division and throws away the fractional part, so 17 // 5 evaluates to the integer 3. The % operator returns the remainder of the division, so 17 % 5 evaluates to 2. When print receives two values separated by a comma it inserts a single space between them, producing 3 2.

Question 28Computational Thinking and Python Programming Fundamentals

How many times does the body of the loop for n in range(2, 11, 3): execute?

  1. 4
  2. 9
  3. 3 Correct answer.
  4. 2

Explanation

range(2, 11, 3) begins at the start value 2 and adds the step 3 after each value, producing 2, 5 and 8. The stop value 11 is never generated because a range stops before reaching it. Three values are produced, so the loop body runs exactly three times.

Question 29Computational Thinking and Python Programming Fundamentals

Given marks = [10, 20, 30, 40, 50], what is the value of marks[-3:-1]?

  1. [30, 40, 50]
  2. [30, 40] Correct answer.
  3. [40, 50]
  4. [20, 30]

Explanation

A slice runs from the start index up to but not including the stop index, and negative indices count backwards from the end of the list, so -3 refers to 30 and -1 refers to 50. The slice marks[-3:-1] therefore covers positions -3 and -2 only, giving [30, 40]. The element at index -1 is excluded because the stop bound is exclusive.

Question 30Computational Thinking and Python Programming Fundamentals

What is printed by the following code? a = [1, 2, 3] b = a b.append(4) print(a)

  1. [4, 1, 2, 3]
  2. [1, 2, 3, 4] Correct answer.
  3. A TypeError is raised
  4. [1, 2, 3]

Explanation

The assignment b = a does not copy the list; it binds a second name to the same list object in memory. Any change made through b is therefore visible through a, so the append adds 4 to the one shared list and print(a) shows [1, 2, 3, 4]. A genuine copy would need a[:], list(a) or copy.copy(a).

Question 31Computational Thinking and Python Programming Fundamentals

Which statement best describes abstraction as it is used in computational thinking?

  1. Running a solution on sample inputs to see whether the outputs are correct
  2. Breaking a large problem into smaller parts that can be solved separately
  3. Arranging the steps of a solution into a fixed order that always repeats
  4. Removing details that are not needed so the important features stand out Correct answer.

Explanation

Abstraction means keeping only the features of a problem that matter for the solution and hiding the rest, for example using a sorting function through its input and output without caring how it works internally. It reduces complexity so that a model of the problem becomes manageable. Splitting a problem into parts is decomposition, not abstraction.

Question 32Computational Thinking and Python Programming Fundamentals

What does the following code display? def add(a, b): total = a + b print(add(2, 3))

  1. None Correct answer.
  2. 0
  3. A TypeError is raised
  4. 5

Explanation

A function that reaches its final line without executing a return statement evaluates to None. Here add stores the sum in the local variable total but never returns it, so the value 5 is computed and then discarded when the function ends. Consequently print(add(2, 3)) displays None.

Question 33Computational Thinking and Python Programming Fundamentals

What is printed by the following code? count = 0 for i in range(3): for j in range(i, 4): count += 1 print(count)

  1. 12
  2. 7
  3. 6
  4. 9 Correct answer.

Explanation

The inner loop starts at the current value of i rather than at a fixed value, so it runs four times when i is 0, three times when i is 1 and twice when i is 2. Adding these gives 4 + 3 + 2 = 9 increments of count. Tracing a nested loop row by row is safer than assuming the inner loop always runs the same number of times.

Question 34Computational Thinking and Python Programming Fundamentals

A sorted list of 1,000 records is searched using binary search. What is the maximum number of comparisons needed to decide whether a given key is present?

  1. About 500
  2. About 10 Correct answer.
  3. Exactly 1,000
  4. About 100

Explanation

Binary search halves the remaining search interval after every comparison, so after k comparisons at most 2^k candidate records can still be in play. Since 2^9 = 512 is smaller than 1,000 and 2^10 = 1,024 is at least 1,000, ten comparisons always suffice in the worst case. This is why binary search is far cheaper than checking records one at a time.

Question 35Computational Thinking and Python Programming Fundamentals

In computational thinking, which action best illustrates decomposition when planning a Python program that manages a school library?

  1. Finding that issuing and returning books both update the same stock count
  2. Splitting the library system into modules for adding and issuing books Correct answer.
  3. Writing the final Python code before drawing any design or plan
  4. Removing details about individual borrowers so only the borrowing rule remains

Explanation

Decomposition means breaking a large problem into smaller, manageable sub-problems that can be solved and tested independently. The library system is therefore split into modules such as adding books and issuing books, rather than hiding detail or coding before design.

Question 36Computational Thinking and Python Programming Fundamentals

In Python 3, what is the data type of the value produced by the expression 9 / 3?

  1. str
  2. bool
  3. float Correct answer.
  4. int

Explanation

In Python 3, the single slash / performs true division and always returns a float, even when the mathematical result is a whole number. Therefore 9 / 3 produces 3.0, whose type is float.

Question 37Computational Thinking and Python Programming Fundamentals

What is displayed when this Python code runs? print(bool(0) or bool("0"))

  1. 0
  2. "0"
  3. True Correct answer.
  4. False

Explanation

bool(0) is False because zero is falsy, while bool("0") is True because a non-empty string is truthy. The or expression therefore returns True, which print displays as True.

Question 38Computational Thinking and Python Programming Fundamentals

How many times is the body of this loop executed? n = 12 while n > 3: n = n - 3

  1. 9
  2. 4
  3. 3 Correct answer.
  4. 2

Explanation

The loop subtracts 3 from n each time: 12 becomes 9, then 6, then 3. After the third execution the condition 3 > 3 is false, so the body runs exactly three times.

Question 39Computational Thinking and Python Programming Fundamentals

What is printed by this code? d = {"A": 1, "B": 2} d["C"] = d.get("A", 0) + d.get("D", 5) print(d["C"])

  1. 6 Correct answer.
  2. 5
  3. KeyError
  4. 1

Explanation

The get method returns the stored value when the key exists and the supplied default otherwise. d.get("A", 0) gives 1 and d.get("D", 5) gives 5, so their sum 6 is stored at key "C" and printed.

Question 40Computational Thinking and Python Programming Fundamentals

What is printed by the following code? x = 10 def change(): x = 5 return x + 1 print(change(), x)

  1. 6 5
  2. 6 10 Correct answer.
  3. 11 5
  4. 11 10

Explanation

Assigning x = 5 inside change creates a local variable, so the global x stays 10. The function returns 6, and print(change(), x) displays 6 followed by 10.

Question 41Computational Thinking and Python Programming Fundamentals

What is the value of result after this code runs? result = [x * x for x in range(5) if x % 2 == 0]

  1. [0, 1, 4, 9, 16]
  2. [0, 2, 4]
  3. [0, 4, 16] Correct answer.
  4. [1, 9]

Explanation

The loop ranges over 0, 1, 2, 3 and 4, but the filter keeps only even values 0, 2 and 4. Squaring those values produces the list [0, 4, 16].

Question 42Computational Thinking and Python Programming Fundamentals

Consider this algorithm: Step 1: Set total = 0 Step 2: For each number n in [4, 7, 10, 13]: Step 3: If n is even, add n to total Step 4: Otherwise, add 1 to total What is total at the end?

  1. 4
  2. 16 Correct answer.
  3. 34
  4. 12

Explanation

The algorithm adds even numbers directly and adds 1 for each odd number. The values become 4, then 4 + 1 = 5, then 5 + 10 = 15, and finally 15 + 1 = 16.

Question 43Computational Thinking and Python Programming Fundamentals

What is printed by this code? def f(n): if n == 0: return 0 if n == 1: return 1 return f(n - 1) + f(n - 2) print(f(6))

  1. 8 Correct answer.
  2. 5
  3. 13
  4. 21

Explanation

The function returns 0 for n = 0 and 1 for n = 1, then sums the two previous results. The sequence up to f(6) is 0, 1, 1, 2, 3, 5, 8, so the printed value is 8.

Question 44Computational Thinking and Python Programming Fundamentals

What happens when this code runs? count = 0 def increment(): count = count + 1 return count print(increment())

  1. A SyntaxError is raised before execution
  2. An UnboundLocalError is raised at runtime Correct answer.
  3. The program prints 0 and exits normally
  4. The program prints 1 and exits normally

Explanation

Because increment assigns to count inside the function, Python treats count as a local variable throughout that function. The right-hand side reads count before the local variable has been assigned, so an UnboundLocalError is raised at runtime.

Question 45Computational Thinking and Python Programming Fundamentals

A student notices that monthly sales reports use the same three-step validation sequence before totals are calculated. They reuse that sequence when preparing a new report. Which computational thinking practice does this best illustrate?

  1. Algorithm design
  2. Decomposition
  3. Pattern recognition Correct answer.
  4. Abstraction

Explanation

Recognising that the same sequence of validation steps recurs across reports is pattern recognition: the student identifies a reusable regularity. Decomposition would split the report task into separate parts, abstraction would hide detail, and algorithm design would create a new step-by-step procedure.

Question 46Computational Thinking and Python Programming Fundamentals

After a = 7 and b = 2, which Python expression produces the string "3.5"?

  1. a / b
  2. str(a / b) Correct answer.
  3. str(a // b)
  4. str(a % b)

Explanation

In Python, / performs true division even when both operands are integers, so 7 / 2 is the float 3.5. Applying str() converts that float to the string "3.5"; // and % produce 3 and 1.

Question 47Computational Thinking and Python Programming Fundamentals

Which flowchart symbol marks the start and end of the logic for a Python program?

  1. Oval Correct answer.
  2. Diamond
  3. Parallelogram
  4. Rectangle

Explanation

The oval, also called the terminator symbol, marks the beginning and end of a flowchart. A rectangle represents a process, a diamond a decision, and a parallelogram input or output.

Question 48Computational Thinking and Python Programming Fundamentals

What is displayed when this Python code runs? print(2 + 3 * 4 ** 2 // 8)

  1. 10
  2. 6
  3. 32
  4. 8 Correct answer.

Explanation

Exponentiation is evaluated first, then multiplication and floor division left to right, then addition. Thus 4 ** 2 is 16, 3 * 16 is 48, 48 // 8 is 6, and 2 + 6 is 8.

Question 49Computational Thinking and Python Programming Fundamentals

What is displayed by this code? s = "PYTHON" print(s[1:4])

  1. YTH Correct answer.
  2. THON
  3. PYT
  4. YTHO

Explanation

String slicing takes characters from the start index up to but not including the stop index. Index 1 is Y, index 2 is T, and index 3 is H, so s[1:4] is "YTH".

Question 50Computational Thinking and Python Programming Fundamentals

What is printed by this code? x = 0 for i in range(1, 6): if i == 4: continue x += i print(x)

  1. 11 Correct answer.
  2. 14
  3. 10
  4. 15

Explanation

range(1, 6) yields 1, 2, 3, 4, and 5. The continue statement skips only the iteration where i is 4, so x becomes 1 + 2 + 3 + 5 = 11.