// Sample cards written for this demonstration. Every question is original. const AREAS = [{"id": "planning", "name": "Survey Planning", "weight": 25}, {"id": "field", "name": "Field Data Collection", "weight": 15}, {"id": "data", "name": "Data Analysis and Evaluation", "weight": 30}, {"id": "mapping", "name": "Mapping", "weight": 10}, {"id": "construction", "name": "Construction Surveying", "weight": 20}]; const FAMILIES = [{"name": "Horizontal curves", "problems": 6}, {"name": "Traverse and coordinates", "problems": 6}, {"name": "Leveling", "problems": 4}, {"name": "Maps and contours", "problems": 4}, {"name": "Grades and slope staking", "problems": 4}, {"name": "Control and planning", "problems": 3}, {"name": "Errors and accuracy", "problems": 3}, {"name": "Distance measurement", "problems": 2}, {"name": "Vertical curves", "problems": 2}, {"name": "Earthwork and volumes", "problems": 2}, {"name": "Coordinate systems", "problems": 2}, {"name": "Areas", "problems": 1}, {"name": "GNSS", "problems": 1}]; const BOOK_EXAMS = []; const CARDS = [ {"id": "hc-1", "area": "data", "family": "Horizontal curves", "topic": "curve length", "mode": "calculation", "q": "A circular curve has radius 800 ft and central angle 40°00'00\". Length of the curve is most nearly:", "sol": "L = R × Δ (radians) = 800 × 40×π/180 = 558.51 ft.", "tier": "High", "src": "Sample card written for this demonstration", "c": ["558.51 ft", "291.18 ft", "547.23 ft", "586.39 ft"], "a": 0, "grp": "hc", "score": 1.0, "ord": 0}, {"id": "hc-2", "area": "data", "family": "Horizontal curves", "topic": "tangent length", "mode": "calculation", "q": "Same curve. Tangent length T is most nearly:", "sol": "T = R tan(Δ/2) = 800 × tan 20° = 291.18 ft.", "tier": "High", "src": "Sample card written for this demonstration", "c": ["273.62 ft", "291.18 ft", "671.28 ft", "279.25 ft"], "a": 1, "ctx": "A circular curve has radius 800 ft and central angle 40°00'00\".", "grp": "hc", "score": 0.998, "ord": 1}, {"id": "hc-3", "area": "data", "family": "Horizontal curves", "topic": "long chord", "mode": "calculation", "q": "Same curve. Long chord LC is most nearly:", "sol": "LC = 2R sin(Δ/2) = 2 × 800 × sin 20° = 547.23 ft.", "tier": "High", "src": "Sample card written for this demonstration", "c": ["558.51 ft", "582.35 ft", "547.23 ft", "514.23 ft"], "a": 2, "ctx": "A circular curve has radius 800 ft and central angle 40°00'00\".", "grp": "hc", "score": 0.996, "ord": 2}, {"id": "hc-4", "area": "data", "family": "Horizontal curves", "topic": "curve stationing", "mode": "calculation", "q": "Same curve, with the PI at station 12+40.00. Station of the PT is most nearly:", "sol": "PC = PI − T = 9+48.82; PT = PC + L = 15+07.33. The PT is found along the curve, not by adding T to the PI.", "tier": "High", "src": "Sample card written for this demonstration", "c": ["15+31.18", "15+07.33", "14+96.06", "15+19.25"], "a": 1, "ctx": "A circular curve has radius 800 ft and central angle 40°00'00\".", "grp": "hc", "score": 0.994, "ord": 3}, {"id": "tr-1", "area": "data", "family": "Traverse and coordinates", "topic": "traverse closure", "mode": "calculation", "q": "A closed traverse has a latitude error of -0.24 ft and a departure error of +0.32 ft. Perimeter 3,200.00 ft. Linear error of closure is most nearly:", "sol": "e = √(0.24² + 0.32²) = 0.40 ft.", "tier": "High", "src": "Sample card written for this demonstration", "c": ["0.56 ft", "0.40 ft", "0.08 ft", "0.32 ft"], "a": 1, "grp": "tr", "score": 0.988, "ord": 6}, {"id": "tr-2", "area": "data", "family": "Traverse and coordinates", "topic": "traverse precision", "mode": "calculation", "q": "Same traverse. Relative precision is most nearly:", "sol": "Precision = e / perimeter = 0.40 / 3,200 = 1/8,000.", "tier": "High", "src": "Sample card written for this demonstration", "c": ["1/5,700", "1/8,000", "1/10,000", "1/13,300"], "a": 1, "ctx": "A closed traverse has a latitude error of -0.24 ft and a departure error of +0.32 ft. Perimeter 3,200.00 ft.", "grp": "tr", "score": 0.986, "ord": 7}, {"id": "tr-3", "area": "data", "family": "Traverse and coordinates", "topic": "azimuth and bearing", "mode": "calculation", "q": "A line has an azimuth (from north) of 237°15'00\". Its bearing is:", "sol": "237°15' is in the SW quadrant: bearing = S (237°15' − 180°) W = S 57°15'00\" W.", "tier": "High", "src": "Sample card written for this demonstration", "c": ["N 57°15'00\" W", "S 57°15'00\" W", "S 32°45'00\" W", "N 57°15'00\" E"], "a": 1, "grp": "tr-3", "score": 0.984, "ord": 8}, {"id": "tr-4", "area": "data", "family": "Traverse and coordinates", "topic": "latitude and departure", "mode": "calculation", "q": "A course is 450.00 ft long on a bearing of N 35°00'00\" E. Its latitude and departure are most nearly:", "sol": "Lat = L cos β = 368.62 ft (north, +); Dep = L sin β = 258.11 ft (east, +).", "tier": "High", "src": "Sample card written for this demonstration", "c": ["Lat 258.11, Dep 368.62", "Lat 368.62, Dep 258.11", "Lat −368.62, Dep 258.11", "Lat 368.62, Dep −258.11"], "a": 1, "grp": "tr-4", "score": 0.982, "ord": 9}, {"id": "tr-5", "area": "data", "family": "Traverse and coordinates", "topic": "inverse", "mode": "calculation", "q": "Point A is at N 1,000.00, E 1,000.00 and point B at N 1,300.00, E 1,400.00. Distance and bearing from A to B:", "sol": "ΔN = 300, ΔE = 400. Distance = √(300²+400²) = 500.00 ft; bearing = N tan⁻¹(400/300) E = N 53°07'48\" E.", "tier": "High", "src": "Sample card written for this demonstration", "c": ["500.00 ft, N 53°07'48\" E", "500.00 ft, N 36°52'12\" E", "700.00 ft, N 45°00'00\" E", "500.00 ft, S 53°07'48\" W"], "a": 0, "grp": "tr-5", "score": 0.98, "ord": 10}, {"id": "fd-1", "area": "field", "family": "Distance measurement", "topic": "temperature correction", "mode": "calculation", "q": "A steel tape standardized at 68°F is used at 98°F to measure 600.00 ft. The corrected distance is most nearly (α = 6.45×10⁻⁶ /°F):", "sol": "C = α × ΔT × L = 6.45×10⁻⁶ × 30 × 600 = +0.116 ft. A warm tape is too long, so it reads short: add the correction. 600.12 ft.", "tier": "High", "src": "Sample card written for this demonstration", "c": ["599.88 ft", "600.00 ft", "600.12 ft", "600.23 ft"], "a": 2, "grp": "fd-1", "score": 0.968, "ord": 16}, {"id": "fd-2", "area": "field", "family": "Distance measurement", "topic": "slope reduction", "mode": "calculation", "q": "A slope distance of 350.00 ft is measured on a 6°30'00\" vertical angle. The horizontal distance is most nearly:", "sol": "H = S cos θ = 350.00 × cos 6.5° = 347.75 ft.", "tier": "High", "src": "Sample card written for this demonstration", "c": ["347.75 ft", "39.62 ft", "352.26 ft", "350.00 ft"], "a": 0, "grp": "fd-2", "score": 0.966, "ord": 17}, {"id": "lv-1", "area": "field", "family": "Leveling", "topic": "differential leveling", "mode": "calculation", "q": "A backsight of 4.52 ft is taken on a benchmark at elevation 1,200.00 ft. A foresight of 7.18 ft is read on point X. Elevation of X:", "sol": "HI = 1,200.00 + 4.52 = 1,204.52. Elev X = HI − FS = 1,204.52 − 7.18 = 1,197.34 ft.", "tier": "High", "src": "Sample card written for this demonstration", "c": ["1,202.66 ft", "1,197.34 ft", "1,211.70 ft", "1,195.48 ft"], "a": 1, "grp": "lv-1", "score": 0.964, "ord": 18}, {"id": "lv-2", "area": "field", "family": "Leveling", "topic": "height of instrument", "mode": "conceptual", "q": "In differential leveling, what is the height of instrument (HI)?", "sol": "The elevation of the line of sight: the known elevation plus the backsight. Every foresight is subtracted from it.", "tier": "High", "src": "Sample card written for this demonstration", "grp": "lv-2", "score": 0.962, "ord": 19}, {"id": "pl-1", "area": "planning", "family": "Control and planning", "topic": "closure standard", "mode": "calculation", "q": "A traverse with a 5,000-ft perimeter must meet a precision of 1/10,000. The largest allowable linear error of closure is:", "sol": "Allowable error = perimeter × precision = 5,000 / 10,000 = 0.50 ft.", "tier": "High", "src": "Sample card written for this demonstration", "c": ["0.05 ft", "0.50 ft", "2.00 ft", "5.00 ft"], "a": 1, "grp": "pl-1", "score": 0.956, "ord": 22}, {"id": "pl-2", "area": "planning", "family": "Control and planning", "topic": "control first", "mode": "conceptual", "q": "Why is control established before detail (topography, stakeout) on a project?", "sol": "Control is the accurate framework everything else ties to. Working from the whole to the part keeps small errors in detail from adding up across the site.", "tier": "High", "src": "Sample card written for this demonstration", "grp": "pl-2", "score": 0.954, "ord": 23}, {"id": "mp-1", "area": "mapping", "family": "Maps and contours", "topic": "map scale", "mode": "calculation", "q": "On a map at 1\" = 200', two points are 2.35 in apart. The ground distance is:", "sol": "2.35 in × 200 ft/in = 470 ft.", "tier": "High", "src": "Sample card written for this demonstration", "c": ["235 ft", "470 ft", "85 ft", "4,700 ft"], "a": 1, "grp": "mp-1", "score": 0.944, "ord": 28}, {"id": "cn-1", "area": "construction", "family": "Grades and slope staking", "topic": "grade elevation", "mode": "calculation", "q": "Station 10+00 has a design elevation of 520.00 ft on a −1.50% grade. The design elevation at station 13+50:", "sol": "Δ = −0.015 × 350 ft = −5.25 ft. 520.00 − 5.25 = 514.75 ft.", "tier": "High", "src": "Sample card written for this demonstration", "c": ["514.75 ft", "525.25 ft", "519.48 ft", "505.00 ft"], "a": 0, "grp": "cn-1", "score": 0.936, "ord": 32}, {"id": "cn-2", "area": "construction", "family": "Grades and slope staking", "topic": "cut or fill", "mode": "calculation", "q": "Ground elevation at a stake is 534.20 ft and design grade is 530.75 ft. The stake is marked:", "sol": "Ground is above grade by 534.20 − 530.75 = 3.45 ft, so it is a cut: C 3.45.", "tier": "High", "src": "Sample card written for this demonstration", "c": ["F 3.45", "C 3.45", "C 0.00", "F 0.00"], "a": 1, "grp": "cn-2", "score": 0.934, "ord": 33}, {"id": "cn-3", "area": "construction", "family": "Grades and slope staking", "topic": "slope stake offset", "mode": "calculation", "q": "A cut section has a 20-ft half-width to the toe of the cut slope, side slopes of 2:1 (horizontal:vertical) and a cut of 6.0 ft at the catch point. Offset from centerline to the slope stake:", "sol": "Offset = half-width + slope ratio × cut = 20 + 2 × 6.0 = 32.0 ft.", "tier": "High", "src": "Sample card written for this demonstration", "c": ["26.0 ft", "32.0 ft", "23.0 ft", "40.0 ft"], "a": 1, "grp": "cn-3", "score": 0.932, "ord": 34}, {"id": "vc-1", "area": "construction", "family": "Vertical curves", "topic": "high point", "mode": "calculation", "q": "A crest vertical curve joins a +2.00% grade to a −1.50% grade, length 600 ft. Distance from the BVC to the high point is most nearly:", "sol": "x = g₁ L / (g₁ − g₂) = 2.00 × 600 / 3.50 = 342.86 ft.", "tier": "High", "src": "Sample card written for this demonstration", "c": ["300.00 ft", "342.86 ft", "257.14 ft", "400.00 ft"], "a": 1, "grp": "vc", "score": 0.93, "ord": 35}, {"id": "cn-4", "area": "construction", "family": "Earthwork and volumes", "topic": "average end area", "mode": "calculation", "q": "End areas of 210 sq ft and 330 sq ft are 100 ft apart. The volume by average end areas is:", "sol": "V = (A₁ + A₂)/2 × L / 27 = 270 × 100 / 27 = 1,000 cu yd.", "tier": "High", "src": "Sample card written for this demonstration", "c": ["1,000 cu yd", "2,000 cu yd", "27,000 cu yd", "500 cu yd"], "a": 0, "grp": "cn-4", "score": 0.926, "ord": 37}, {"id": "hc-5", "area": "data", "family": "Horizontal curves", "topic": "degree of curve", "mode": "calculation", "q": "Degree of curve (arc definition) for a 800-ft radius is most nearly:", "sol": "D = 5,729.58 / R = 7.1620° = 7°09'43\".", "tier": "Medium", "src": "Sample card written for this demonstration", "c": ["7°09'43\"", "5°43'46\"", "7°18'36\"", "3°34'52\""], "a": 0, "grp": "hc-5", "score": 0.592, "ord": 4}, {"id": "hc-6", "area": "data", "family": "Horizontal curves", "topic": "curve terms", "mode": "conceptual", "q": "On a circular curve, what is the PI?", "sol": "The point of intersection: where the two tangents, extended, meet. The curve starts at the PC and ends at the PT.", "tier": "Medium", "src": "Sample card written for this demonstration", "grp": "hc-6", "score": 0.59, "ord": 5}, {"id": "tr-6", "area": "planning", "family": "Traverse and coordinates", "topic": "angle closure", "mode": "calculation", "q": "The interior angles of a closed seven-sided traverse should add up to:", "sol": "Sum of interior angles = (n − 2) × 180° = 5 × 180° = 900°.", "tier": "Medium", "src": "Sample card written for this demonstration", "c": ["720°", "900°", "1,080°", "1,260°"], "a": 1, "grp": "tr-6", "score": 0.578, "ord": 11}, {"id": "ar-1", "area": "data", "family": "Areas", "topic": "area by coordinates", "mode": "calculation", "q": "A triangular lot has corners at (E 0, N 0), (E 400, N 0) and (E 150, N 300), in feet. Its area is most nearly:", "sol": "Area = ½ |x₁(y₂−y₃) + x₂(y₃−y₁) + x₃(y₁−y₂)| = ½ × 400 × 300 = 60,000 sq ft = 60,000 / 43,560 = 1.38 acres.", "tier": "Medium", "src": "Sample card written for this demonstration", "c": ["1.38 acres", "2.75 acres", "0.69 acres", "1.84 acres"], "a": 0, "grp": "ar-1", "score": 0.576, "ord": 12}, {"id": "er-1", "area": "data", "family": "Errors and accuracy", "topic": "error propagation", "mode": "calculation", "q": "A distance is taped in four segments, each with a standard error of ±0.02 ft. The standard error of the total is:", "sol": "Random errors add in quadrature: √(4 × 0.02²) = 0.02 × √4 = ±0.04 ft.", "tier": "Medium", "src": "Sample card written for this demonstration", "c": ["±0.08 ft", "±0.04 ft", "±0.02 ft", "±0.01 ft"], "a": 1, "grp": "er-1", "score": 0.574, "ord": 13}, {"id": "er-3", "area": "data", "family": "Errors and accuracy", "topic": "error types", "mode": "conceptual", "q": "Which kind of error cannot be removed by a correction and is reduced only by repeating measurements?", "sol": "Random errors have no fixed sign or size, so no single correction removes them; averaging repeats reduces them. Systematic errors are corrected; blunders are found and thrown out.", "tier": "Medium", "src": "Sample card written for this demonstration", "c": ["Systematic error", "Random error", "Blunder", "Instrument calibration error"], "a": 1, "grp": "er-3", "score": 0.57, "ord": 15}, {"id": "lv-3", "area": "field", "family": "Leveling", "topic": "curvature and refraction", "mode": "calculation", "q": "Combined curvature and refraction for a 5,000-ft sight is most nearly (h = 0.0206 F², F in thousands of feet):", "sol": "h = 0.0206 × 5² = 0.515 ft, about 0.52 ft. Balancing backsight and foresight lengths cancels it.", "tier": "Medium", "src": "Sample card written for this demonstration", "c": ["0.10 ft", "0.52 ft", "0.67 ft", "2.06 ft"], "a": 1, "grp": "lv-3", "score": 0.56, "ord": 20}, {"id": "pl-3", "area": "planning", "family": "GNSS", "topic": "PDOP", "mode": "conceptual", "q": "For a GNSS observation session, which PDOP value is the best?", "sol": "PDOP measures satellite geometry; lower is better. Under about 3 is good; many specifications reject sessions above 6.", "tier": "Medium", "src": "Sample card written for this demonstration", "c": ["1.8", "4.5", "7.0", "12.0"], "a": 0, "grp": "pl-3", "score": 0.552, "ord": 24}, {"id": "pl-4", "area": "planning", "family": "Coordinate systems", "topic": "grid to ground", "mode": "calculation", "q": "A grid distance is 1,000.00 ft and the combined factor is 0.99985. The ground distance is most nearly:", "sol": "Ground = grid / combined factor = 1000.00 / 0.99985 = 1,000.15 ft.", "tier": "Medium", "src": "Sample card written for this demonstration", "c": ["999.85 ft", "1,000.15 ft", "1,000.00 ft", "1,001.50 ft"], "a": 1, "grp": "pl-4", "score": 0.55, "ord": 25}, {"id": "pl-6", "area": "planning", "family": "Control and planning", "topic": "benchmarks", "mode": "conceptual", "q": "What is a benchmark?", "sol": "A benchmark is a stable, permanent point whose elevation is known. A temporary benchmark (TBM) is set for the duration of a job.", "tier": "Medium", "src": "Sample card written for this demonstration", "c": ["A point with a known horizontal position only", "A permanent point of known elevation", "A temporary stake for grading", "A property corner monument"], "a": 1, "grp": "pl-6", "score": 0.546, "ord": 27}, {"id": "mp-2", "area": "mapping", "family": "Maps and contours", "topic": "representative fraction", "mode": "calculation", "q": "A map scale of 1:2,400 is the same as:", "sol": "2,400 in on the ground per inch on the map = 2,400 / 12 = 200 ft per inch.", "tier": "Medium", "src": "Sample card written for this demonstration", "c": ["1\" = 24'", "1\" = 200'", "1\" = 2,400'", "1\" = 100'"], "a": 1, "grp": "mp-2", "score": 0.542, "ord": 29}, {"id": "mp-3", "area": "mapping", "family": "Maps and contours", "topic": "contour interpolation", "mode": "calculation", "q": "Two spot elevations, 101.3 ft and 108.7 ft, are 74 ft apart. How far from the lower point does the 105-ft contour cross?", "sol": "Linear interpolation: (105 − 101.3) / (108.7 − 101.3) × 74 = 3.7 / 7.4 × 74 = 37.0 ft.", "tier": "Medium", "src": "Sample card written for this demonstration", "c": ["37.0 ft", "33.0 ft", "50.0 ft", "5.0 ft"], "a": 0, "grp": "mp-3", "score": 0.54, "ord": 30}, {"id": "vc-2", "area": "construction", "family": "Vertical curves", "topic": "middle ordinate", "mode": "calculation", "q": "Same curve. The middle ordinate (curve below the PVI) is most nearly:", "sol": "e = A L / 8 with A in % and L in stations = 3.50 × 6 / 8 = 2.625 ft, about 2.63 ft.", "tier": "Medium", "src": "Sample card written for this demonstration", "c": ["1.31 ft", "2.63 ft", "5.25 ft", "0.88 ft"], "a": 1, "ctx": "A crest vertical curve joins a +2.00% grade to a −1.50% grade, length 600 ft.", "grp": "vc", "score": 0.528, "ord": 36}, {"id": "cn-5", "area": "construction", "family": "Earthwork and volumes", "topic": "swell and shrinkage", "mode": "conceptual", "q": "Why do earthwork estimates use swell and shrinkage factors?", "sol": "Soil takes more volume once excavated (swell) and less once compacted (shrinkage). Bank, loose and compacted yards differ, so haul and fill quantities are adjusted.", "tier": "Medium", "src": "Sample card written for this demonstration", "grp": "cn-5", "score": 0.524, "ord": 38}, {"id": "er-2", "area": "data", "family": "Errors and accuracy", "topic": "standard error of the mean", "mode": "calculation", "q": "Five repeated measurements of a distance have a standard deviation of 0.030 ft. The standard error of the mean is most nearly:", "sol": "σ_mean = σ / √n = 0.030 / √5 = 0.013 ft.", "tier": "Low", "src": "Sample card written for this demonstration", "c": ["0.006 ft", "0.013 ft", "0.030 ft", "0.067 ft"], "a": 1, "grp": "er-2", "score": 0.272, "ord": 14}, {"id": "lv-4", "area": "field", "family": "Leveling", "topic": "reciprocal leveling", "mode": "conceptual", "q": "Why do surveyors use reciprocal leveling across a river?", "sol": "A wide river stops you from setting up halfway. Reading across from both banks and averaging cancels the errors that balanced sights normally cancel.", "tier": "Low", "src": "Sample card written for this demonstration", "c": ["To save time on long lines", "Because sights cannot be balanced there, so reading from both sides averages out curvature, refraction and collimation error", "To avoid needing a benchmark", "To measure the river's depth"], "a": 1, "grp": "lv-4", "score": 0.258, "ord": 21}, {"id": "pl-5", "area": "planning", "family": "Coordinate systems", "topic": "combined factor", "mode": "conceptual", "q": "What makes up the combined factor used to convert between ground and grid distances?", "sol": "Combined factor = grid scale factor × elevation (sea-level) factor. Grid distance = ground distance × combined factor.", "tier": "Low", "src": "Sample card written for this demonstration", "grp": "pl-5", "score": 0.248, "ord": 26}, {"id": "mp-4", "area": "mapping", "family": "Maps and contours", "topic": "reading contours", "mode": "conceptual", "q": "Contour lines that are close together show:", "sol": "Close spacing means elevation changes quickly over a short distance: steep ground. Wide spacing is gentle.", "tier": "Low", "src": "Sample card written for this demonstration", "c": ["Flat ground", "Steep ground", "A depression", "A ridge line"], "a": 1, "grp": "mp-4", "score": 0.238, "ord": 31}, {"id": "cn-6", "area": "construction", "family": "Grades and slope staking", "topic": "offset stakes", "mode": "conceptual", "q": "Why are construction stakes often set on an offset line instead of on the exact point?", "sol": "Grading and excavation wipe out stakes on the line itself. An offset (say 10 ft) keeps the reference alive through construction.", "tier": "Low", "src": "Sample card written for this demonstration", "c": ["They are cheaper", "Stakes on the work line would be destroyed by the equipment; offsets survive and the crew measures back", "Offsets are more accurate", "Codes forbid stakes on the line"], "a": 1, "grp": "cn-6", "score": 0.222, "ord": 39} ];