An example of a fourth-generation programming language is _________.
2017
An example of a fourth-generation programming language is _________.
Answer: D. SQL — CONCEPT: Programming languages are classified into "generations" by how much they abstract away the machine. First- and second-generation languages (machine…
- A.
C
- B.
COBOL
- C.
MERCURY
- D.
SQL
Attempted by 675 students.
Show answer & explanation
Correct answer: D
CONCEPT: Programming languages are classified into "generations" by how much they abstract away the machine. First- and second-generation languages (machine code, assembly) and third-generation languages (3GLs, e.g. procedural languages) all require the programmer to spell out HOW to compute a result, step by step. A fourth-generation language (4GL) instead lets the user state WHAT result is wanted — the underlying engine figures out how to produce it. 4GLs are typically domain-specific (report generation, GUI building, database querying) rather than general-purpose.
APPLICATION: SQL (Structured Query Language) is the textbook example of a 4GL: a query like "SELECT name FROM students WHERE marks > 90" declares WHAT rows are wanted; the database engine decides HOW to fetch them (index choice, join order, etc.). Because SQL is declarative and domain-specific to data retrieval/manipulation rather than a general imperative language, some learners feel it "isn't really programming" — that's a fair intuition, but it is exactly the property (declarative, what-not-how) that puts SQL in the fourth-generation bracket in CS/DBMS curricula, which is the classification this question is testing.
CROSS-CHECK — placing every option by its own generation:
C: a compiled, procedural language from the 1970s — the programmer writes explicit step-by-step instructions (loops, pointers, memory management), the defining trait of a third-generation language.
COBOL: also procedural and imperative, built in the 1960s for business data processing — same third-generation, how-to-compute style as C.
MERCURY: a logic/functional language where a programmer states relationships and constraints for the system to solve — this declarative, knowledge-based style is generally placed a tier ABOVE fourth-generation, in the fifth-generation (AI/logic) bracket.
SQL: declarative and domain-specific to data queries — matches the fourth-generation definition applied above.