Software Metrics & Measurement MCQs for NSCT

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

Software metrics put numbers on software and the process that builds it: size (LOC, function points), complexity (cyclomatic complexity), quality (defect density) and productivity. It is topic 13 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.

Most questions here are short calculations, so learn each formula with one worked number. Metrics also feed estimation in Software Project Management and test planning in Software Testing.

LOC

Lines of code (LOC) is a direct size measure: you count it straight from the source. It is usually quoted in KLOC (thousands of lines) and used to normalise other measures.

Metric Formula Example
Productivity LOC ÷ person-months 30,000 LOC by 5 people in 6 months = 1,000 LOC/PM
Defect density Defects ÷ KLOC 45 defects in 15 KLOC = 3 per KLOC
Cost per LOC Cost ÷ LOC 4.5 million rupees ÷ 30,000 = 150 rupees per line

LOC is easy to collect but depends on the language and on counting rules (comments, blank lines, generated code), and it is only known after coding. Pressman calls LOC and execution speed direct measures, while quality attributes such as maintainability are indirect. Exam angle: LOC productivity penalises high-level languages, because the same feature takes fewer lines in Python than in assembly.

Function points

Function points (FP), from Albrecht and now IFPUG, measure delivered functionality from the user's view. You count five function types and weight each one by complexity.

Type Meaning Simple / Average / Complex
EI, external input Data entering the boundary 3 / 4 / 6
EO, external output Output with calculation or derived data 4 / 5 / 7
EQ, external inquiry Retrieval with no derived data 3 / 4 / 6
ILF, internal logical file Data the system maintains 7 / 10 / 15
EIF, external interface file Data read from another system 5 / 7 / 10

The weighted sum is the unadjusted count (UFP). Fourteen general system characteristics are each rated 0 to 5, and VAF = 0.65 + 0.01 × ΣFi, so VAF runs from 0.65 to 1.35. Then FP = UFP × VAF.

Example: 6 average EIs, 3 average EOs and 2 average ILFs give UFP = 24 + 15 + 20 = 59. With ΣFi = 45, VAF = 1.10 and FP = 64.9. Exam angle: FP can be counted from requirements and does not depend on the language, which is why it suits early estimation and cross-language comparison.

Cyclomatic complexity

McCabe's cyclomatic complexity V(G) counts the linearly independent paths through a module's control flow graph. Three equivalent formulas:

def fee(units, member):
    if units > 100:        # decision 1
        rate = 8
    else:
        rate = 10
    for _ in range(3):     # decision 2
        if member:         # decision 3
            rate -= 1
    return rate * units

Three decisions give V(G) = 4, so basis path testing needs four test cases. Else, return and break add no decisions. When a condition uses and/or, Pressman counts each simple condition separately; some tools count the whole if once, so read the question's rule. Exam angle: McCabe suggested reviewing any module above 10.

Other metrics you should recognise

Measurement scales matter too: defect category is nominal, severity is ordinal, and LOC is a ratio scale.

Common traps

Worked examples

Understanding. Which function point type covers a customer master file that another company's system maintains and yours only reads? Answer: an external interface file (EIF). Your application references it but does not maintain it. If your system updated it, it would be an internal logical file.

Application. A flow graph has 14 edges and 11 nodes in one component. What is V(G)? Answer: 5. V(G) = 14 − 11 + 2 = 5, so a basis set has five independent paths.

Analysis. Before release, testing found 76 defects; customers then reported 4. A second project found 50 before release and 10 after. Which team removed defects more effectively? Answer: the first. DRE = 76 ÷ 80 = 95% against 50 ÷ 60 ≈ 83%. The second team let a larger share of its defects escape, even though it reported fewer in total.

Practise

The quiz below has 100 Software Metrics & Measurement questions, which you can filter by tier and difficulty.

Practise: 100 questions

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

  1. Which of these is a direct measure of a software product?

    1. Usability
    2. Maintainability
    3. Reliability
    4. Lines of code (LOC)
    Show answer

    Answer: D. Lines of code (LOC)

    A direct measure is counted straight from the product or process with no model in between, such as LOC, execution speed or defects found. Pressman treats quality attributes such as maintainability, reliability and usability as indirect measures, derived from other counts.

  2. In IFPUG function point analysis, what is the possible range of the value adjustment factor (VAF)?

    1. 1 to 70
    2. 0 to 1
    3. 0.5 to 1.5
    4. 0.65 to 1.35
    Show answer

    Answer: D. 0.65 to 1.35

    VAF = 0.65 + 0.01 × ΣFi, where the 14 general system characteristics Fi are each rated 0 to 5. ΣFi therefore runs from 0 to 70, so VAF runs from 0.65 to 1.35, adjusting the unadjusted count by up to ±35%.

  3. Which of these is NOT one of the five function types counted in function point analysis?

    1. External inquiries
    2. Number of classes
    3. External inputs
    4. Internal logical files
    Show answer

    Answer: B. Number of classes

    Function point analysis counts external inputs (EI), external outputs (EO), external inquiries (EQ), internal logical files (ILF) and external interface files (EIF). It measures functionality from the user's view, so design-level counts such as classes are not part of it.

  4. What does McCabe's cyclomatic complexity V(G) of a function tell you?

    1. The depth of the function in the call tree
    2. The number of linearly independent paths through its control flow graph
    3. The number of lines in the function
    4. The number of variables the function uses
    Show answer

    Answer: B. The number of linearly independent paths through its control flow graph

    V(G) counts linearly independent paths, which is the size of a basis set. It equals E − N + 2P for the control flow graph, the number of binary decisions plus 1, or the number of regions in a planar graph. In basis path testing it gives the number of test cases needed to cover a basis set.

  5. McCabe's original guideline suggests that a module should be reviewed or split when its cyclomatic complexity exceeds which value?

    1. 2
    2. 10
    3. 100
    4. 50
    Show answer

    Answer: B. 10

    McCabe proposed 10 as a practical upper limit for a module's cyclomatic complexity. Above it, the module has many independent paths, is harder to test fully and is more likely to contain defects, so it is a candidate for refactoring. Some organisations allow up to 15 with justification.

  6. Defects are classified as Low, Medium, High or Critical. On which measurement scale does this classification sit?

    1. Interval
    2. Ratio
    3. Ordinal
    4. Nominal
    Show answer

    Answer: C. Ordinal

    The categories have a meaningful order (Critical is worse than High) but the gaps between them are not equal or measurable, which defines an ordinal scale. A nominal scale has no order, while interval and ratio scales need equal-sized units.

  7. In the Goal-Question-Metric (GQM) approach, what is defined first?

    1. The metric to collect
    2. The goal the organisation wants to achieve
    3. The statistical test to apply
    4. The tool that will collect data
    Show answer

    Answer: B. The goal the organisation wants to achieve

    GQM works top-down: state a measurement goal, derive questions that show whether the goal is being met, then choose metrics that answer those questions. Starting from metrics leads to collecting data nobody uses.

  8. Defect density is usually expressed as:

    1. Defects per developer
    2. Defects per thousand lines of code (KLOC) or per function point
    3. Defects per test case
    4. Defects per month
    Show answer

    Answer: B. Defects per thousand lines of code (KLOC) or per function point

    Defect density normalises the defect count by product size, usually per KLOC or per function point. This lets you compare modules or projects of different sizes. Dividing by developers, test cases or time measures something else.

  9. In the Chidamber and Kemerer (CK) metrics suite, what does DIT measure?

    1. The number of methods in a class
    2. The number of direct subclasses of a class
    3. The number of classes a class is coupled to
    4. The depth of a class in the inheritance tree
    Show answer

    Answer: D. The depth of a class in the inheritance tree

    DIT (depth of inheritance tree) is the length of the path from a class to the root of its hierarchy. A deep class inherits more behaviour, which aids reuse but makes it harder to predict. NOC counts direct subclasses, CBO counts coupled classes and WMC sums method complexity.

  10. In function point analysis, how does an internal logical file (ILF) differ from an external interface file (EIF)?

    1. An ILF is maintained (updated) inside the application boundary; an EIF is only referenced and is maintained by another application
    2. An ILF is stored on disk; an EIF is held in memory
    3. An ILF holds user data; an EIF holds configuration data
    4. An ILF is counted only for batch systems; an EIF only for online systems
    Show answer

    Answer: A. An ILF is maintained (updated) inside the application boundary; an EIF is only referenced and is maintained by another application

    Both are user-recognisable groups of data. The difference is who maintains them: the application being counted adds, changes or deletes data in its ILFs, while an EIF is read from another application that maintains it. Storage medium and data type do not decide the classification.

FAQs

Is cyclomatic complexity the same as the number of test cases?

It is the number of test cases needed to cover a basis set of independent paths in basis path testing. Branch coverage can often be reached with fewer tests, and some paths may be infeasible, so treat V(G) as the target for basis path testing rather than a universal test count.

Why are function points preferred over LOC for estimation?

You can count function points from the requirements before any code exists, and the count does not change with the programming language. LOC is only known after coding and rewards verbose languages. The trade-off is that FP counting needs training and some judgement about complexity.

What is a good defect density?

There is no single standard figure; it depends on the domain, the language and how defects are counted. Use defect density to compare modules or releases inside the same organisation, and investigate modules well above the local average first.

What is the difference between a metric and a measure?

A measure is a raw number, such as 12 defects or 4,000 LOC. A metric relates measures to give insight, such as 3 defects per KLOC. Pressman uses this distinction, though many texts use the words interchangeably.

Next step

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