Computer Knowledge

Programming Languages and Compilers

2,284 Questions

Programming languages and compilers involve the rules, syntax, and semantics used to write and execute software programs. Key areas include scripting languages, object oriented concepts, and parsing algorithms like top down parsers. Practice these computer science questions to build proficiency for technical and computer knowledge exams.

Object oriented languagesScripting languagesCompilers and parsersProgramming syntax

Programming Languages and Compilers Questions

Multiple choice
  1. High-level language

  2. Codes

  3. Programs

  4. Mnemonics

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Compilers and interpreters are software programs that translate high-level source code into machine-executable code.

Multiple choice
  1. ALGOL

  2. SNOBOL

  3. MIRANDA

  4. FORTRAN

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

ALGOL, SNOBOL, and FORTRAN were all languages used on early IBM mainframes. Miranda is a functional programming language developed much later (1985) and was not used on the IBM 7000 series.

Multiple choice
  1. C

  2. C++

  3. ADA

  4. FORTRAN

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

C++ is a well-known object-oriented programming language, being an extension of C with classes. C is a procedural language, and ADA and FORTRAN are also primarily procedural.

Multiple choice
  1. Top-down parsing

  2. Bottom-up parsing

  3. Both (1) and (2)

  4. None of the above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Top-down parsers (like LL parsers) fail and enter infinite loops when faced with left-recursive grammars. Bottom-up parsers (like LR parsers) are capable of handling left-recursive productions effectively.

Multiple choice
  1. Lex

  2. Yaac

  3. TeX

  4. Emacs

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Yacc (Yet Another Compiler Compiler) is a parser generator that creates parsers from grammar specifications. It works with Lex to build complete compiler front-ends. Lex handles lexical analysis while Yacc handles syntax analysis according to context-free grammars. TeX is typesetting software and Emacs is a text editor.

Multiple choice
  1. lexical analyzer.

  2. scanner.

  3. parser.

  4. code generator.

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Syntax analysis, or parsing, is the stage where the compiler checks if the sequence of tokens conforms to the grammar of the programming language. This task is performed by the parser.

Multiple choice
  1. a machine language

  2. an assembly language

  3. a high level language

  4. all of the above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Assembly language uses mnemonics (like MOV, ADD) and symbolic labels (variable names) to represent machine instructions, making it more readable than raw machine code.

Multiple choice
  1. designs an algorithm

  2. codes an algorithm in a programming language

  3. debugs the program

  4. all of the above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Program development is a holistic process that includes defining the algorithm, writing the code, and testing/debugging to ensure correctness.

Multiple choice
  1. PASCAL

  2. BASIC

  3. FORTRAN

  4. Both (1) & (3)

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Pascal was designed to encourage good programming practices, such as structured programming, by enforcing strict data typing and block structures. BASIC and early FORTRAN were historically less structured, though modern versions have evolved.

Multiple choice
  1. PASCAL

  2. SNOBOL

  3. FORTRAN

  4. None of the above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

SNOBOL (String Oriented Symbolic Language) is a classic programming language specifically designed for string manipulation and pattern matching. Pascal and FORTRAN are general-purpose languages.

Multiple choice
  1. are compatible with each other

  2. can be supported by any operating system

  3. have the same syntax

  4. none of the above

Reveal answer Fill a bubble to check yourself
B Correct answer