Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Filter by Categories
nmims post
Objective Type Set
Online MCQ Assignment
Question Solution
Solved Question
Uncategorized

Multiple choice question for engineering

Set 1

1. Let R1 and R2 be regular sets defined over alphabet ∑ then
a) R1 UNION R2 is regular
b) R1 INTERSECTION R2 is regular
c) ∑ INTERSECTION R2 IS NOT REGULAR
d) R2* IS NOT REGULAR

View Answer

Answer: a [Reason:] Union of 2 regular languages is regular.

2. Which of the following String can be obtained by the language L = {ai b2i / i >=1}?
a) aaabbbbbb
b) aabbb
c) abbabbba
d) aaaabbbabb

View Answer

Answer: a [Reason:] Above production rule gives suppose if 3 a’s the corresponding b’s are 6 b’s.

3. Give a production grammar for the language L = {x/x ∈ (a,b)*, the number of a’s in x is multiple of 3}.
a) {S->bS, S->b,S->aA, S->bA, A->aB, B->bB, B->aS, S->a}
b) {S->aS,S->bA,A->bB,B->bBa,B->bB}
c) {S->aaS,S->bbA,A->bB,B->ba}
d) None of the above

View Answer

Answer: a [Reason:] The above given condition is satisfied by S->bS S->B S->aA s->bA A->aB B->bB B->aS S->a.

4. The production Grammar is {S->aSbb, S->abb} is
a) type-3 grammar
b) type-2 grammar
c) type-1 grammar
d) type-0 grammar

View Answer

Answer: b [Reason:] Type 2 grammar satisfies this production grammar.

5. Regular expression (x/y)(x/y) denotes the set
a) {xy,xy}
b) {xx,xy,yx,yy}
c) {x,y}
d) {x,y,xy}

View Answer

Answer: b [Reason:] The expression gives aa or xy or yx or yy.

6. Regular expression x/y denotes the set
a) {x,y}
b) {xy}
c) {x}
d) {y}

View Answer

Answer: a [Reason:] x or y is given by the expression.

7. The regular expression denote a language comprising all possible strings of even length over the alphabet (0,1)
a) 1 + 0(1+0)*
b) (0+1)(1+0)*
c) (1+0)
d) (00+0111+10)*

View Answer

Answer: d [Reason:] The condition is satisfied by 00 or 0111 or 10 or iterations of these.

8. The regular expressions denote zero or more instances of an x or y is
a) (x+y)
b) (x+y)*
c) (x* + y)
d) (xy)*

View Answer

Answer: b [Reason:] It says that either its x or y or iterations of them.

Set 2

1. Select a Machine Independent phase of the compiler
a) Syntax Analysis
b) Intermediate Code generation
c) Lexical Analysis
d) All of the mentioned

View Answer

Answer: a [Reason:] All of them work independent of a machine.

2. A system program that combines the separately compiled modules of a program into a form suitable for execution?
a) Assembler
b) Compiler
c) Linking Loader
d) Interpreter

View Answer

Answer: c [Reason:] A loader which combines the functions of a relocating loader with the ability to combine a number of program segments that have been independently compiled.

3. Which of the following system software resides in the main memory always
a) Text Editor
b) Assembler
c) Linker
d) Loader

View Answer

Answer: d [Reason:] Loader is used to loading programs.

4. Output file of Lex is _____ the input file is Myfile.
a) Myfile.e
b) Myfile.yy.c
c) Myfile.lex
d) Myfile.obj

View Answer

Answer: b [Reason:] This Produce the filr “myfile.yy.c” which we can then compile with g++.

5. Type checking is normally done during
a) Lexical Analysis
b) Syntax Analysis
c) Syntax Directed Translation
d) Code generation

View Answer

Answer: c [Reason:] It is the function of Syntax directed translation.

6. Suppose One of the Operand is String and other is Integer then it does not throw error as it only checks whether there are two operands associated with ‘+’ or not .
a) True
b) False

View Answer

Answer: a [Reason:] Syntax analyser does not check the type of the operand.

7. In Short Syntax Analysis Generates Parse Tree.
a) True
b) False

View Answer

Answer: a [Reason:] Short Syntax Analysis generates a parse tree.

8. By whom is the symbol table created?
a) Compiler
b) Interpreter
c) Assembler
d) None of the mentioned

View Answer

Answer: a [Reason:] Symbol table is created by the compiler which contains the list of lexemes or tokens.

9. What does a Syntactic Analyser do?
a) Maintain Symbol Table
b) Collect type of information
c) Create parse tree
d) None of the mentioned

View Answer

Answer: c [Reason:] Syntax analyzer will just create parse tree. Semantic Analyzer checks the meaning of the string parsed.

10. Semantic Analyser is used for
a) Generating Object code
b) Main ting symbol table
c) None of the mentioned
d) Both of the mentioned

View Answer

Answer: d [Reason:] Maintaining the Symbol Table for each block. Source Program for Semantic Errors. Collects Type Information for Code Generation. Reporting compile-time errors in the code generating the object code (e.g., assembler or intermediate code).

Set 3

1. Which is not true about syntax and semantic parts of a computer language?
a) Semantics is checked mechanically by a computer
b) Semantics is the responsibility of the programmer
c) Both of the mentioned
d) None of the mentioned

View Answer

Answer: d [Reason:] Both in terms of semantics is not true.

2. Which of the following statement is true?
a) SLR powerful than LALR
b) LALR powerful than Canonical LR parser
c) Canonical LR powerful than LALR parser
d) The parsers SLR= Canonical LR=LALR

View Answer

Answer: c [Reason:] LR >LALR>SLR In terms of parser.

3. Which of the following features cannot be captured by CFG ?
a) Syntax of if-then-else statements
b) Syntax of recursive procedures
c) A variable is declared before its use
d) Matching nested parenthesis

View Answer

Answer: d [Reason:] It is because, it is equivalent to recognizing us, where the first w is the declaration and the second is its use, we are not a CFG.

4. In which of the following no information hiding is done?
a) Compile prig 1, prig 2
b) Run test, prog
c) Load R1 , A
d) 001001000010101

View Answer

Answer: d [Reason:] The entire binary symbol gives the information.

5. The identification of common sub-expression and replacement of run-time computations by compile-time computations is
a) Local optimization
b) Loop optimization
c) Constant folding
d) Data flow analysis

View Answer

Answer: c [Reason:] Constant folding is the process of recognizing and evaluating constant expressions at compile time rather than computing them at runtime. Terms in constant expressions are typically simple literals they may also be variables whose values are assigned at compile time.

6. The graph that shows basic blocks and their successor relationship is called
a) Dag
b) Flow Graph
c) Control Graph
d) Hamilton Graph

View Answer

Answer: b [Reason:] Flow graph shows the basic blocks.

7. The specific task storage manager performs
a) Allocation/ deal location of programs
b) Protection of storage area assigned to the program
c) Both of the mentioned
d) None of the mentioned

View Answer

Answer: c [Reason:] Its basic function is that of the task storage manager.

8. When a computer is rebooted, a special type of loader is executed called
a) Compile and GO ” loader
b) Boot loader
c) Bootstrap Loader
d) Relating Loader

View Answer

Answer: c [Reason:] A boot loader, is a small program that places the operating system (OS) of a computer into memory.

9. Disadvantage of ” Compile and GO ” loading scheme is that
a) Memory is wasted because the case occupied by the assembler is unavailable to the object program
b) Necessary to translate the users program
c) It is very difficult to handle multiple segments, even when the source programs are in different languages and to produce orderly modular programs
d) All of the mentioned

View Answer

Answer: d [Reason:] In computer programming, a compile and go system, compile, load, and go system, assemble and go system, or load and go system[1][2][3] is a programming language processor in which the compilation, assembly, or link steps are not separated from program execution.

10. Function of the storage assignment is
a) Assign storage to all variables referenced in the source program
b) Assign storage to all temporary locations that are necessary for intermediate results
c) Assign storage to literals, and to ensure that the storage is allocated and appropriate locations are initialized
d) All of the mentioned

View Answer

Answer: d [Reason:] The storage assignment performs the above mentioned tasks.

Set 4

1. A non relocatable program is the one which
a) Cannot execute in any area of storage other than the one designated
b) Consists of a program and information for its relocation
c) None of the mentioned
d) All of the mentioned

View Answer

Answer: a [Reason:] A non reloadable program is one which cannot be made to execute in any area of storage other than the one designated for it at the time of its coding or translation.

2. A relocatable program form is one which
a) Cannot execute in any area of storage other than the one designated
b) Consists of a program and information for its relocation
c) None of the mentioned
d) All of the mentioned

View Answer

Answer: c [Reason:] A reloadable program form is one which consists of a program and relevant information for its relocation. Using this information it is possible to relocate the program to execute from a storage area then the one designated for it at the time of its coding or translation.

3. A self-relocating program is one which
a) Cannot execute in any area of storage other than the one designated
b) consists of a program and information for its relocation
c) None of the mentioned
d) All of the mentioned

View Answer

Answer: c [Reason:] A self-relocating program is a program which can perform the relocation itself •A table of information about address sensitive instruction in the program. •Relocating logic that can perform the relocation of the address sensitive instructions.

4. Scissoring enables
a) A part of data to be displayed
b) Entire data to be displayed
c) Full data display on full screen
d) No data to be displayed

View Answer

Answer: a [Reason:] It displays a part of the data.

5. Which of the following can be accessed by transfer vector approach of linking?
a) External data segments
b) External sub-routines
c) Data located in other procedure
d) All of the mentioned

View Answer

Answer: b [Reason:] External subroutines are routines that are created and maintained separately from the program that will be calling them.

6. Relocation bits used by relocating loader are specified by
a) Relocating loader itself
b) Linker
c) Assembler
d) Macro processor

View Answer

Answer: b [Reason:] A linker or link editor is a computer program that takes one or more object files generated by a compiler and combines them into a single executable file, library file, or another object file.

7. Generation of intermediate code based on a abstract machine model is useful in compilers because
a) Implementation of lexical analysis and syntax analysis is made easier
b) Writing for intermediate code generation
c) Portability of the front end of the compiler
d) None of the mentioned

View Answer

Answer: a [Reason:] Intermediate code generator receives input from its predecessor phase, semantic analyzer, in the form of an annotated syntax tree.

8. Which of the following module does not incorporate initialization of values changed by the module?
a) Non reusable module
b) Serially reusable module
c) Re-enterable module
d) All of the mentioned

View Answer

Answer: a [Reason:] Non reusable models can be used once for a purpose they can’t be modified and used again.

9. An intermediate code form is
a) Postfix Notation
b) Syntax Trees
c) Three address
d) All of the mentioned

View Answer

Answer: d [Reason:] All the specified options are type of intermediate code form.

10. The best way to compare the different implementations of symbol table is to compare the time required to
a) Add a new name
b) Make an enquiry
c) Add a new name and make an enquiry
d) All of the mentioned

View Answer

Answer: d [Reason:] These are the different implementations of the symbol table as mentioned above.

Set 5

1. Consider the following two statements:
P: Every regular grammar is LL(1)
Q: Every regular set has LR(1) grammar
Which of the following is TRUE?
a) Both P and Q are true
b) P is true and Q is false
c) P is false and Q is true
d) Both P and Q are false

View Answer

Answer: a [Reason:] LL(1) parsers can recognize the regular grammars also LL(1) is subset of LR(1) or CLR grammar so it also recognizes regular sets. So both accept regular grammar.

2. In a simplified computer the instructions are:
OP R j , Ri − Performs Rj OP Ri and stores the result in register Ri
OP m, Ri − Performs val OP Ri abd stores the result in Ri. value
denotes the content of memory location m.
MCVm, Ri −Moves the content off memory loction m to register Ri .
MCVm, Ri , m −Moves the content of register Ri to memory location m.
The computer has only two registers, and OP is either ADD or SUB. Consider the following basic block:
t1 = a + b
t2 = c + d
t 3 = e − t2
t 4 = t 1 − t2
Assume that all operands are initially in memory. The final value of the computation should be in memory. What is the minimum number of MOV instructions in the code generated for this basic block?
a) 2
b) 3
c) 5
d) 6

View Answer

Answer: b [Reason:] The operation sequence would be MOV a, R1 ADD b , R1 {R 1 = t1 MOV c , R2 ADD d, R2 {R 2 = t2 SUB e , R2 {t 3 = e − R 2 = R2 SUB R 1, R2 {R 2 = t4 MOV R 2, t4 {finally in memory Totally no. of move operation is 3

3. S->bA S->aB
A->a B->b
A->aS B->bS
A->bAA B->aBB
Which of the following strings is generated by the grammar?
a) aaaabb
b) aabbbb
c) aabbab
d) abbbba

View Answer

Answer: c [Reason:] aabbab S ” aB ” aaBB ” aabSB ” aabbAB ” aabbab

4. S->bA S->aB
A->a B->b
A->aS B->bS
A->bAA B->aBB

how many derivation trees are there?
a) 1
b) 2
c) 3
d) 4

View Answer

Answer: b [Reason:] For the derivation two trees are possible So due to ambiguity 2 trees are possible.

5. Which of the following describes a handle (as applicable to LR-parsing) appropriately?
a) It is the position in a sentential form where the next shift or reduce operation will occur
b) It is a non-terminal whose production will be used for reduction in the next step
c) It is a production that may be used for reduction in a future step along with a position in the sentential form where the next shift or reduce operation will occur.
d) It is the production p that will be used for reduction in the next step along with a position in the sentential form where the right hand side of the production may be found

View Answer

Answer: d [Reason:] Handles are the part of sentential form, & they are identified as the right side of any given production which will be used for reduction in the next step.

6. Some code optimizations are carried out on the intermediate code because
a) They enhance the portability of the complier to other target processors
b) Program analysis is name accurate on intermediate code than on machine code
c) The information from data flow analysis cannot otherwise be used for optimization
d) The information from the front end cannot otherwise be used for optimization

View Answer

Answer: b [Reason:] Code optimizations are carried out on the intermediate code because program analysis is more accurate on intermediate code than on machine code.

7. Which of the following are true?
(i) A programming language option does not permit global variables of any king and has no nesting of procedures/functions, but permits recursion can be implemented with static storage allocation
(ii) Multi-level access link (or display) arrangement is needed to arrange activation records-only if the programming language being implemented has nesting of procedures/function
(iii) Recursion in programming languages cannot be implemented with dynamic storage allocation
(iv) Nesting of procedures/functions and recursion require a dynamic heap allocation scheme and cannot be implemented with a stack-based allocation scheme for activation records
(v) Languages which permit a function to return a function as its result cannot be implemented with a stack-based storage allocation scheme for activation records
a) (ii) and (v) only
b) (i), (iii) and (iv) only
c) (i), (ii) and (v)
d) (ii), (iii) and (v) only

View Answer

Answer: a [Reason:] I. Statement is false since global variables are required for recursions with static storage. This is due to unavailability of stack in static storage. II. This is true III. In dynamic allocation heap structure is used, so it is false. IV. False since recursion can be implemented. V. Statement is completely true. So only II & V are true.

8. An LALR(1) parser for a grammar can have shift-reduce (S-R) conflicts if and only if
a) The SLR(1) parser for G has S-R conflicts
b) The LR(1) parser for G has S-R conflicts
c) The LR(0) parser for G has S-R conflicts
d) The LALR(1) parser for G has reduce-reduce conflicts

View Answer

Answer: b [Reason:] LALR parser is reduced form of CLR or LR(1) parser, LALR parser uses the LR(1) items of CLR parser & of any shift reduce conflicts are there then it is due to LR(1) parser.

9. Which of the following statements are TRUE ?
I There exist parsing algorithms for some programming languages hose complex are less than θ(n 3 )
II A programming language which allows recursion can be implemented with static storage allocation
III No L-attributed definition can be evaluated in the framework of bottom-up parsing
IV Code improving transformations can be performed at both source language and intermediate code level
a) I and II
b) I and IV
c) III and IV
d) I, III and IV

View Answer

Answer: b [Reason:] I. Statement is true since there are some parsers which take 0 (n log2n) times for parsing. II. Completely false, since there is no use of stack which is required for recursion. III. False IV. True since both types of optimizations are applied

10. What data structure in a complier is used for managing information about variables and their attributes?
a) Abstract syntax tree
b) Symbol table
c) Semantic stack
d) Parse table

View Answer

Answer: b [Reason:] Symbol table is used for storing the information about variables and their attributes by compiler.