SQL, a fourth-generation language, is mainly used for:
- A.Designing web pages
- B.Working with databases
- C.Writing operating systems
- D.Editing images
Correct answer
B. Working with databases
Explanation
The correct answer is B, working with databases. SQL stands for Structured Query Language, and it is used to create tables, insert rows, update and delete data and, above all, to ask questions of a relational database with statements such as SELECT; it is called non-procedural because the programmer states what result is wanted and the database system decides how to obtain it. Option A is wrong because web pages are laid out with HTML and styled with CSS, and made interactive with JavaScript. Option C is wrong because operating systems are written mainly in C, which gives direct control of memory and hardware; UNIX is the classic example. Option D is wrong because image editing is done by application software such as a photo editor, not by a query language. The fifth generation, which comes after SQL, contains PROLOG and LISP and is associated with artificial intelligence.
Read the full article: Programming Languages: Generations, Compilers and PYQs
Practice Questions
View allWhich of the following is considered the first high-level programming language?
- A.COBOL
- B.FORTRAN
- C.BASIC
- D.Pascal
Show answer
Correct answer: B. FORTRAN
Explanation
The correct answer is B, FORTRAN. Its name is short for Formula Translation, it was developed by a team under John Backus at IBM and released in 1957, and it was the first language in which a programmer could write ordinary algebraic formulas instead of machine codes, which is why it is counted as the first high-level language; it is still used for heavy scientific and engineering computation. Option A is wrong because COBOL came two years later, in 1959, and was designed for business and commercial data processing, with Grace Hopper as the moving spirit behind it. Option C is wrong because BASIC was written in 1964 by John Kemeny and Thomas Kurtz to teach beginners, long after FORTRAN. Option D is wrong because Pascal was designed by Niklaus Wirth around 1970 to teach structured programming and is named after the mathematician Blaise Pascal. Keep the four years in order and this family of questions becomes easy.
The C programming language was developed by:
- A.James Gosling
- B.Bjarne Stroustrup
- C.Dennis Ritchie
- D.Guido van Rossum
Show answer
Correct answer: C. Dennis Ritchie
Explanation
The correct answer is C, Dennis Ritchie. He created C at Bell Laboratories in the early 1970s and used it to rewrite the UNIX operating system, which is why C is called the mother of system programming languages and still underlies most operating systems. Option A is wrong because James Gosling developed Java at Sun Microsystems and released it in 1995, having first named it Oak. Option B is wrong because Bjarne Stroustrup extended C with classes and objects and named the result C++, so he is the creator of C++ and not of C. Option D is wrong because Guido van Rossum created Python and released the first version in 1991. Examiners set this as a match-the-pair question with all four names in one column, so learn the set together: Ritchie for C, Stroustrup for C++, Gosling for Java, van Rossum for Python, Backus for FORTRAN and Wirth for Pascal.
What is the use of the 'javac' command?
- A.Execute a java program
- B.Debug a java program
- C.Interpret a java program
- D.Compile a java program
Show answer
Correct answer: D. Compile a java program
Explanation
The correct answer is D, compile a java program. The command javac is the Java compiler: it takes a source file with the extension .java, checks its grammar and converts it into a class file containing bytecode, the intermediate code that any Java Virtual Machine can run. Option A is wrong because a compiled program is executed by the separate command java, which loads the class file into the virtual machine and starts it. Option B is wrong because debugging is done with a tool such as jdb or the debugger built into a development environment, not with javac, which only reports errors of grammar. Option C is wrong because interpretation of the bytecode is the work of the Java Virtual Machine at the time the program runs; javac finishes its work before that. Remember the two-step chain that makes Java platform independent: javac produces bytecode, and the virtual machine on each computer runs that bytecode.
Which translator converts a high-level program into machine language one statement at a time?
- A.Compiler
- B.Interpreter
- C.Assembler
- D.Loader
Show answer
Correct answer: B. Interpreter
Explanation
The correct answer is B, interpreter. An interpreter reads one statement of the source program, translates it and executes it immediately before moving to the next, so it stops at the first error it meets and tells the programmer about that error alone; this makes it convenient for learning and for testing small pieces of code, though execution is slower because translation happens every time the program runs. Option A is wrong because a compiler translates the entire program in one pass, lists all the errors together and produces an object file that runs quickly thereafter. Option C is wrong because an assembler is a special translator that converts assembly language, a second-generation language, into machine code. Option D is wrong because a loader does no translation at all; it merely places the ready executable program into main memory so that the processor can start it. BASIC and Python are the standard examples of interpreted languages.
Which of the following is NOT a java primitive type?
- A.short
- B.long
- C.long double
- D.boolean
Show answer
Correct answer: C. long double
Explanation
The correct answer is C, long double. Java has exactly eight primitive data types, namely byte, short, int, long, float, double, char and boolean, and long double is not among them; it belongs to C and C++, where it denotes an extended precision floating point number, so the option is a deliberate trap for candidates who have learnt C first. Option A is wrong as an answer because short is a genuine Java primitive, a sixteen-bit signed integer. Option B is wrong because long is also genuine, a sixty-four-bit signed integer used when int is too small. Option D is wrong because boolean is a primitive that holds only the two values true and false and is the type of every condition in Java. A useful way to hold the eight in mind is to group them: four integer types, two floating point types, one character type and one logical type.