Computer Knowledge

Programming Languages and Compilers

1,170 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. Df $\subset$ Nf and DP $\subset$ NP
  2. Df $\subset$ Nf and DP = NP
  3. Df = Nf and DP = NP

  4. Df = Nf and DP $\subset$ NP
Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Multiple choice
  1. They enhance the portability of the compiler to other target processors

  2. Program analysis is more accurate on intermediate code than on machine code

  3. The information from dataflow analysis cannot otherwise be used for optimization

  4. The information from the front end cannot otherwise be used for optimization

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

Multiple choice
  1. I and II

  2. I and IV

  3. III and IV

  4. I, III and IV

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

Multiple choice
  1. running application software

  2. low level/system programming

  3. high level programming

  4. machine language programming

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

Initially C language was intended for the system programming. For example, UNIX operating system is written in C language.

Multiple choice
  1. (i), (iii)

  2. (ii), (iii)

  3. (i), (ii)

  4. (i), (ii), (iii)

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

The front end performs lexical and syntax analysis (validating statements), semantic analysis (determining content/meaning), and constructs intermediate representation for subsequent phases. All three functions are part of front-end processing.

Multiple choice
  1. right most derivation

  2. left most derivation

  3. right most derivation in reverse

  4. left most derivation in reverse

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

Top-down parsers (including predictive parsers) use leftmost derivation - they expand the leftmost non-terminal at each step. Rightmost derivation is used by bottom-up parsers.

Multiple choice
  1. machine code

  2. intermediate code

  3. a stream of tokens

  4. a parse tree

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

 The output of lexical analyzer is a stream of tokens.

Multiple choice
  1. LL

  2. <font size="2">C</font>anonical LR

  3. SLR

  4. LALR

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

Canonical LR (CLR) is the most powerful parsing method - it handles all grammars that LR parsing can handle, while SLR, LALR, and LL are progressively more restrictive subsets.

Multiple choice
  1. A research institute

  2. A numerical computing environment

  3. A fifth generation programming language

  4. A virtual laboratory

  5. A science fiction

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

MATLAB (matrix laboratory) is a numerical computing environment and fourth-generation programming language.