Select Page
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. Assume the statements S1 and S2 given as :
S1 : Given a context free grammar, there exists an algorithm for determining whether L(G) is infinite.
S2 : There exists an algorithm to determine whether two context free grammars generate the same language.
Which of the following is true ?
a) S1 is correct and S2 is not correct
b) Both S1 and S2 are correct
c) Both S1 and S2 are not correct
d) S1 is not correct and S2 is correct

Answer: a [Reason:] The proof of S1 can be seen in various book of theory of computation but s2 is a problem of category undecidable so a contradiction to this assumption can be easily obtained.

2. If P & R are regular and also given that if PQ=R, then
a) Q has to be regular
b) Q cannot be regular
c) Q need not be regular
d) Q has to be a CFL

Answer: c [Reason:] If two regular languages when combined do not always produce a regular language.

3. Which of the following conversion is not possible (algorithmically)?
a) Regular grammar to CFG
b) NDFA to DFA
c) NDPDA to DPDA
d) NDTM to DTM

Answer: c [Reason:] Not every NDPDA has an equivalent deterministic PDA.

4. Consider the grammar given below E? E+E | E*E | E-E | E/E | E^E | (E) | id Assume that + and ^ have the same but least precedence, * and / have the next higher precedence but the same precedence and finally ^ has the highest precedence. Assume + and ^ associate to the left like * and / and that ^ associates to the right. Choose the correct for the ordered pairs (^,^) , (-,-) , (+,+) , (*,*) in the operator precedence table constructed for the grammar
a) All <
b) All >
c) < > , =
d) < > > >

Answer: d [Reason:] This relation is established of basis of the precedence of operators.

5. Recursively enumerable languages are not closed under
a) Union
b) Intersection
c) Complementation
d) Concatenation

Answer: c [Reason:] Recursive languages are closed under the following operations the Kleene star L * of L the concatenation L * o P of L and P the union L U P the intersection L ∩ P.

6. Grammar that produce more than one Parse tree for same sentence is
a) Ambiguous
b) Unambiguous
c) Complementation
d) Concatenation Intersection

Answer: a [Reason:] An ambiguous grammar is one for which there is more than one parse tree for a single sentence.

7. Automaton accepting the regular expression of any number of a ‘ s is
a) a*
b) ab*
c) (a/b)*
d) a*b*c

Answer: a [Reason:] It gives any number of a’s.

8. Grammars that can be translated to DFAs
a) Left linear grammar
b) Right linear grammar
c) Generic grammar
d) All of the mentioned

Answer: b [Reason:] Right linear grammar can be translated to the DFAs.

9. The language accepted by a Push down Automata
a) Type0
b) Type1
c) Type2
d) Type3

Answer: c [Reason:] A known fact that type 2 grammar is accepted by PDA.

10. Given the following statements : (i) Recursive enumerable sets are closed under complementation. (ii) Recursive sets are closed under complements. Which is/are the correct statements ?
a) I only
b) II only
c) Both I and II
d) Neither I nor II

Answer: b [Reason:] Recursive languages are closed under the following operations. the Kleene star L * of L the concatenation L * o P of L and P the union L U P the intersection L ∩ P.

## Set 2

1. Assume statements S1 and S2 defined as : S1 : L2-L1 is recursive enumerable where L1 and L2 are recursive and recursive enumerable respectively. S2 : The set of all Turing machines is countable. Which of the following is true ?
a) S1 is correct and S2 is not correct
b) Both S1 and S2 are correct
c) Both S1 and S2 are not correct
d) S1 is not correct and S2 is correct

Answer: b [Reason:] The assumptions of statement S1 and S2 are correct.

2. A context free language is called ambiguous if
a) It has 2 or more left derivations for some terminal string ѡ є L (G)
b) It has 2 or more right derivations for some terminal string ѡ є L (G)
c) Both of the mentioned
d) None of the mentioned

Answer: b [Reason:] A context-free grammar (CFG) is a set of recursive rewriting rules (or productions) used to generate patterns of strings.

3. Which of the following statement is false?
a) The CFG can be converted to Chomsky normal form
b) The CFG can be converted to Greibach normal form
c) CFG is accepted by pushdown automata
d) None of the mentioned

4. The context free grammar S → A111|S1, A → A0 | 00 is equivalent to
a) {0ⁿ1ᵐ | n=2, m=3}
b) {0ⁿ1ᵐ | n=1, m=5}
c) {0ⁿ1ᵐ | n should be greater than two and m should be greater than four}
d) None of the mentioned

Answer: a [Reason:] S-> A111 S->00111 (A->00).

5. The context free grammar S → SS | 0S1 | 1S0 | ɛ generates
a) Equal number of 0’s and 1’s
b) Unequal number of 0’s and 1’s
c) Number of 0’s followed by any number of 1’s
d) None of the mentioned

Answer: a [Reason:] S->SS S->0S1S S->0S11S0 S->0110.

6. Which of the following statement is false?
a) In derivation tree, the label of each leaf node is terminal
b) In derivation tree, the label of all nodes except leaf nodes is a variable
c) In derivation tree, if the root of a sub tree is X then it is called –tree
d) None of the mentioned

Answer: d [Reason:] All of them are true regarding a derivation tree.

7. Push down automata accepts which language
a) Context sensitive language
b) Context free language
c) Recursive language
d) None of the mentioned

Answer: b [Reason:] PDA accepts CFG.

8. A regular Grammar is a?
a) CFG
b) Non CFG
c) English Grammar
d) None of the mentioned

Answer: a [Reason:] Regular grammar is CFG.It restricts its rules to a single non terminal on left hand side.

9. A CFG is closed under
a) Union
b) Kleene star
c) Concatenation
d) None of the mentioned

Answer: d [Reason:] CFG is closed under the above mentioned 3 operations.

10. Which of these does not belong to CFG
a) Terminal Symbol
b) Non terminal Symbol
c) Start symbol
d) End Symbol

Answer: d [Reason:] CFG consist of terminal non terminal start symbol set of production rules but does not have an end symbol.

## Set 3

1. Which phase of compiler is Syntax Analysis?
a) First
b) Second
c) Third
d) None of the mentioned

Answer: b [Reason:] It is Second Phase Of Compiler after Lexical Analyzer.

2. What is Syntax Analyser also known as?
a) Hierarchical Analysis
b) Hierarchical Parsing
c) None of the mentioned
d) Both of the mentioned

Answer: d [Reason:] It is also called as Hierarchical Analysis or Parsing.

3. Syntax Analyser takes Groups Tokens of source Program into Grammatical Production
a) True
b) False

Answer: a [Reason:] It Groups Tokens of source Program into Grammatical Production

4. From where it take its input from?
a) Lexical analyser
b) Syntactic Analyser
c) Semantic Analyser
d) None of the mentioned

Answer: a [Reason:] A syntax analyzer or parser takes the input from a lexical analyzer in the form of token streams.

5. Parsers are expected to parse the whole code
a) True
b) False

Answer: a [Reason:] Parsers are expected to parse the whole code even if some errors exist in the program.

6. A grammar for a programming language is a formal description of
a) Syntax
b) Semantics
c) Structure
d) Library

Answer: c [Reason:] The grammar clearly indicates that which type of a structure does a program has.

7. Which of these is not true about Symbol Table?
a) All the labels of the instructions are symbols
b) Table has entry for symbol name address value
c) Perform the processing of the assembler directives
d) Created during pass 1

Answer: c [Reason:] The Symbol table does not ever perform the processing of the assembler derivative.

8. Which of these features of assembler are Machine-Dependent
a) Instruction formats
c) Program relocation
d) All of the mentioned

Answer: d [Reason:] All of these options are features of assembler which are machine Dependant.

9. A compiler can check?
a) Logical Error
b) Syntax Error
c) Both Logical and Syntax Error
d) Not Logical and Syntax Error

Answer: b [Reason:] No compiler can ever check logical errors.

10. The fourth Generation computer was made up of?
a) Transistor
b) Vacuum tubes
c) Chips
d) Microprocessor chips

Answer: d [Reason:] It is the only way to increase its throughput.

## Set 4

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

Answer: d [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
d) Interpreter

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

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

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

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

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

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

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) Mainting Symbol Table
b) Collect type of information
c) Create parse tree
d) None of the mentioned

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) Generating Object code & Main ting symbol table

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 5

1. The idea of cache memory is based ______
a) On the property of locality of reference
b) On the heuristic 90-10 rule
c) On the fact that references generally tend to cluster
d) All of the mentioned

Answer: A [Reason:] Cache memory is based on locality of references.

2. Which of the following is not a weighted code?
a) Decimal Number system
b) Excess 3-cod
c) Binary number System
d) None of the mentioned

Answer: B [Reason:] Excess 3 is not a weighted code.

3. The average time required to reach a storage location in memory and obtain its contents is called the _____
a) Seek time
b) Turnaround time
c) Access time
d) Transfer time

Answer: C [Reason:] Times used to access the contents.

4. (2FAOC) 16 is equivalent to _____
a) (195 084)10
b) (001011111010 0000 1100)2
c) Both of the mentioned
d) None of the mentioned

Answer: B [Reason:] It is equivalent to (001011111010 0000 1100)2.

5. The circuit used to store one bit of data is known as_______
a) Register
b) Encoder
c) Decoder
d) Flip Flop

Answer: D [Reason:] 1 bit circuit is known as Flip Flop.

6. Computers use addressing mode techniques for ____________
a) Giving programming versatility to the user by providing facilities as pointers to memory counters for loop control
b) To reduce no. of bits in the field of instruction
c) Specifying rules for modifying or interpreting address field of the instruction
d) All of the mentioned

7. What characteristic of RAM memory makes it not suitable for permanent storage?
a) Too slow
b) Unreliable
c) It is volatile
d) Too bulky

Answer: C [Reason:] Ram is volatile.

8. The amount of time required to read a block of data from a disk into memory is composed of seek time, rotational latency, and transfer time. Rotational latency refers to ______
a) The time it takes for the platter to make a full rotation
b) The time it takes for the read-write head to move into position over the appropriate track
c) The time it takes for the platter to rotate the correct sector under the head
d) None of the mentioned

Answer: A [Reason:] Rotational latency is the time taken to make full rotation.

9. In computers, subtraction is generally carried out by ______
a) 9’s complement
b) 10’s complement
c) 1’s complement
d) 2’s complement