Self-Assessment Quiz: Fortran 2023 and Beyond
Twenty questions to confirm you can separate what Fortran 2023 shipped from what is coming, and can use the modern ecosystem. Aim for 16 or more. Answers and a topic map are at the end — try the whole quiz first, and note that several questions reward honesty about compiler support over enthusiasm.
Question 1
A Fortran 2023 conditional expression is written as:
- A. cond ? a : b (no parentheses)
- B. ( cond ? a : b ) (parenthesized)
- C. if (cond) a else b
- D. merge(a, b, cond)
Question 2
Which of merge(a, b, mask) and the conditional expression ( mask ? a : b ) evaluates both a and
b?
- A. Only merge
- B. Only the conditional expression
- C. Both
- D. Neither
Question 3
True or false, with justification: "Fortran 2023 conditional expressions compile on any gfortran, because 2023 is now the standard."
Question 4
The Fortran 2003 enum, bind(c) and the Fortran 2023 enumeration type differ mainly in that:
- A. They are identical; 2023 just renamed it
- B. enum, bind(c) makes named integer constants for C interop; the 2023 enumeration type is a distinct,
compiler-checked type
- C. The 2023 version is only for C interop
- D. enum, bind(c) is type-safe and the 2023 version is not
Question 5
What does this print (assume a compiler with the degree intrinsics)?
print '(f8.5)', sind(90.0_dp)
- A.
0.00000 - B.
1.00000 - C.
90.00000 - D. A compile error on every compiler
Question 6
Which Fortran 2023 feature is the one you are most likely to be able to use on a recent gfortran today?
- A. typeof / classof
- B. Enumeration types
- C. Degree-valued trig (sind, cosd, tand)
- D. Conditional expressions
Question 7
Short answer. What does the declaration type specifier typeof(x) do, in one sentence?
Question 8
In the Fortran standards process, WG5 and J3 are best described as: - A. Two names for the same body - B. WG5 is the ISO working group that sets direction and schedule; J3 is the US committee that does the detailed technical drafting - C. J3 sets direction; WG5 writes compilers - D. Both are compiler vendors
Question 9
True or false, with justification: "When ISO publishes a new Fortran standard, every conforming compiler supports all of it on that date."
Question 10
Fortran revisions have appeared at roughly what cadence? - A. Every year - B. Every 2 years - C. Every 5 years (2003, 2008/10, 2018, 2023) - D. Only once, in 1977
Question 11
Short answer. Give the main reason a FORTRAN 77 program with COMMON blocks still compiles under a
Fortran 2023 compiler.
Question 12
fpm is best described as:
- A. A Fortran-to-Python translator
- B. The Fortran Package Manager: it builds projects (deriving module order) and fetches dependencies
- C. A replacement for the ISO standard
- D. A debugger
Question 13
Is stdlib part of the ISO Fortran standard / built into the compiler? - A. Yes, it is in the standard - B. Yes, gfortran ships it - C. No — it is a community package you declare as a dependency (e.g. via fpm) and build - D. No, it does not exist yet
Question 14
The capability that most distinguishes LFortran from gfortran is that LFortran can: - A. Compile Fortran (gfortran cannot) - B. Run Fortran interactively, statement by statement (a REPL / notebook), and power the browser playground - C. Only cross-compile to GPUs - D. Read fixed-form source
Question 15
What does this print?
use, intrinsic :: iso_fortran_env, only: dp => real64
print '(f6.3)', merge(4.0_dp, 6.0_dp, 4.0_dp > 6.0_dp)
- A.
4.000 - B.
6.000 - C.
0.000 - D. A compile error
Question 16
Generics (writing one algorithm parameterized over any type) in Fortran are:
- A. A Fortran 2023 feature you can use now
- B. In active development, targeted for the next standard — not yet shipped
- C. Impossible in Fortran
- D. The same thing as class polymorphism
Question 17
The reduce locality specifier added to do concurrent in Fortran 2023 lets you:
- A. Delete loops
- B. Express a parallel reduction (a sum, a max) in standard Fortran, aiding CPU vectorization or GPU offload
- C. Reduce the number of images
- D. Shrink an array
Question 18
True or false, with justification: "Because do concurrent is standard Fortran, a do concurrent loop is
guaranteed to be offloaded to the GPU by every compiler."
Question 19
Short answer. Give one reason sind(180.0_dp) can be more accurate than sin(180.0_dp * pi / 180.0_dp).
Question 20
The chapter's central honesty rule for talking about the language's future is: - A. Assume every roadmap feature already works - B. Keep shipped facts (Fortran 2023 features) separate from coming proposals (generics, seamless GPU offload) - C. Never mention future features - D. Only trust vendor marketing
Answer Key
| Q | Answer | Rationale |
|---|---|---|
| 1 | B | The conditional expression must be parenthesized: ( cond ? a : b ). |
| 2 | A | merge is a function, so both value arguments are evaluated; the conditional expression evaluates only the selected branch. |
| 3 | False | A standard is a document; conditional-expression support is landing unevenly and older gfortran rejects the ? : form. Keep a fallback. |
| 4 | B | 2003 enum, bind(c) = named integer constants (C interop, no new type); 2023 enumeration type = a distinct, checked type. |
| 5 | B | sind(90°) = 1, printed f8.5 as 1.00000. |
| 6 | C | sind/cosd/tand are long-standing gfortran extensions, standardized in 2023 — usually available now. |
| 7 | — | typeof(x) declares an entity to have the same declared type (and parameters) as x, without naming that type. |
| 8 | B | WG5 (ISO) steers direction/schedule; J3 (US committee) does detailed technical drafting. |
| 9 | False | Compilers implement features on their own schedules; availability lags publication, often by years. |
| 10 | C | Roughly every five years. |
| 11 | — | Near-total backward compatibility: obsolete features are marked "obsolescent," rarely deleted, to preserve validated legacy code. |
| 12 | B | fpm builds projects (deriving module compile order) and manages git dependencies. |
| 13 | C | stdlib is a community package (declared as a dependency, built via fpm), not part of the standard or the compiler. |
| 14 | B | LFortran runs Fortran interactively and powers the browser playground — something gfortran cannot do. |
| 15 | B | 4 > 6 is false, so merge returns the false-branch value 6.000. |
| 16 | B | Generics are in development for a future revision; not yet in any released standard/compiler. |
| 17 | B | reduce expresses a parallel reduction in standard Fortran, aiding vectorization/offload. |
| 18 | False | GPU offload of do concurrent is compiler-specific (e.g., nvfortran does it); it is not guaranteed by the standard or supported everywhere. |
| 19 | — | pi is not representable, so 180 * pi/180 introduces rounding; sind can return exactly 0 at nice angles. |
| 20 | B | Keep shipped 2023 facts separate from coming proposals — honesty over hype. |
Topics to review by question
| Questions | Review |
|---|---|
| 1, 2, 15 | §39.1 — conditional expressions vs merge (short-circuit) |
| 4, 14 (enums)/3, 5, 6, 7, 19 | §39.1 — enumeration types, typeof, degree trig, support honesty |
| 8, 9, 10, 11 | §39.2 — J3/WG5, cadence, backward compatibility |
| 12, 13, 14 | §39.3 — fpm, stdlib, LFortran/playground |
| 16, 17, 18, 20 | §39.4 — generics, do concurrent reduce, GPU, honest forecasting |
Scoring. 18–20: you can tell shipped from coming and use the modern tools — excellent. 14–17: solid; revisit the "usable today?" table in §39.1. Below 14: reread §39.1 and §39.2, then try one feature in the Playground.