Which one among the following is NOT a non-procedural computer language?
- (a)LISP
- (b)Python
- (c)Prolog
- (d)ML
Correct — B, Python. A non-procedural, or declarative, language lets you state the result you want and leaves the order of execution to the language's own engine. A procedural language makes you spell out the steps. LISP and ML are functional languages in which a program is an expression to be evaluated, and Prolog is a logic language in which you assert facts and rules and let an inference engine search for an answer. All three are non-procedural. Python is imperative at its core: you write assignments, loops and calls, and they run in the order written. Python is therefore the single name on the list that is not non-procedural, which is exactly what the double negative in the stem asks for.
- (a)LISP — LISP, written by John McCarthy in 1958, is the original functional language. A LISP program is a nest of expressions to be evaluated rather than an ordered list of commands, which puts it in the non-procedural family.
- (c)Prolog — Prolog is the textbook logic language. The programmer supplies facts and rules; the built-in resolution engine decides how to search for a proof. Nothing in the source code fixes the order of execution.
- (d)ML — ML, the Meta Language designed at Edinburgh in the 1970s and the ancestor of OCaml and F#, is a statically typed functional language. Its style is declarative, like LISP's.
Languages are grouped by how much of the 'how' the programmer has to supply. In a procedural or imperative language the source is an ordered list of instructions that change the machine's state — C, FORTRAN, COBOL, Pascal and Python all work this way. In a non-procedural or declarative language the source describes the goal and a built-in engine works out the route: SQL asks for rows without saying how to fetch them, Prolog asks for a proof, LISP and ML evaluate expressions.
Two things are being tested at once. The first is the double negative — 'NOT a non-procedural language' means 'which one IS procedural', and reversing it once too often flips the answer. The second is whether you classify a language by its family rather than by how familiar it feels. Python does support functional constructs such as map and lambda, but its normal idiom is a loop with an assignment inside, and no syllabus places it beside LISP, Prolog and ML.
- Procedural or imperative languages state the sequence of steps: C, FORTRAN, COBOL, Pascal, Python.
- Non-procedural or declarative languages state the result wanted: SQL, Prolog, LISP, ML, Haskell.
- LISP dates from 1958 and ML from the 1970s; both are functional. Prolog dates from 1972 and is a logic language.
- Python is multi-paradigm but imperative in its core model, which is why it breaks the pattern here.
- SQL is the declarative language most candidates already use — you name the rows you want, never the search strategy.
The stem asks which one is NOT non-procedural, so the odd name out is the answer.
- Reading the double negative once and answering 'which is non-procedural'.
- Assuming the newest language on a list must be the odd one out for some other reason.
- Treating Python's lambda and map as proof that it belongs with LISP.
A classification item dressed in a double negative — the examiner wants the paradigm of four named languages, and hides it behind 'NOT a non-procedural'.
Which language uses the symbolic representation of machine codes needed to program a particular processor or processor family?
- (a) Machine Language
- (b) Assembly Language
- (c) High-Level Language
- (d) All of the above
Answer(b) Assembly Language
The same classification skill from the opposite end of the ladder. That item asks which language sits closest to the processor; this one asks which sits furthest from step-by-step instruction. Between them they fix the whole spectrum from machine code to declarative.
- practice — not a real PYQ
Which one of the following is a declarative language used to query relational databases?
- (a)C
- (b)SQL
- (c)FORTRAN
- (d)Assembly
Answer(b) SQL — you state which rows you want and the database engine chooses how to find them.
- practice — not a real PYQ
Prolog is best described as which type of language?
- (a)Logic
- (b)Assembly
- (c)Machine
- (d)Markup
Answer(a) Logic — it works from facts and rules through an inference engine.