A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

51. Consider the following statements:

(I) The output of a lexical analyzer is groups of characters.
(II) Total number of tokens in printf("i=%d, &i=%x", i, &i); are 11.
(III) Symbol table can be implementation by using array and hash table but not tree.

Which of the following statement(s) is/are correct?
a. Only (I)
b. Only (II) and (III)
c. All (I), (II), and (III)
d. None of these
View Answer Report Discuss Too Difficult!
Answer: (d).None of these

52. Which one of the following statements is FALSE ?
a. Context-free grammar can be used to specify both lexical and syntax rules.
b. Type checking is done before parsing.
c. High-level language programs can be translated to different Intermediate Representations.
d. Arguments to a function can be passed using the program stack.
View Answer Report Discuss Too Difficult!
Answer: (b).Type checking is done before parsing.

53. A lexical analyzer uses the following patterns to recognize three tokens T1, T2, and T3 over the alphabet {a,b,c}.

T1: a?(b∣c)*a
T2: b?(a∣c)*b
T3: c?(b∣a)*c

Note that ‘x?’ means 0 or 1 occurrence of the symbol x. Note also that the analyzer outputs the token that matches the longest possible prefix. If the string bbaacabc is processes by the analyzer, which one of the following is the sequence of tokens it outputs?
a. T1T2T3
b. T1T1T3
c. T2T1T3
d. T3T3
View Answer Report Discuss Too Difficult!
Answer: (d).T3T3

54. Match the description of several parts of a classic optimizing compiler in List - I, with the names of those parts in List - II:
a. (1)
b. (2)
c. (3)
d. (4)
View Answer Report Discuss Too Difficult!
Answer: (a).(1)

55. The output of a lexical analyzer is
a. A parse tree
b. Intermediate code
c. Machine code
d. A stream of tokens
View Answer Report Discuss Too Difficult!
Answer: (d).A stream of tokens

56. The number of tokens in the following C statement is printf("i=%d, &i=%x", i&i);
a. 13
b. 6
c. 10
d. 9
View Answer Report Discuss Too Difficult!
Answer: (d).9

57. A particular BNF definition for a "word" is given by the following rules. Which of the following lexical entries can be derived from < word > ?
I. pick
II. picks
III. c44
a. I, II and III
b. I and II only
c. l and III only
d. lI and III only
View Answer Report Discuss Too Difficult!
Answer: (d).lI and III only

58. For the grammar below, a partial LL(1) parsing table is also presented along with the grammar. Entries that need to be filled are indicated as E1, E2, and E3. ε is the empty string, $ indicates end of input, and, | separates alternate right hand sides of productions.
a. A
b. B
c. C
d. D
View Answer Report Discuss Too Difficult!
Answer: (a).A

Page 6 of 6