Ez Computerहिन्दीOpen app

Programming Languages and Translators

Preview Part D: Software and Programming · Chapter 15 · 17 min read · 79 practice questions

After this chapter you will be able to

  • classify languages as low-level and high-level, and by generation (1GL–5GL)
  • match major languages with their creators, years and uses
  • compare compiler, interpreter and assembler
  • explain linker, loader, source code and object code
  • identify syntax, runtime and logical errors
Programming Languages Basics Syntax = grammar Semantics = meaning Source code Levels 1GL–5GL 1GL, 2GL: low-level 3GL: high-level 4GL SQL, 5GL Prolog Translators Assembler (2GL) Compiler: all at once Interpreter: per line Key languages FORTRAN: first (1957) COBOL: business C: Dennis Ritchie Errors Syntax: compile time Runtime: while running Logical: wrong result C basics 32 keywords & address, * pointer # preprocessor
Chapter 15 at a glance Recall the five language levels, the three translators and the three error types.

15.1 What Is a Programming Language?

A programming language is a formal set of words, symbols and rules (syntax) used to write instructions for a computer.

15.2 Levels and Generations

1GL Machine language 10110000 01100001 Only 0s and 1s 2GL Assembly language MOV AX, 5 Uses mnemonics 3GL High-level language C, Java, Python Machine-independent 4GL Very high-level SQL Say what, not how 5GL Logic / AI languages Prolog Rules and constraints
Five generations of languages Lower rungs are closer to the CPU; higher rungs are closer to human language. Only 1GL runs directly on the CPU.
Mouse Ate Hot Veg Lunch M Mouse Machine 1GL A Ate Assembly 2GL H Hot High-level 3GL V Veg Very high-level 4GL L Lunch Logic / AI 5GL
Mouse Ate Hot Veg Lunch The first letters M, A, H, V, L give the five language generations, from machine (1GL) to logic / AI (5GL).
Generation Type Features Examples
1GL Machine language Only 0s and 1s; directly understood by the CPU; fastest; machine-dependent; very hard to write 10110000 01100001
2GL Assembly language Uses mnemonics (ADD, SUB, MOV, JMP); needs an assembler; machine-dependent MOV AX, 5
3GL High-level (procedural) English-like; machine-independent (portable); needs compiler/interpreter FORTRAN, COBOL, BASIC, C, C++, Java, Python
4GL Very high-level (non-procedural) Say what you want, not how; used for databases and reports SQL, report generators, MATLAB, FOCUS
5GL AI / logic / constraint-based Solve problems from given rules and constraints Prolog, Mercury, OPS5
Feature Low-level (1GL, 2GL) High-level (3GL+)
Closeness to Machine Human language
Portability Machine-dependent Machine-independent
Speed of execution Faster Slower (needs translation)
Ease of writing Difficult Easy
Debugging Hard Easier
Translator Assembler (for assembly); none for machine code Compiler / interpreter

★ EXAM POINT

  • The only language the computer understands directly = machine language (binary).
  • Assembly language uses mnemonics and needs an assembler.
  • SQL is a 4GL; Prolog is a 5GL.
  • FORTRAN is the first widely used high-level language.
  • LISP is the second-oldest high-level language still in use (after FORTRAN).

What the full chapter covers

The full chapter has these sections:

  1. 15.1 What Is a Programming Language?
  2. 15.2 Levels and Generations
  3. 15.3 Important Languages
  4. 15.4 Language Translators
  5. 15.5 Types of Programming Errors
  6. 15.6 C Language Essentials
  7. 15.7 More Exam Facts
  8. Chapter Quick Revision
  9. Most Important Terms
  10. Common Confusions
  11. Rapid Recall

Sample questions from this chapter

1. Escape sequence for backspace?

  1. \r
  2. \n
  3. \t
  4. \b
Show answer

Answer: D. \b

\b is the backspace escape sequence; it moves the cursor one position back.

2. Symbol that ends a C statement?

  1. Colon (:)
  2. Period (.)
  3. Semicolon (;)
  4. Comma (,)
Show answer

Answer: C. Semicolon (;)

Every C statement ends with a semicolon; a missing semicolon is a syntax error.

3. Language for numerically controlled machine tools?

  1. APT
  2. LISP
  3. COBOL
  4. SNOBOL
Show answer

Answer: A. APT

APT (Automatically Programmed Tools) was developed at MIT to program numerically controlled machine tools.

4. Language used for web page structure?

  1. CSS
  2. JavaScript
  3. HTML
  4. PHP
Show answer

Answer: C. HTML

HTML (Hypertext Markup Language) defines the structure and content of a web page; it is a markup language.

5. Language whose applets run inside browsers?

  1. Scala
  2. Java
  3. Ada
  4. Erlang
Show answer

Answer: B. Java

Java applets are small programs that run inside a web browser, which made Java popular for Internet programming.