Academic Year Fall 2025 - 26
Next Topic(s):
Created:
14th of November 2025
05:13:58 PM
Modified:
14th of November 2025
06:48:17 PM
Final Assessment Test - Fall 2025-26: Question Set
General Instructions
- Use only Python list comprehensions for your computations. Do not use explicit
fororwhileloops, and do not importNumPy,pandas, or any other external modules. - Perform all calculations at full precision and round only in the final display using formatted string literals (e.g.,
f"{value:.2f}"). - Preserve the input order in your outputs — corresponding results must match the index positions of their inputs.
- Unless otherwise specified, use SI units and UK spelling (e.g., metres, centimetres, etc.).
- You may import only the standard Python
mathmodule (e.g.,math.sin,math.sqrt,math.pi,math.tan). - Each computation must be encapsulated within a clearly defined function that accepts the given input(s) and returns or prints the required rounded results.
- Display all outputs in list or tuple form, exactly as demonstrated in the examples provided for each question.
Questions Set
Each question involves the creation of a Python function, numerical computation, and rounding to the specified precision. No file reading or writing is permitted. Students must display computed results clearly.
On Inputs and Data Types
- Do not use
input(). No string parsing or splitting is required. - Your functions will be tested by calling them with native Python objects: lists (e.g.,
[20.0, 35.0]), tuples (e.g.,(x, y)), or lists of tuples (e.g.,[((2, 3), (5, 7)), ((1, 1), (4, 5))]). - Assume valid types. Do not convert from strings; do not perform file I/O.
- Return the computed results (and also print them in the rounded format shown in each question).
Question 1: Degree–Minute–Second (DMS) to Decimal Degree Conversion (Theodolite Surveying)
Background: In theodolite surveying, angles are expressed as degrees (D), minutes (M), and seconds (S). They must be converted into decimal degrees for computation.
Formula:
\[ \text{Decimal Degrees} = D + \frac{M}{60} + \frac{S}{3600} \]
Task:
- Write a function
dms_to_decimal(deg, min, sec)that accepts three lists of equal length. - Return a list of decimal degree values rounded to 4 decimal places.
- Display the resulting list.
Expected Output:
[54.2583, 23.4583, 89.9997]
Question 2: Tangent Length for a Simple Circular Curve (Highway Alignment)
Background: The tangent length \(T\) for a simple circular curve is given by:
\[ T = R \tan\!\left(\frac{\Delta}{2}\right) \]
where \(R\) = radius (m), and \(\Delta\) = deflection angle (degrees).
Task:
- Write a function
tangent_length(R, delta_deg)to compute the tangent length for each pair of values. - Use the
mathmodule and round each result to 2 decimal places.
Expected Output:
Tangent lengths: [35.47, 56.78, 43.12]
Question 3: Time Period of a Compound Pendulum (Mechanics)
Background: For a compound pendulum of length \(L\) (in metres), the time period \(T\) is:
\[ T = 2\pi \sqrt{\frac{2L}{3g}} \]
where \(g = 9.81\,\mathrm{m\,s^{-2}}\).
Task:
- Write a function
time_period(lengths)that returns a list of periods (seconds) rounded to 3 decimal places.
Expected Output:
Time Periods: ['2.197', '2.934', '3.208']
Question 4: Distance Between Two Points (Coordinate Geometry)
Background: The distance \(d\) between two points \((x_1, y_1)\) and \((x_2, y_2)\) is given by:
\[ d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2} \]
Task:
- Write a function
point_distance(points)wherepointsis a list of pairs of coordinate tuples.
Example input:[((2, 3), (5, 7)), ((1, 1), (4, 5))] - The function should return a list of distances rounded to 2 decimal places.
Expected Output:
Distances: [5.00, 5.00]
Question 5: Centroid of a Triangle (Coordinate Geometry)
Background: For a triangle with vertices \((x_1, y_1), (x_2, y_2), (x_3, y_3)\), the centroid \((x_c, y_c)\) is calculated as:
\[ x_c = \frac{x_1 + x_2 + x_3}{3}, \quad y_c = \frac{y_1 + y_2 + y_3}{3} \]
Task:
- Write a function
centroid(coords)that accepts a list of three coordinate tuples. - Return the centroid coordinates as a tuple rounded to 2 decimal places.
Expected Output:
Centroid: (4.67, 2.33)
Question 6: Moment of Inertia for a Rectangular Beam Section (Mechanics of Materials)
Background: For a rectangular cross-section, the moment of inertia \(I\) about its base is given by:
\[ I = \frac{b h^3}{12} \]
where \(b\) = breadth (m) and \(h\) = depth (m).
Task:
- Write a function
moment_inertia(b, h)that accepts lists of breadths and depths. - Return moments of inertia rounded to 5 decimal places.
Expected Output:
Moments of Inertia: [0.00123, 0.00289, 0.00500]
Common Rational Rubric (Applicable to All Questions)
| Criterion | Description | Marks |
|---|---|---|
| 1. Logic and Formula Application | Correct implementation of engineering or physics formula; proper unit handling and understanding of parameters. | 40 |
| 2. Function Design and Reusability | Function correctly defined, with meaningful parameters and appropriate return values. | 20 |
| 3. Python Constructs and Efficiency | Correct use of comprehensions, loops, arithmetic, conditionals, and built-in functions without redundancy. | 15 |
| 4. Output Formatting and Rounding | Results presented clearly, rounded to required precision, and output structured for readability. | 15 |
| 5. Clarity and Documentation | Use of descriptive variable names and brief explanatory comments. | 10 |
| Total | 100 | |
Demonstration: Calling the Functions in Python
The following snippet shows one possible way in which each function can be called from a Python session or script. Inputs are supplied directly as lists and tuples, matching the constraints given above.
# Example calls for testing:
# 1. DMS to Decimal Degrees
dms_to_decimal(
[54, 23, 89],
[15, 27, 59],
[30, 30, 59]
)
# 2. Tangent Lengths
tangent_length(
[200, 350],
[45, 60]
)
# 3. Time Periods
time_period([0.8, 1.2, 1.5])
# 4. Point Distances
point_distance([((2, 3), (5, 7)), ((10, 4), (13, 9))])
# 5. Centroid
centroid([(2, 3), (6, 1), (6, 3)])
# 6. Moment of Inertia
moment_inertia([0.2, 0.3], [0.4, 0.5])
Worked Solutions: Narrative and Code
The sections below present one possible implementation for each question. The code respects the given constraints: use of functions, list comprehensions, full-precision calculations, and rounding only at the display stage. Each explanation is placed in a note box for quick reference.
1. DMS to Decimal Degrees
Angle observations recorded in D–M–S format are converted to decimal degrees using a direct numeric translation of the surveying formula.
def dms_to_decimal(deg, mins, secs):
values = [d + m/60 + s/3600 for d, m, s in zip(deg, mins, secs)]
rounded = [round(v, 4) for v in values]
print(rounded)
return rounded
Note on the DMS Conversion Function
Each entry from the three input lists is combined through zip, so a single comprehension can apply the full conversion formula D + M/60 + S/3600 consistently across all observations. The intermediate values are kept at full precision, with rounding to four decimal places only at the end, matching the required output format and preserving the original input order.
2. Tangent Length of a Simple Circular Curve
The tangent length depends on both the curve radius and the deflection angle, and is obtained by applying the standard geometric relation for circular curves.
import math
def tangent_length(R, delta_deg):
values = [r * math.tan(math.radians(d/2)) for r, d in zip(R, delta_deg)]
rounded = [round(v, 2) for v in values]
print(rounded)
return rounded
Note on the Tangent Length Calculation
The function converts each deflection angle Δ from degrees to radians using math.radians and applies T = R * tan(Δ/2) inside a list comprehension. This ensures that each radius–angle pair produces a single tangent length. Rounding to two decimal places at the end provides values in a form suitable for design tables and alignment reports.
3. Time Period of a Compound Pendulum
The time period depends on the pendulum length and gravitational acceleration, with the formula involving a square root and the constant 2π.
import math
def time_period(lengths):
g = 9.81
values = [2 * math.pi * math.sqrt((2*l)/(3*g)) for l in lengths]
rounded = [f"{v:.3f}" for v in values]
print(rounded)
return rounded
Note on the Pendulum Time Period Function
The constant g = 9.81 is fixed once inside the function, and the expression 2 * π * √(2L / 3g) is applied directly for each length in the input list. A formatted string with three decimal places is used for the final display, giving a uniform representation that aligns with typical laboratory timing precision.
4. Distance Between Two Points
Planar distances between pairs of points are obtained by applying the Euclidean distance formula to each tuple of coordinates.
import math
def point_distance(points):
values = [math.sqrt((p2[0]-p1[0])**2 + (p2[1]-p1[1])**2)
for p1, p2 in points]
rounded = [round(v, 2) for v in values]
print(rounded)
return rounded
Note on the Point Distance Function
The input list carries each pair of points as ((x1, y1), (x2, y2)), and the comprehension unpacks these directly into the squared difference expression. Using a single square root call per pair maintains both clarity and efficiency, and rounding to two decimal places yields distances in a form that can be directly used in setting-out or checking calculations.
5. Centroid of a Triangle
The centroid is found by averaging the coordinates of the three vertices, giving the balance point of the triangle.
def centroid(coords):
x_vals = [c[0] for c in coords]
y_vals = [c[1] for c in coords]
xc = round(sum(x_vals)/3, 2)
yc = round(sum(y_vals)/3, 2)
result = (xc, yc)
print(result)
return result
Note on the Centroid Function
The function separates the x- and y-components into two short comprehensions, making the averaging step straightforward to read. Division by three matches the definition of the centroid for a triangle, and rounding each coordinate to two decimal places provides a stable location suitable for further geometric or structural calculations.
6. Moment of Inertia of a Rectangular Section
The moment of inertia about the base is computed from the section breadth and depth using the standard expression for rectangular sections.
def moment_inertia(b, h):
values = [bi * (hi**3) / 12 for bi, hi in zip(b, h)]
rounded = [round(v, 5) for v in values]
print(rounded)
return rounded
Note on the Moment of Inertia Function
Each breadth–depth pair is processed using I = b * h**3 / 12 inside a comprehension, preserving the one-to-one mapping between input sections and output inertia values. Rounding to five decimal places respects the precision typically seen when working with metre-based dimensions and derived section properties.