CD Quiz Test-1
Question 1: [Mark : 1] [-ve Mark : 0]
What language does the following DFA compute?
Option A : {w?w is a string that contains exactly three 0's}
Option B : {w?w is a string that contains exactly one or three 0's}
Option C : {w?w is a string that does not contain exactly two 0's}
Option D : {w?w is a string that does not contain more than four 0's}
Question 2: [Mark : 1] [-ve Mark : 0]
What is the DFA for the language {w?w starts with a and has at most one b}?
i) ii) iii)
iv)
Option A : i)
Option B : ii)
Option C : iii)
Option D : iv)
Question 3: [Mark : 1] [-ve Mark : 0]
Which of the following are always unambiguous:
(i) Producing one left-most and one right-most derivation,
(ii) Producing one left-most but may be multiple right-most derivation,
(iii) Producing one right-most but may be multiple left-most derivation
Option A : Only (i)
Option B : Only (ii)
Option C : Only (iii)
Option D : (i), (ii) and (iii)
Question 4: [Mark : 1] [-ve Mark : 0]
Find the ‘FOLLOW(T)’ from the following grammar
Option A : {a, +, $}
Option B : {+, $}
Option C : {+, $, )}
Option D : {+, )}
Question 5: [Mark : 1] [-ve Mark : 0]
A grammar with following production rules contains
Option A : Left factor
Option B : left recursion
Option C : Both Left factor and left recursion
Option D : ambiguity
Question 6: [Mark : 1] [-ve Mark : 0]
Which one of the following grammars is free from left recursion?
Option A : A
Option B : B
Option C : C
Option D : D
Question 7: [Mark : 1] [-ve Mark : 0]
For the following grammar, What will be the FIRST (S)?
Option A : {b, c}
Option B : {a, b}
Option C : {a, b, c}
Option D : {a, b, c, ?}
Question 8: [Mark : 1] [-ve Mark : 0]
Which of the following is not true in case of top down parsing?
(i) It will read input from left to right,
(ii) It follows rightmost derivation,
(iii) It is also known as LL(1),
(iv) In case of string derivation, it starts from the string and proceed untill the start symbol is derived.
Option A : (i) and (iii)
Option B : (ii) and (iv)
Option C : Only (iv)
Option D : (i), (iii) and (iv)
Question 9: [Mark : 1] [-ve Mark : 0]
Compute the FOLLOW(B) for the following grammar.
Option A : { h , g , $ }
Option B : { g , $ , b , h }
Option C : { $ , a , h , g }
Option D : { g , $ , h, ?}
Question 10: [Mark : 1] [-ve Mark : 0]
Option A : M[A,x]
Option B : M[C,y]
Option C : M[B,y]
Option D : M[B,x]
Question 11: [Mark : 1] [-ve Mark : 0]
Option A : A
Option B : B
Option C : C
Option D : D
Question 12: [Mark : 1] [-ve Mark : 0]
In Shift-Reduce parsing, handle is at
Option A : Top of the stack
Option B : Bottom of the stack
Option C : Anywhere in the stack
Option D : Not in the stack
Question 13: [Mark : 1] [-ve Mark : 0]
Suppose there is a compiler for C language hat can generate code for computer A. Which of the
following statement is true?
Option A : It cann be used for Computer A only
Option B : It can be used for any computer
Option C : It can be used only for computers with similar processor and operating system
Option D : It can be used only for computers with similar processor, operating system and peripherals
Question 14: [Mark : 1] [-ve Mark : 0]
Which of the following data structure may be good if there are frequent search for data items followed
by insertion and deletion?
Option A : Stack
Option B : Array
Option C : Tree
Option D : Hash Table
Question 15: [Mark : 1] [-ve Mark : 0]
Which Phase of the compiler does not use symbol table?
Option A : Lexical
Option B : Syntax
Option C : Code Generation
Option D : None of the other options
Question 16: [Mark : 1] [-ve Mark : 0]
A programming language does not allow integer division operation. This is generally detected in the
phase of _____.
Option A : Lexical
Option B : Syntax
Option C : Semantic
Option D : None of the other options
Question 17: [Mark : 1] [-ve Mark : 0]
A compiler can check
Option A : Logical error
Option B : Syntax error
Option C : Both Logical error and syntax error
Option D : No logical and syntax error
Question 18: [Mark : 1] [-ve Mark : 0]
The regular expression (0|1(01*0)*1)* will accept all strings
Option A : Divisible by 2
Option B : Divisible by 3
Option C : Divisible by 4
Option D : Divisible by 2 and 4
Question 19: [Mark : 1] [-ve Mark : 0]
A regular expression for accepting strings with number of 1's are twice as of number of 0’s is
Option A : (11+0)*
Option B : (0|1)*1(0|1)*|1(0|1)*
Option C : 0*(11)*+(11)*0
Option D : Not possible
Question 20: [Mark : 1] [-ve Mark : 0]
The number of tokens in the following C statement is:
Option A : 24
Option B : 27
Option C : 25
Option D : 28
Question 21: [Mark : 1] [-ve Mark : 0]
A compiler that runs on one machine and produces code for a different machine is called
Option A : Bootstrap compiler
Option B : Quick and dirty compiler
Option C : weak compiler
Option D : Cross compiler
Question 22: [Mark : 1] [-ve Mark : 0]
Let L1={0} and L2=?. Which of the following is the language L1L2*?L1*
Option A : {?}
Option B : {?,0}
Option C : ?
Option D : 0*
Question 23: [Mark : 1] [-ve Mark : 0]
A Compiler is defined as
(i) Part of system software
(ii) Part of operating System
(iii) Part of machine code
Option A : Both (i) and (ii)
Option B : Only (i)
Option C : Only (ii)
Option D : Both (ii) and (iii)
Powered by TCPDF ([Link])