1. What is parsing?

  • A)  The process of dividing a string into individual words
  • B) The process of analyzing a string of symbols according to the rules of a formal grammar
  • C) The process of generating machine code from source code
  • D) The process of debugging code for errors
B) The process of analyzing a string of symbols according to the rules of a formal grammar Explanation

2. Which of the following is a widely used compiler-compiler tool for generating parsers?

  • A) Lex
  • B) GCC
  • C) Yacc
  • D) Make
C) Yacc Explanation

3. Which type of grammar is typically used to define the syntax of programming languages for parsers?

  • A) Regular Grammar
  • B) Context-Free Grammar
  • C) Context-Sensitive Grammar
  • D) Unrestricted Grammar
B) Context-Free Grammar Explanation

4. In what type of parsing are lexical analysis and parsing combined?

  • A) Recursive parsing  
  • B) Context-sensitive parsing
  • C) Scannerless parsing
  • D) Syntactic parsing
C) Scannerless parsing Explanation

5. Which algorithm is commonly used for parsing context-free grammars in polynomial time?

  • A) CYK algorithm
  • B) Dijkstra's algorithm
  • C) A* algorithm
  • D) Kruskal's algorithm
A) CYK algorithm Explanation