Which of the following is not a top-down language?
- (a)C
- (b)FORTRAN
- (c)JAVA
- (d)Pascal
Correct — C, (c) JAVA. The ask is negative — the booklet prints the word not in bold italic — so the option wanted is the one language in the set that is not organised around the top-down approach, and that is Java. Top-down design starts with the whole problem, splits it into sub-problems, and keeps splitting until each piece is small enough to be written as a procedure. The technique has a name, stepwise refinement, and the languages built to support it are the procedural and structured ones: the unit of a program is the function or the procedure, control flows from a single entry point, and the structure of the code mirrors the decomposition of the problem. C, FORTRAN and Pascal are all of that family, and Pascal was designed expressly to teach the discipline. Java is organised the other way round. Its unit is the class, which packages data together with the operations on that data, and a program is assembled by composing objects — classes are built and reused, and the application emerges from putting them together. That is bottom-up composition, and it is why an object-oriented language is contrasted with the top-down family. Inheritance, encapsulation and polymorphism are all mechanisms for building larger things out of smaller ready-made ones rather than for cutting one large thing into parts. Java came out of Sun Microsystems, where it was developed by a team led by James Gosling and released in 1995, and it compiles to bytecode that runs on a virtual machine, which is where its portability claim comes from. One caution about the printing: the booklet sets the name in capitals, but Java is a proper noun and not an acronym, unlike FORTRAN, which is a contraction of formula translation.
- (a)C — C is a procedural, structured language and a textbook example of the top-down approach. A C program is a collection of functions with main at the head of the tree, and the ordinary way to write one is to state what main must do, express each step as a call to a function that does not exist yet, and then write those functions in turn — stepwise refinement in its plainest form. The language was developed by Dennis Ritchie at Bell Laboratories in the early 1970s, in the course of rewriting the Unix operating system, and its control constructs are the structured ones: sequence, selection and iteration, with a single entry to each block. It has no classes and no inheritance, so it offers nothing to build a bottom-up composition out of.
- (b)FORTRAN — FORTRAN — the name contracts formula translation — was developed at IBM by a team led by John Backus and first delivered in 1957, which makes it the earliest widely used high-level language. It was written for scientific and engineering computation, its unit of program organisation is the subroutine or function, and a FORTRAN program is decomposed downward from the main program into those subprograms. Later revisions added the structured control constructs that make the discipline easier to follow, and modules that make large programs manageable, but the organising idea remained procedural throughout. It is a top-down language, so it is not what the negative ask is looking for.
- (d)Pascal — Pascal is the strongest evidence against being chosen here, because it was designed for exactly the approach the question names. Niklaus Wirth published it in 1970 as a teaching language for structured programming, and it was Wirth who set out the method of stepwise refinement — take the statement of the problem, refine it into a few steps, refine each of those in turn, and stop when every step is a statement of the language. Pascal's block structure, its nested procedures and its insistence on declaring everything before use are all in the service of that discipline. A program in it is a single decomposition tree with the main program at the root, which is the definition of top-down organisation.
Top-down and bottom-up are two directions for designing a program, and the paradigm a language is built around decides which one it makes natural. In top-down design the whole task is stated first and then decomposed: a problem becomes a handful of steps, each step becomes a procedure, and each procedure is refined until it can be written directly. Niklaus Wirth called this stepwise refinement, and the procedural and structured languages — FORTRAN, COBOL, ALGOL, BASIC, Pascal and C — are the ones that support it, because in all of them the unit of organisation is the procedure or function and the program is a tree of calls with a single root. In bottom-up design the small pieces come first: components with well-defined behaviour are built or taken off the shelf, and the application is composed from them. Object-oriented languages such as Java, C++, Smalltalk and Python are organised for this, because their unit is the class — data and the operations on that data packaged together — and the mechanisms they provide, encapsulation, inheritance and polymorphism, are all mechanisms for reusing and extending existing pieces rather than for cutting a large problem into small ones. Neither direction is exclusive in practice: a large object-oriented system is usually designed downward into subsystems and built upward from classes, and a procedural program can be written from a library of utilities outward. What an examination question of this shape is testing is the standard classification of the languages, not the possibilities open to a determined programmer.
Computer questions in this paper are drawn from the vocabulary of an introductory course, and this one tests whether a candidate can sort four familiar language names by paradigm. The set is well chosen: three procedural languages of three different eras — one from the 1950s, one from 1970 and one from the early 1970s — against a single object-oriented language from 1995, so the discriminating fact is the paradigm and not the age. The negation is printed in bold italic in the stem, as it is on all seventeen negative asks in this booklet, and a candidate who reads the item as which of these is a top-down language will find three defensible answers and no way to choose. Reading the ask first, before the options, is the habit that saves the mark. The wider point is worth carrying into the rest of the block: the Commission tests paradigms, generations and named characteristics of languages rather than syntax, so a table of language, year, designer and paradigm is worth more revision time than any amount of code.
- Top-down design decomposes the whole problem into sub-problems and then into procedures — stepwise refinement — and is the approach procedural and structured languages are organised around.
- Bottom-up design composes an application from smaller ready-made components, which is how object-oriented languages such as Java are organised, with the class as the unit.
- FORTRAN, from formula translation, was developed at IBM under John Backus and first delivered in 1957; it is the earliest widely used high-level language and is procedural.
- Pascal was published by Niklaus Wirth in 1970 as a teaching language for structured programming; Wirth also set out the method of stepwise refinement.
- C was developed by Dennis Ritchie at Bell Laboratories in the early 1970s alongside Unix; it is procedural and structured, with the function as its unit of organisation.
- Java was developed at Sun Microsystems by a team led by James Gosling and released in 1995; it is object-oriented and compiles to bytecode that runs on a virtual machine.
- Java is a proper noun rather than an acronym, although this booklet prints the name in capitals.
- Reading the ask as positive; the negation is set in bold italic and three of the four options are top-down languages
- Sorting the options by age instead of by paradigm — the odd one out here is the newest language, but that is a coincidence of the set and not the reason
- Assuming Java cannot be written in a structured style; it can, and the classification is about how the language is organised, not about what a programmer may do in it
- Confusing top-down design with the top-down parsing of a compiler, which is a different use of the same words
- Treating C++ as procedural because it grew out of C; it supports classes and belongs with the object-oriented family
Language questions in EPFO papers are classification items: which language belongs to a named paradigm, which is the oldest, which is object-oriented, which is a fourth-generation language. They are answered from a table rather than from experience, and the table needs only four columns — name, year, originator and paradigm. Expect the negative form as often as the positive one, and expect the odd option to differ by paradigm rather than by anything visible in the name.
No directly related past PYQ was found.
- practice — not a real PYQ
Which one of the following is an object-oriented programming language?
- (a)COBOL
- (b)FORTRAN
- (c)C++
- (d)BASIC
Answer(c) C++ — it extends C with classes, inheritance and polymorphism, so its unit of organisation is the class and it belongs to the object-oriented family. COBOL, FORTRAN and BASIC are procedural languages whose unit is the procedure or subroutine, and all three are organised for top-down decomposition.
- practice — not a real PYQ
The design technique of stating a problem as a few broad steps and refining each step until it can be written directly in a programming language is known as
- (a)stepwise refinement
- (b)encapsulation
- (c)recursion
- (d)normalisation
Answer(a) stepwise refinement — the name Niklaus Wirth gave to top-down design, in which the decomposition of the problem determines the structure of the program. Encapsulation is an object-oriented mechanism for hiding data behind operations, recursion is a function calling itself, and normalisation is a database design technique.