Software Implementation & Coding MCQs for NSCT

By the NSCT Exam Editorial Team · Updated 2026-11-24 · Facts checked against official sources on 2026-11-24

Software implementation is the stage where a design becomes working code. For the exam it means three things: following coding standards, reviewing code to catch defects early, and refactoring to keep code easy to change. It is topic 9 of the Software Engineering area, which carries 10% of the NSCT according to HEC's Areas of Competencies. In 2026 candidates averaged 50.1% in Software Engineering, per the HEC NSCT report and APP.

Sommerville adds three implementation issues beyond writing code: reuse (of functions, components and whole systems), configuration management (tracking versions and builds) and host-target development (building on one machine for another platform). Expect at least one question on that list.

Coding standards

A coding standard is a team's shared set of rules for naming, layout, comments and safe constructs. Consistent code is faster to read and review, whoever wrote it. For Python, the reference is PEP 8.

Item PEP 8 rule Example
Indentation 4 spaces per level
Functions and variables lowercase_with_underscores calculate_gpa
Classes CapWords StudentRecord
Constants UPPER_CASE MAX_CREDITS
Line length 79 characters (72 for comments)
None checks use is / is not if result is None:

Good standards also ban risky habits. Each of these Python snippets was run to confirm its output:

total = 0.1 + 0.2
print(total == 0.3)            # False: binary floating point
print(abs(total - 0.3) < 1e-9) # True: compare with a tolerance

def add_item(item, basket=[]):  # default list is shared between calls
    basket.append(item)
    return basket
add_item("pen")
print(add_item("ink"))          # ['pen', 'ink']

Exam angle: formatting rules are best enforced automatically by a formatter and linter, a form of static analysis (checking code without running it). Human reviewers can then focus on logic.

Code reviews

A code review is a systematic check of code by people other than the author. The forms range from informal to formal:

Form Led by Formality Main goal
Pair programming The pair (driver and navigator) Continuous, informal Catch defects as code is written
Walkthrough The author Low to medium Explain code, gather feedback
Inspection (Fagan) A trained moderator High: roles, checklists, recorded defect data Find as many defects as possible

A Fagan inspection has fixed roles: the moderator leads, the reader paraphrases the code, the recorder logs defects, the author does the rework, and inspectors look for defects. Its stages are planning, overview, preparation, the inspection meeting, rework and follow-up. Reviews aim at defects, not at judging people.

Exam angle: when a review question lists several findings, rank them by risk. A SQL query built by pasting in user input (SQL injection) outranks any naming or spacing comment.

Refactoring

Fowler defines refactoring as changing a program's internal structure to make it easier to understand and cheaper to change, without changing its observable behaviour. Automated tests must be in place first, so that each small step can be checked.

Refactoring is guided by code smells, surface signs of deeper design problems:

Smell Symptom Typical refactoring
Duplicated code Same logic pasted in several places Extract Method
Long parameter list / data clumps The same values always travel together Introduce Parameter Object
Feature envy A method uses another class's data more than its own Move Method
Switch statements The same type check repeated in many places Replace Conditional with Polymorphism
Large class One class with many responsibilities Extract Class
Shotgun surgery One change needs edits in many classes Move Method / Move Field
Magic number An unexplained literal such as 3500 Replace Magic Number with Symbolic Constant

Exam angle: if a "refactoring" changes output for any input, it is not a refactoring. A common slip is changing > to >= while extracting a method.

Common traps

Worked examples

Understanding. What does the recorder do in a Fagan inspection? Answer: logs every defect found, with its type and severity. The moderator leads, and the author fixes the defects afterwards.

Application. What does this print?

for i in range(3):
    pass
print(i)

Answer: 2. A Python loop variable stays defined after the loop ends and keeps its last value. Some coding standards discourage relying on this because it is easy to misread.

Analysis. Three modules each contain their own copy of a grade-point calculation. A bug was fixed in one copy only. What is the root cause, and what is the best fix? Answer: duplicated code. The fix had to be made three times and two copies were missed. Extract the logic into one function (Extract Method) and call it from every module, following DRY (Don't Repeat Yourself).

Practise

The quiz below has 99 Software Implementation & Coding questions, which you can filter by tier and difficulty.

Practise: 99 questions

Interactive quiz loading. The first 10 questions are shown below.

  1. What is the main purpose of a team coding standard?

    1. To make programs run faster on every platform
    2. To replace the need for testing
    3. To let each developer use a personal style
    4. To make code consistent and readable so it is easier to review and maintain
    Show answer

    Answer: D. To make code consistent and readable so it is easier to review and maintain

    A coding standard sets shared rules for naming, layout, comments and safe constructs. Consistent code is quicker to read, review and maintain by anyone on the team. It does not guarantee speed and never replaces testing.

  2. Under PEP 8, Python's official style guide, how should a class be named?

    1. CapWords, for example StudentRecord
    2. snake_case, for example student_record
    3. UPPER_CASE, for example STUDENT_RECORD
    4. camelCase, for example studentRecord
    Show answer

    Answer: A. CapWords, for example StudentRecord

    PEP 8 uses CapWords (also called PascalCase) for class names, lowercase_with_underscores for functions and variables, and UPPER_CASE_WITH_UNDERSCORES for module-level constants.

  3. How many spaces per indentation level does PEP 8 recommend?

    1. 2
    2. 8
    3. 4
    4. 1 tab character
    Show answer

    Answer: C. 4

    PEP 8 recommends 4 spaces per indentation level and prefers spaces to tabs. Mixing tabs and spaces for indentation is not allowed in Python 3.

  4. Martin Fowler defines refactoring as a change to the internal structure of software that:

    1. Adds new features requested by the customer
    2. Makes it easier to understand and cheaper to modify without changing its observable behaviour
    3. Fixes bugs reported by users
    4. Improves performance at any cost to readability
    Show answer

    Answer: B. Makes it easier to understand and cheaper to modify without changing its observable behaviour

    Refactoring improves structure while keeping external behaviour the same. Adding features or fixing bugs changes behaviour, so it is not refactoring, even if it is done at the same time.

  5. In pair programming, what are the two roles usually called?

    1. Driver and navigator
    2. Author and moderator
    3. Tester and recorder
    4. Master and scrum master
    Show answer

    Answer: A. Driver and navigator

    The driver types the code while the navigator reviews each line, thinks ahead and spots problems; the pair switch roles often. Author and moderator are roles in a formal inspection, not in pairing.

  6. What is static analysis of code?

    1. Examining source code for defects without running it
    2. Running the program with test inputs and checking the outputs
    3. Measuring the program's memory use while it runs
    4. Asking users to try the program and report problems
    Show answer

    Answer: A. Examining source code for defects without running it

    Static analysis tools (linters, type checkers, security scanners) inspect source code without executing it, catching problems such as unused variables, type errors or risky calls. Running the program with inputs is dynamic testing.

  7. In a Fagan inspection, who plans and leads the inspection meeting?

    1. The moderator
    2. The author
    3. The reader
    4. The recorder
    Show answer

    Answer: A. The moderator

    The moderator, a trained person who is not the author, organises the inspection and runs the meeting. The reader paraphrases the material, the recorder logs defects, and the author answers questions and later fixes them.

  8. How does a code walkthrough usually differ from a formal inspection?

    1. A walkthrough executes the code; an inspection never looks at code
    2. A walkthrough is done by customers; an inspection is done by testers only
    3. There is no difference; the terms mean the same thing
    4. A walkthrough is led by the author and is less formal; an inspection is moderator-led, uses checklists and records defect data
    Show answer

    Answer: D. A walkthrough is led by the author and is less formal; an inspection is moderator-led, uses checklists and records defect data

    In a walkthrough the author leads colleagues through the code, often for understanding and feedback. An inspection is the most formal review: defined roles, preparation, checklists, entry and exit criteria and recorded defect metrics. Neither runs the code.

  9. In Fowler and Beck's terms, what is a code smell?

    1. A syntax error that stops the code compiling
    2. A failing unit test
    3. A surface sign in code that often points to a deeper design problem
    4. A security vulnerability reported by a scanner
    Show answer

    Answer: C. A surface sign in code that often points to a deeper design problem

    A code smell, such as a long method or duplicated code, is not a bug in itself and the code still works. It hints that the design may be hard to change, and it suggests where refactoring could help.

  10. Which code smell is described as "one change forces many small edits across many different classes"?

    1. Divergent change
    2. Long method
    3. Shotgun surgery
    4. Lazy class
    Show answer

    Answer: C. Shotgun surgery

    In shotgun surgery a single change is scattered across many classes, so it is easy to miss one. The usual cure is Move Method and Move Field to bring the related behaviour together. Divergent change is the opposite: one class changed for many different reasons.

FAQs

What is the difference between refactoring and rewriting?

Refactoring changes structure in small, behaviour-preserving steps, each checked by tests, so the system keeps working throughout. A rewrite replaces the code wholesale, which risks losing hidden behaviour that users depend on. For legacy code without tests, write characterisation tests for its current behaviour first, then refactor.

Is a code review the same as testing?

No. A review examines code without running it (static verification), while testing runs the code with inputs (dynamic verification). They catch different defects: reviews find unclear logic, standards breaches and security risks that may never show in tests, and tests find run-time failures. Sommerville recommends using both.

Why does PEP 8 say to compare with None using is?

None is a singleton: there is only one None object. is checks identity, which is exactly right, and a class cannot override it. == calls __eq__, which a class may override to behave strangely. PEP 8 therefore requires is None and is not None.

What is technical debt?

Technical debt is Ward Cunningham's term for the extra future work caused by taking shortcuts now, such as copied code or skipped tests. Like a loan, it speeds delivery today but charges "interest" as every later change gets slower. Regular refactoring pays it down.

Next step

Continue with Software Testing MCQs, go back to the Software Engineering hub, or try a timed NSCT mock test.