Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

51.

A CFG is ambiguous if(a) It has more than one rightmost derivations(b) It has more than one leftmost derivations(c) No parse tree can be generated for the CFG(d) None of the mentionedThe question was posed to me in final exam.The query is from Ambiguous Grammar in section Context Free Grammars and Languages of Automata Theory

Answer»

Correct choice is (B) It has more than one leftmost derivations

Explanation: A context FREE grammar is ambiguous if it has more than one PARSE tree generated or more than one leftmost derivations. An unambiguous grammar is a context free grammar for which EVERY valid string has a unique leftmost DERIVATION.

52.

Which among the following are true for an Extensible markup language?(a) Human Readable/ Machine Readable(b) Extended from SGML(c) Developed by www consortium(d) All of the mentionedThis question was posed to me in semester exam.This intriguing question originated from Markup Languages topic in division Context Free Grammars and Languages of Automata Theory

Answer»

Correct ANSWER is (d) All of the mentioned

The EXPLANATION: XML is an open FORMAT MARKUP language with a filename EXTENSION of .xml.

53.

__________ is the acyclic graphical representation of a grammar.(a) Binary tree(b) Oct tree(c) Parse tree(d) None of the mentionedI got this question by my college professor while I was bunking the class.This question is from Construction and Yield of a Parse Tree topic in chapter Context Free Grammars and Languages of Automata Theory

Answer»

Right answer is (C) Parse tree

Explanation: In order to GRAPHICALLY represent a derivation of a grammar we NEED to use parse TREES.

54.

SGML stands for:(a) Standard Generalized Markup Language(b) Standardized General Markup Language(c) Standard General Markup Language(d) Standard Generalized Markdown LanguageThis question was addressed to me at a job interview.I would like to ask this question from Markup Languages in section Context Free Grammars and Languages of Automata Theory

Answer»

Right option is (a) Standard Generalized Markup Language

The BEST EXPLANATION: SGML is an acronym for Standard Generalized Markup Language.

55.

If |w|>=2^h, then its parse tree’s height is at least _____(a) h(b) h+1(c) h-1(d) 2^hI have been asked this question by my school teacher while I was bunking the class.Origin of the question is Inferences to Trees, Trees to Derivations topic in section Context Free Grammars and Languages of Automata Theory

Answer»

Right choice is (b) H+1

The explanation is: It is the basic IMPLICATION of Parse tree THEOREM (assuming CNF). If the height of the parse tree is h, then |w| <=2^h-1.

56.

A grammar with more than one parse tree is called:(a) Unambiguous(b) Ambiguous(c) Regular(d) None of the mentionedI have been asked this question at a job interview.I need to ask this question from Construction and Yield of a Parse Tree topic in division Context Free Grammars and Languages of Automata Theory

Answer»

The correct choice is (b) Ambiguous

To EXPLAIN: A context free grammar G is ambiguous if there is at least ONE STRING in L(G) having TWO or more distinct derivation trees or equivalently, two or more distinct leftmost DERIVATIONS.

57.

To derive a string using the production rules of a given grammar, we use:(a) Scanning(b) Parsing(c) Derivation(d) All of the mentionedThis question was addressed to me in an online interview.This intriguing question comes from Applications in chapter Context Free Grammars and Languages of Automata Theory

Answer»

The CORRECT choice is (b) Parsing

To explain: Parsing is required to check the ACCEPTABILITY of a string. Further, comes the SYNTACTICAL PHASE which is taken care by other phases of compiler.

58.

Left corner parsing methof uses which of the following?(a) Top down parser(b) Bottom up parser(c) TOP down and Bottom up parser(d) None of the mentionedThe question was asked in an interview for job.This intriguing question comes from Applications in portion Context Free Grammars and Languages of Automata Theory

Answer»

Right ANSWER is (c) TOP down and Bottom up parser

The best I can explain: It is a HYBRID method which WORKS bottom up ALONG the left edges of each subtree, and top down on the rest of the parse tree.

59.

Which of the following statement is false?(a) Context free language is the subset of context sensitive language(b) Regular language is the subset of context sensitive language(c) Recursively ennumerable language is the super set of regular language(d) Context sensitive language is a subset of context free languageThis question was posed to me in a national level competition.My question is from Context Free Grammar-Derivations and Definitions topic in chapter Context Free Grammars and Languages of Automata Theory

Answer»

Right choice is (d) Context sensitive LANGUAGE is a subset of context free language

Best explanation: EVERY regular language can be PRODUCED by context free grammar and context free language can be produced by context sensitive grammar and so on.

60.

Which among the following is the root of the parse tree?(a) Production P(b) Terminal T(c) Variable V(d) Starting Variable SI had been asked this question during an interview.I would like to ask this question from Construction and Yield of a Parse Tree in section Context Free Grammars and Languages of Automata Theory

Answer»

Right choice is (d) Starting Variable S

To ELABORATE: The root is labelled by the start symbol. All the leaves are either labelled by a a TERMINAL or with e.

61.

Which of the following is not an example of electronic mark up?(a) HTML(b) LaTeX(c) PostScript(d) None of the mentionedI had been asked this question in exam.My question is based upon Markup Languages in division Context Free Grammars and Languages of Automata Theory

Answer»

The CORRECT option is (d) None of the mentioned

Easiest EXPLANATION: There are three CATEGORIES ofelectronic markup: presentational, procedural, and descriptive markup. EXAMPLES are XML, HTML, LATEX, etc.

62.

A DTD is associated with a XML file by means of ___________(a) Function(b) (c) Macros(d) None of the mentionedThe question was asked in homework.I need to ask this question from Markup Languages topic in section Context Free Grammars and Languages of Automata Theory

Answer»

The correct CHOICE is (B)

Easy EXPLANATION: A document TYPE definition defines the legal building blocks of an XML document .

63.

State true or false:Statement: BNF is a metasyntax used to express CFG(a) Statement: BNF is a metasyntax used to express CFG(b) True(c) FalseThis question was posed to me in class test.The query is from YACCParser Generator in chapter Context Free Grammars and Languages of Automata Theory

Answer»

The correct choice is (a) Statement: BNF is a metasyntax used to express CFG

Best explanation: BNF is a metasyntax used to express CONTEXT free grammar, MOREOVER a FORMAL way to express the language.

64.

XML uses _________ principle to formally describe the data.(a) DDL(b) DTD(c) DML(d) None of the mentionedThis question was posed to me in class test.I'm obligated to ask this question of Markup Languages in section Context Free Grammars and Languages of Automata Theory

Answer»

Correct choice is (b) DTD

Explanation: A document type definition (DTD) is a set of markup DECLARATIONS that define a document type for an SGML-family markup language (SGML, XML, HTML). A Document Type Definition (DTD) defines the legal building BLOCKS of an XML document. It defines the document STRUCTURE with a list of legal elements and ATTRIBUTES.

65.

Which of the following is false for BNF?(a) BNF means Backus Naur Form(b) It is a normal form used in Data base normalization(c) It is a notation technique for context free grammar(d) None of the mentionedThis question was posed to me in an international level competition.This interesting question is from YACCParser Generator topic in chapter Context Free Grammars and Languages of Automata Theory

Answer»

The correct choice is (b) It is a NORMAL form USED in Data base normalization

Best EXPLANATION: The normal form used in Data base normalization is BCNF i.e. Boyce CODD normal form and NOT Backus Naur Form.

66.

The minimum number of productions required to produce a language consisting of palindrome strings over∑={a,b} is(a) 3(b) 7(c) 5(d) 6The question was posed to me in an interview for job.This key question is from Context Free Grammar-Derivations and Definitions in chapter Context Free Grammars and Languages of Automata Theory

Answer»

The correct option is (C) 5

For explanation I would say: The GRAMMAR which produces a PALINDROME set can be written as:

S-> aSa | BSB | E | a | b

L={e, a, b, aba, abbbaabbba…..}

67.

Which of the following are distinct to parse trees?(a) abstract parse trees(b) sentence diagrams(c) both abstract parse trees and sentence diagrams(d) none of the mentionedI had been asked this question during an interview for a job.I'm obligated to ask this question of Inferences to Trees, Trees to Derivations topic in section Context Free Grammars and Languages of Automata Theory

Answer»

The correct choice is (c) both abstract parse trees and SENTENCE diagrams

Easiest EXPLANATION: Both of the mentioned are DIFFERENT from parse trees. Sentence diagrams are PICTORIAL representations of grammatical STRUCTURE of a sentence.

68.

In which order are the children of any node ordered?(a) From the left(b) From the right(c) Arbitrarily(d) None of the mentionedThis question was posed to me in a job interview.This is a very interesting question from Construction and Yield of a Parse Tree topic in section Context Free Grammars and Languages of Automata Theory

Answer» RIGHT OPTION is (a) From the left

The explanation: The children of a node are ordered from the left and DRAWN so. If N is to the left of node M, then all the descendents of N are consideredto be to the left of all the descendents of M.
69.

State true or false:Statement: Every right-linear grammar generates a regular language.(a) Statement: Every right-linear grammar generates a regular language.(b) True(c) FalseThe question was asked during a job interview.Question is from Sentential Forms topic in portion Context Free Grammars and Languages of Automata Theory

Answer»

Correct OPTION is (a) Statement: EVERY right-linear grammar generates a regular language.

For explanation I would SAY: A CFG is said to right linear if each production body has at most one variable, and that variable is at the right END. That is, all productions of a right linear grammar are of the form A->wB or A->w, where A and B are variables while w is some terminal.