Вы находитесь на странице: 1из 39

Name Ag# Course

Anas Shuja 2014-AG-2170 Compiler

Q1. The output of lexical analyzer is

a. A set of regular expressions


B b. Set of tokens
c. Strings of character
d Syntax tree

Q2 If conversion from one type to another type is done automatically by the compiler then,it is called

a. Implicit conversion
b. Coercions
C c. both a and b
d None of the above

Q3. Syntax directed translation scheme is desirable because

a. It is based on the syntax


b. Its description is independent of any implementation
C c. It is easy to modify
d All of these

Q4. A top down parser generates

a. Right most derivation


b. Right most derivation in reverse
C c. Left most derivation
d Left most derivation in reverse

Q5. Macro-processors are ______

a. Hardware
B b. Compiler
c. Registers
d None of the above

Q6. Inherited attribute is a natural choice in

A a. Keeping track of variable declaration


b. Checking for the correct use of L values and R value
c. Both A and B
d None of these
Q7. Concept which can be used to identify loops is

a. Dominators
b. Reducible graphs
c. Depth first ordering
D d All of these

Q8. Reduction in strength means

A a. Replacing run time computation by compile time computation


b. Removing loop invariant computation
c. Removing common sub expression
d Replacing a costly operation by a relatively cheaper one

Q9. The term environment in programming language semantics is said as

a. Function that maps a name to value held there


B b. Function that maps a name to storage location
c. The function that maps a storage location to the value held there
d None of the above

Q10. A self-relocating program is one which

a. Cannot be made to execute in any area of storage other than the


designated for it at the time of its coding or translation
b. Consists of a program and relevant information for its relocation
C c. Can itself perform the relocation of its address sensitive portions?
d All of the above

Q11. The lexical analyzer takes _________ as input and produces a stream of _______ as output.

A a. Source program, tokens


b. Token, source program
c. Either A and B
d None of the above
Q12. Intermediate code generation phase gets input from

a. Lexical analyzer
b. Syntax analyzer
C c. Semantic analyzer
d Error handling
Q13 A grammar is meaningless

A a. If terminal set and non-terminal set are not disjoint


b. If left hand side of a production is a single terminal
c. If left hand side of a production has no non terminal
d All of these

Q14. The optimization technique which is typically applied on loops is

a. Removal of invariant computation


b. Peephole optimization
c. Constant folding
D d All of these

Q15. resolution is externally defined symbols is performed by

A a. Linker
b. Loader
c. Compiler
d Assembler

Q16. Which of the following is used for grouping of characters into tokens?

a. Parser
b. Code optimization
c. Code generator
D d Lexical analyzer

Q17. Whether a given pattern constitutes a token or not depends on the

a. Source language
b. Target language
C c. Compiler
d All of these

Q18. Whether a given pattern constitutes a token or not depends on the

a. Source language
b. Target language
C c. Compiler
d All of these

Q19. A optimizing compiler

a. Is optimized to occupy less space


b. Is optimized to take less time for execution
C c. Optimized the code
d None of the above.
Q20 Which of the following symbols table implementation is based on the property of locality of
reference?
a. Hash table
b. Search tree
C c. Self-organizing list
d Linear list

Q21 Three address code involves

a. Exactly 3 address
b. At most 3 address
c. No unary operators
D d None of these

Q22 A compiler is

a. A program that place program into memory and prepares them


for execution
b. A program that automates the translation of assembly language
into machine language
C c. Program that accepts program written in high level language and
produces an object program
d A program that appears to execute a source program as if it were
machine language

Q23 In a bottom up evaluation of a syntax direction definition, inherited attributes can

a. Always be evaluated
b. Be evaluated only if the definition is L –attributed
C c. Be evaluated only if the definition has synthesized attributes
d None of the above

Q24 Which of the following actions an operator precedence parser may take to recover from an error

a. Insert symbols onto the stack


b. Delete symbols from the stack
c. Insert or delete symbols from the input
D d All of the above

Q25. DAG representation of a basic block allows

A a. Automatic detection of local common sub expressions


b. Automatic detection of induction variables
c. Automatic detection of loop variant
d None of the above
Q26. Recursive descent parsing is an example

A a. Top down parsing


b. Bottom up parsing
c. Predictive parsing
d None of the above

Q27. The graph that shows basic blocks and their successor relationship is called

a. DAG
B b. Flow chart
c. Control graph
d Hamiltonian graph

Q28. Generation of intermediate code based on a abstract machine model is useful in compilers
because

a. it makes implementation of lexical analysis and syntax analysis


easier
B b. Syntax directed translation can be written for intermediate code
generation.
c. It enhances the portability of the front end of the compiler.
d It is not possible to generate code for real machines directly from
high level language programs

Q29. Advantage of panic mode of error recovery is that

a. It is simple to implement
b. It never gets into an infinite loop
c. Both A and B
D d None of these

Q30. In operator precedence parsing, precedence relations are defined

a. For all pair of non-terminals


b. For all pair of terminals
c. To delimit the handle
D d Only for a certain pair of terminals
Q31. An intermediate code form is

a. Postfix notation
b. Syntax trees
c. Three address code
D d All of these

Q32. Code can be optimized at

A a. Source from user


b. Target code
c. Intermediate code
d All of the above

Q33. Pee hole optimization

a. Data flow analysis


b. Loop optimization
c. Local optimization
D d Constant folding

Q34. In which way(s) a microprocessor for assembly language can be implemented?

a. Independent two-pass processor


b. Independent one-pass processor
c. Expand macro calls and substitute arguments
D d All of the above

Q35. A compiler for a high level language that runs on one machine and produce code for different
machine is called

a. Optimizing compiler
b. One pass compiler
C c. Cross Compiler
d Multipacks compiler

Q36. Which of the following is used for grouping of characters into tokens (in a computer)

a. A parser
b. Code optimizer
c. Code generator
D d Scanner
Q37. Local and loop optimization in turn provide motivation for
A a. Data flow analysis
b. Constant folding
c. Pee hole optimization
d DFA and constant folding

Q38. A simple two-pass assembler does which of the following the first phase

a. It allocates space for the literals.


b. It computes the total length of the program.
c. It builds the symbol table for the symbols and their values.
D d All of above

Q39. the translator is best described as

a. Application software
B b. A system software
c. A hardware component
d All of the above

Q40. Which of the following is the most powerful parser?

a. SLR
b. LALR
C c. Canonical LR
d Operator precedence

Q41. Which of the following are language processors?

A a. Assembler
b. Compilers
c. Interpreters
d All of these

Q42. Relocating bits used by relocating loader are specified by

a. Relocating loader itself


B b. Linker
c. Assembler
d Macro processor
Q43. Synthesized attribute can be easily simulated by a

a. LL grammar
b. Ambiguous grammar
C c. LR grammar
d None of the above

Q44. A compiler that runs on one machine and produces code for a different machine is called

A a. Cross compilation
b. Two pass compilation
c. One pass compilation
d None of the above

Q45. _________or scanning is the process where the stream of characters making up the source
program is read from left to right and grouped into tokens.
A a. Lexical analysis
b. Diversion
c. Modeling
d None of the above

Q46. Input to code generator

a. Source code
B b. Intermediate code
c. Target code
d All of the above

Q47. In analysis the compilation PL/I program the description Create of more optimal matrix is
associated with
a. Assembly and output
b. code generation
c. Syntax analysis
D d machine independent optimization

Q48. A bottom up parser generates

a. right most derivation


B b. right most derivation in reverse
c. left most derivation
d left most derivation in reverse

Q49. In an absolute loading scheme which loader function is accomplished by assembler?

A a. re-allocation
b. Allocation
c. Linking
d Loading

Q50. The optimization technique which is typically applied on loops is

a. Removal of invariant computation


b. Peephole optimization
C c. Constant folding
d All of these

Q51. Three address code involves

a. Exactly 3 address
b. At most 3 address
c. No unary operators
D d None of these

Q52. An intermediate code form is

a. Postfix notation
b. Syntax trees
c. Three address code
D d All of these

Q53. In operator precedence parsing, precedence relations are defined

a. For all pair of non-terminals


b. For all pair of terminals
c. To delimit the handle
D d Only for a certain pair of terminals

Q54. Relocating bits used by relocating loader are specified by

a. Relocating loader itself


B b. Linker
c. Assembler
d Macro processor

Q55. A compiler for a high level language that runs on one machine and produce code for different
machine is called
a. Optimizing compiler
b. One pass compiler
C c. Cross compiler
d Multitasks compiler
Q56. Synthesized attribute can be easily simulated by

a. LL grammar
b. Ambiguous grammar
C c. LR grammar
d None of the above

Q57. The output of a lexical analyzer is

a. Machine code
b. Intermediate code
C c. A stream of tokens
d A parse tree

Q58. If conversion from one type to another type is done automatically by the compiler then, it is
called
a. Implicit conversion
b. Coercions
C c. both a and b
d None of the above

Q59. Syntax directed translation scheme is desirable because

a. It is based on the syntax


b. Its description is independent of any implementation
c. It is easy to modify
D d All of these

Q60. A top down parser generates

a. Right most derivation


b. Right most derivation in reverse
c. Left most derivation
d. Left most derivation in reverse

Q61. Macro-processors are ______

a. Hardware
B b. Compiler
c. Registers
d None of the above

Q62. Inherited attribute is a natural choice in


a. Keeping track of variable declaration
B b. Checking for the correct use of L values and R values
c. Both A and B
d None of these

Q63. Concept which can be used to identify loops is

A a. Dominators
b. Reducible graphs
c. Depth first ordering
d All of these

Q64. Reduction in strength means

A a. Replacing run time computation by compile time computation


b. Removing loop invariant computation
c. Removing common sub expression
d Replacing a costly operation by a relatively cheaper one

Q65. The term environment in programming language semantics is said as

a. function that maps a name to value held there


B b. Function that maps a name to storage location
c. The function that maps a storage location to the value held there
d None of the above

Q66. A self-relocating program is one which


a. cannot be made to execute in any area of storage other than the
designated for it at the time of its coding or translation
b. Consists of a program and relevant information for its relocation
C c. Can itself perform the relocation of its address sensitive portions?
d All of the above

Q67. The translator used by second generation languages is?

a. Compiler
b. Interpreter
C c. Assembler
d Linker

Q68. What is the role of compiler in computers?

a. It converts the HLL to MLL


b. It converts the MLL to HLL
C c. Both a and b
d None of the above

Q69. The coordination of processor operation in CPU is controlled by?

a. ALU
b. Registers
c. CU
D d All of the above

Q70. Who invent the microprocessor?

a. John Atansof
b. Mari can E Huff
c. Joseph Jacquard
D d All contribute to invent the microprocessor

Q71. The name of the first microprocessor chip was?

a. Intel2004
b. Intel3004
C c. Intel4004
d Intel8004

Q72. Intel introduced first 32-bit processor in?

a. 1983
b. 1984
C c. 1985
d 1983

Q73. The fourth generation computers came with the advent of the?
A a. Microprocessor Chip
b. electronic chips
c. semi-conductors
d Transistor

Q74. A computer program that converts the whole program into machine language at a single time is
called?
a. Interpreter
B b. Compiler
c. Translator
d All of the above
Q75. A computer program that converts the program into machine language line by line is called?

A a. Interpreter
b. Compiler
c. Translator
d All of the above

Q76. Compiler is a?

a. Program
b. Software
C c. Translator
d None of the above

Q77. Microprocessor can be used to?

a. Make computers
b. Make calculators
c. Make digital system
D d All of the above

Q78. In a microprocessor there are 120 instructions, how many bits needed to implement this?

a. 6
B b. 7
c. 8
d 9

Q79. Program counter in microprocessor is used to?

a. store the top of stack address


b. store the base address of stack
c. to store the middle address of the stack
D d to store the next instruction address

Q80. IBM introduced first 16-bit microprocessor in?

a. 1980
b. 1981
C c. 1982
d 1983

Q81. Which device can understand the difference data and programs?
a. Motherboard
B b. Microprocessor
c. ALU
d Registers

Q82. A memory bus is used for communication between?

a. ALU and Register


b. Input and Output devices
C c. Processor and Memory
d All of the above

Q83. Compiler can check?

a. Logical Error
B b. Syntax Error
c. Both Logical and Syntax Error
d Not Logical and Syntax Error

Q84. The fourth generation computer was made up of?

a. Transistor
b. Vacuum tubes
c. Chips
D d microprocessor chips

Q85. A co-processor?

a. is used in fifth generation computers


B b. is used to support in software
c. is used in combination with every application
d None

Q86. Attached Processor is used for?

a. few processes
B b. specific functions
c. Both
d None

Q87. Select the machine independent phase of the compiler?

a. Syntax analysis
b. Intermediate code generation
c. Lexical analysis
D d All of the above

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

Q89. The ALE line of an 8085 microprocessor is used to?

A a. Execute an RST by hardware


b. Executes the instruction supplied by external device through the
INTA signal
c. Executes an instruction from memory location 20 H
D Executes a NOP

Q90. The number of clock cycles necessary to complete 1 fetch cycle in 8085 is?

a. 3 or 4
b. 4 or 5
C c. 4 or 6
d 6 or 7

Q91. Which of the following electronic component are not found in ordinary ICs?

a. Diodes
b. Transistors
c. Resistors
D d Inductors

Q92. What is the word length of Intel Pentium CPU?

a. 8 Bit
b. 16 Bit
c. 32 Bit
D d 64 Bit

Q93. Motorola 6800 is an____biit microprocessor?

a. 4 Bit
b. 8Bit
C c. 16 Bit
d 32Bit
Q94. Intel 486 is___ bit microprocessor?

a. 8 Bit
b. 16 Bit
C c. 32 Bit
d 64 Bit

Q95. Compiler translates the Source code to?

a. binary code
b. machine code
C c. Both
d None

Q96. 8088 CPU is?

a. 16 bit external/8 bit internal


B b. 16 bit internal/8-bit external
c. Both
d None

Q97. In a microprocessor there are 120 instructions, how many bits needed to implement this?
a. 6
B b. 7
c. 8
d 9

Q98. Which is the function of Microprocessor?

a. Receive data from input device


b. Process the data
c. Send data to the output device
D d All of the above

Q99. The most advanced form of ROM is?

a. PROM
b. RAM
c. Cache memory
D d EEPROM

Q100. Parser takes tokens from scanner and tries to generate _______________ .

a. Binary Search tree


b. Parse tree
C c. Syntax trace
d None of the given

Q101. Flex is an automated tool that is used to get the minimized DFA (scanner).
a.
True

B b. False

Q102 Consider the grammar A --> B C D


B --> h B | epsilon
C --> C g | g | C h | i
D --> A B | epsilon
Follow of B is _____________ .

A a. h

b. g, h, i, $
c. g, i

d G

Q103. Consider the grammar A --> B C D


B --> h B | epsilon
C --> C g | g | C h | i
D --> A B | epsilon
Follow of C is _____________ .

A a. g, h, i, $
b. g, h, $
c. h, i, $

d h, g, $

Q104. Alternative of the backtrack in parser is Look ahead symbol in _________

A a. Input
b. Output
c. Input and Output
d None of the given

Q105. Typical compilation means programs written in high-level languages to low-level ____________.
a. Object code
b. Byte code
c. Unicode
D d Both Object Code and byte code

Q106. In Flex specification file different sections are separated by _________________


A a. %%
b. &&
c. ##
d \\

Q107. In DFA minimization we construct one _______________ for each group of states from the initial
DFA.
A a. State
b. NFA
c. PDA
d None of given

Q108. Flex is an automated tool that is used to get the minimized DFA (scanner).

a. True
B b. False

Q109. An important component of semantic analysis is __________________


a. code checking
B b. type checking
c. flush checking
d None of the given

Q110. In PASCAL ___________ represent the inequality test.


a. :=
b. =
C c. <>
d None of the given

Q111. Left factoring is enough to make a grammar LL (1).


a. True
B b. False

Q112. In multi pass compiler during the first pass it gathers information about ______________
A a. Declaration
b. Bindings
c. Static information
d None of the given

Q113. ______________ phase which supports macro substitution and conditional compilation.
a. Semantic
b. Syntax
C c. Preprocessing
d None of given

Q114. In parser the two LL stand(s) for __________


a. Left-to-right scan of input
b. left-most derivation
C c. All of the given
d None of the given

Q115. Bottom-up parsers handle a _______________ class of grammars.


A a. Large
b. Small
c. Medium
d None of the given

Q116 Three address code involves


a. Exactly 3 address
b. At most 3 address
c. No unary operators
D d None of these

Q117 An intermediate code form is


a. Postfix notation
b. Syntax trees
c. Three address code
D d All of these

Q118 In operator precedence parsing, precedence relations are defined


a. For all pair of non-terminals
b. For all pair of terminals
c. To delimit the handle
D d Only for a certain pair of terminals

Q119 Relocating bits used by relocating loader are specified by


a. Relocating loader itself
B b. Linker
c. Assembler
d Macro processor

Q120. A compiler for a high level language that runs on one machine and produce code for different
machine is called
A a. Optimizing compiler
b. One pass compiler
c. Cross compiler
d Multiples compiler

Q121. Synthesized attribute can be easily simulated by a


a. LL grammar
b. Ambiguous grammar
C c. LR grammar
d None of the above

Q122. The output of a lexical analyzer is


a. Machine code
b. Intermediate code
C c. A stream of tokens
d A parse tree

Q123. Running time of a program depends on


a. The way the registers and addressing modes are used
b. The order in which computations are performed
c. The usage of machine idioms
D d All of these

Q124. Reduction in strength means


A a. Replacing run time computation by compile time computation
b. Removing loop invariant computation
c. Removing common sub expression
d Replacing a costly operation by a relatively cheaper one

Q125. or scanning is the process where the stream of characters making up the source program is
read from left to right and grouped into tokens.
a. Lexical analysis
b. Diversion
c. Modeling
D d None of the above
Q126.
Task of the lexical analysis

a. To parse the source program into the basic elements or tokens


of the language

b. To build a literal table and an identifier table

c. To build a uniform symbol table


D d All of these

Q127. Typical compilation means programs written in high-level languages to low-level ____________.

a. Object code

b. Byte code

c. Unicode
D d Both Object Code and byte code

Q128. Any description error can be repaired by

a. Insertion alone

b. Deletion alone

C c. Insertion and deletion alone


d Replacement alone

Q129. The linker

a. is similar to interpreter

b. uses source code as its input

C c. is required to create a load module


d none of the above
Q130. A grammar that produces more than one parse tree for some sentence is called

A a. Ambiguous
b. Unambiguous

c. Regular

d None of these

Q131. A grammar that produces more than one parse tree for some sentence is called

A a.
Ambiguous

b. Unambiguous

c. Regular

d None of these

Q132. In an absolute loading scheme which loader function is accomplished by assembler ?

A a. re-allocation

b. Allocation

c. Linking

d Loading

Q133. We can optimize code by

A a. Dead code elimination

b. Common subprograms

c. Copy intermediate loop

D Loop declaration

Q134.
Code can be optimized at

A a. Source from user


b. Target code

c. Intermediate code

D a) All of the above

Q135 Intermediate code generation phase gets input from

a. Lexical analyzer

b. Syntax analyzer

C c. Semantic analyzer

D Error handling

Q136. YACC builds up

a. SLR parsing table

b. Canonical LR parsing table

C c. LALR parsing table

d None of the above

Q137. Type checking is normally done during

a. Lexical analysis

b. Syntax analysis

C c. Syntax directed translation

D Code optimization

Q138. A top down parser generates

a. Right most derivation

b. Right most derivation in reverse

C c. Left most derivation


d Left most derivation in reverse

Q139. Which of the following does not interrupt a running process?

a. A device

b. Timer

c. Scheduler

D d Power failure

Q140. Which of the following can be accessed by transfer vector approach of linking?

a. External data segments

B b. External subroutines

c. Data located in other procedure

d All of these

Q141. ___________is a graph representation of a derivation.

A a. The parse tree

b. The oct tree

c. The binary tree

d None of the above

Q142 In an absolute loading scheme, which loader function is accomplished by a loader ?

a. Re-allocation

b. Allocation
c. Linking

D d Loading

Q143 Syntax directed translation scheme is desirable because

a. It is based on the syntax

b. Its description is independent of any implementation

C c. It is easy to modify

d All of these

Q144 The optimization which avoids test at every iteration is

A a. Loop unrolling

b. Loop jamming

c. Constant folding

d None of these

Q145 Which of the following parser is most powerful?

a. Operator precedence

B b. Canonical LR

c. LALR

d SLR
Q146 Inherited attribute is a natural choice in

A a. Keeping track of variable declaration

b. Checking for the correct use of L values and R values

c. Both A and B

d None of these

Q147. Macro-processors are ______

a. Hardware

b. Compiler

c. Registers
d None of the above

Q148. Concept which can be used to identify loops is


a. Dominators

D b. Reducible graphs

c. Depth first ordering

d All of these

Q149. Which of the following is not an intermediate code form?

a. Postfix notation

b. Syntax trees

c. Three address codes


D d Quadruples

Q150. The action of parsing the source program into proper syntactic classes is called
a. Syntax analysis

B b. Lexical analysis

c. Interpretation analysis

d General syntax analysis

Q151. Pee hole optimization


a. Loop optimization
b. Local optimization
C c. Constant folding
d Data flow analysis

Q152. The command “cpp sanfoundry.c > sanfoundry.i” will

A a. create the expanded source code file sanfoudry.i for the source
code file sanfoundry.c
b. append the content of the sanfoundry.c into sanfoundry.i

c. give an error

d none of the mentioned

Q153. Which option of gcc makes the compiler print out each function name as it is compiled, and print
some statistics about each pass when it finishes?

a. -P
b. -P
c. -q
D d -Q

Q154. The -Wextra option of gcc.


a. is same as -w option

b. does not exist

C c. enables extra warning messages

d none of the mentioned


Q155. Which gcc option undefines a preprocessor macro?
A a. -U
b. -u
c. -undefine
d none of the mentioned

Q156. Pipes are used rather than temporary files for communication between the various stages of
compilation in gcc when
A a. -pipe option is used

b. -temp option is used

c. –disable -temp option is used

d none of the mentioned

Q157. The gcc option -Wunused warns when a _____ variable is unused aside from its declaration.
A a. variable

b. function

c. macro

d none of the mentioned

Q158. Which one of the following is not true?

A a. source codes can not be compiled with static libraries in


gcc

b. -O is used for optimization in gcc

c. both (a) and (b)

d none of the mentioned

Q159. The command line options of gcc can also be read from a file with.
a. @

b. $

C c. #
d none of the mentioned
Q160. Which option of the gcc is used to warn is padding is included in structure?

A a. Wpadded

b. Wpad

c. Wpadding

d none of the mentioned

Q161. Which gcc option reports the cpu time taken by each subprocess in the compilation sequence?

A a. time

b. cpu

c. process

d none of the mentioned

Q162 Push down automata accepts which language

a. Context sensitive language

B b. Context free language

c. Recursive language

d None of these

Q163 Which gcc option reports the cpu time taken by each subprocess in the compilation sequence?

A a. time

b. cpu

c. process

d none of the mentioned


Q164 A context free grammar G is in Chomsky normal form if every production is of the form

A a. A → BC or A → A
b. A → BC or A → a

c. A → BCa or B → b

d None of these

Q165 Which of the following statement is false?

a. A recursive language is also a regular language

b. A context free language is also a regular language

c. A context free language is also recursive enumerable language

d Both (a) and (b)

Q166. Which of the following statement is false?


a. The context free language can be converted into Chomsky
normal form
b. The context free language can be converted into Greibach
normal form
c. The context free language is accepted by pushdown automata
D d None of these

Q167. The language L={0ᵐ1ᵐ0ᵐ| m ≥ 1} is a


a. Regular language
b. Context free language
c. Both (a) and (b)
D d None of these

Q168. While converting the context free grammar into Greibach normal form, which of the following is
not necessary
a. Elimination of null production
b. Elimination of unit production
c. Converting given grammar in Chomsky normal form
D d None of these
Q169. The context free grammar S → A111|S1, A → A0 | 00 is equivalent to
A 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 these

Q170. The context free grammar S → SS | 0S1 | 1S0 | ɛ generates


A a. Equal number of 0’s and 1’s
b. Unequal number of 0’s and 1’s
c. Any number of 0’s followed by any number of 1’s
d None of these

Q171. 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 d None of these
Q172. The correct sequence of GCC compilation process is
A a. preprocessing -> compilation -> assemble -> linking
b. assemble -> preprocessing -> compilation -> linking
c. preprocessing -> assemble -> compilation -> linking
d none of the mentioned

Q173. The preprocessor removes the _______ from the source code.
a. Comments
B b. header files
c. both (a) and (b)
d none of the mentioned

Q174. The compiler converts


A a. assembly code into machine code
b. preprocessed source code into assembly code
c. machine code into assembly code
d none of the mentioned

Q175. The optimization which avoids test at every iteration is


A a. Loop unrolling
b. Loop jamming
c. Constant folding
d None of these
Q176. The optimization which avoids test at every iteration is
A a. Loop unrolling
b. Loop jamming
c. Constant folding
d None of these

Q177. Inherited attribute is a natural choice in


A a. Keeping track of variable declaration
b. Checking for the correct use of L values and R values
c. Both A and B
d None of these

Q178. The assembly code is converted into the machine code by


A a. Compiler
b. Assembler
c. Linker
d none of the mentioned

Q179. What is the role of linker in the compilation process?


a. linker links the object code with the library code
b. linker converts machine code into executable machine code
c. linker generates an executable file
D d all of the mentioned

Q180. Task of the lexical analysis


a. To parse the source program into the basic elements or tokens of
the language
b. To build a literal table and an identifier table
c. To build a uniform symbol table
D d All of these

Q181. Typical compilation means programs written in high-level languages to low-level ____________.
a. Object code
b. Byte code
c. Unicode
D d Both Object Code and byte code

Q182. Any description error can be repaired by


a. Insertion alone
b. Deletion alone
C c. Insertion and deletion alone
d Replacement alone
Q183. If sanfoundry is compiled with GCC, then the sanfoundry.s file will contain the
A a. assembly code
b. machine code
c. preprocessed code
d expanded source code

Q184. The object file contains the


a. assembly code
B b. machine code
c. modified source code
d none of the mentioned

Q185. If we do not specify the executable file name at the compilation time in GCC, then in linux the
compiler creates executable named as
A a. a.out
b. a.exe
c. x.out
d x.exe

Q186. The macros specifies in source code are expanded by


A a. preprocessor
b. assembler
c. compiler
d linker

Q187. The preprocessor creates the file with extension


a. a
B b. i
c. s
d o

Q188. What is the job of -Werror option in gcc?


a. it avoids all the errors present in the source code
B b. it makes all warnings into errors
c. it stores all the errors of source code into a seperate file
d none of the mentioned

Q189. The command “as -o sanfoundry.o sanfoundry.s” will


A a. generate object file sanfoundry.o
b. provide an error if sanfoundry.s exists
c. both (a) and (b)
d none of the mentioned
Q190. The command “GCC -save-temps sanfoundry.c” will generate
a. sanfoundry.i
b. sanfoundry.s
c. sanfoundry.o
D d all of the mentioned

Q191. The -H option of GCC


A a. prints the name of each header file used
b. is used to include header file
c. ignores the header file which are not required by source code
d none of the mentioned

Q192. Which option of GCC enables compiler’s all warning messages?


A a. Wall
b. War
c. Warn
d none of the mentioned

Q193. The a.out file is in the


A a. ELF format
b. EXE format
c. both (a) and (b)
d none of the mentioned

Q194. Which one of the following command can be used to provide executable permissions for a file?
a. chmod +x
b. chmod 777
C c. both (a) and (b)
d none of the mentioned

Q195. Command line parameters are passed by the


a. preprocessor
b. assembler
c. compiler
D d linker

Q196. The lines in our code that begin with the “#” character are
A a. preprocessor directives
b. macros
c. header files
d none of the mentioned
Q197. Command line parameters are passed by the
a. Preprocessor
b. Assembler
c. Compiler
D d Linker

Q198. Which compilation step makes sure that all the undefined symbols in the code are resolved.
A a. linking
b. compiling
c. preprocessing
d none of the mentioned

Q199. The COFF stands for


A a. common object file format
b. combined operation for file formats
c. combined object file format
d none of the mentioned

Q200. The assembly code generated depends upon the


a. processor architecture
b. RAM size
C c. both (a) and (b)
d none of the mentioned
Answers:

Q1. B Q.51 D Q.101 B Q.151 C


Q2. C Q52 D Q.102 A Q152 A
Q3 C Q53 D Q.103 A Q153 D
Q4 C Q54 B Q.104 A Q154 C
Q5 B Q55 C Q.105 D Q155 A
Q6 A Q56 C Q.106 A Q156 A
Q7 D Q57 C Q.107 A Q157 A
Q8 A Q58 C Q.108 B Q158 A
Q9 B Q59 D Q.109 B Q159 C
Q10 C Q60 B Q.110 C Q160 A
Q11 A Q61 B Q.111 B Q161 A
Q12 C Q62 A Q.112 A Q162 B
Q13 A Q63 D Q.113 C Q163 A
Q14 D Q64 A Q.114 C Q164 A
Q15 A Q65 B Q.115 A Q165 B
Q16 D Q66 C Q.116 D Q166 D
Q17 C Q67 C Q.117 D Q167 D
Q18 C Q68 C Q.118 D Q168 D
Q19 C Q69 D Q.119 B Q169 A
Q20 C Q70 D Q.120 A Q170 A
Q21 D Q71 C Q.121 C Q171 D
Q22 C Q72 C Q.122 C Q172 A
Q23 C Q73 A Q.123 D Q173 B
Q24 D Q74 B Q.124 A Q174 A
Q25 A Q75 A Q.125 D Q175 A
Q26 A Q76 C Q.126 D Q176 A
Q27 B Q77 D Q.127 D Q177 A
Q28 B Q78 B Q.128 C Q178 A
Q29 D Q79 D Q.129 C Q179 D
Q30 D Q80 C Q.130 A Q180 D
Q31 D Q81 B Q.131 A Q181 D
Q32 A Q82 C Q.132 A Q182 C
Q33 D Q83 B Q.133 A Q183 A
Q34 D Q84 D Q.134 A Q184 B
Q35 C Q85 B Q.135 C Q185 A
Q36 D Q86 B Q.136 C Q186 A
Q37 A Q87 D Q.137 C Q187 B
Q38 D Q88 C Q.138 C Q188 B
Q39 B Q89 A Q.139 D Q189 A
Q40 C Q90 C Q.140 B Q190 D
Q41 A Q91 D Q.141 A Q191 A
Q42 B Q92 D Q.142 D Q192 A
Q43 C Q93 C Q.143 C Q193 A
Q44 A Q94 C Q.144 A Q194 C
Q45 A Q95 C Q.145 B Q195 D
Q46 B Q96 B Q.146 A Q196 A
Q47 D Q97 B Q.147 B Q197 D
Q48 B Q98 D Q.148 D Q198 A
Q49 A Q99 D Q.149 D Q199 A
Q50 C Q100 C Q.150 B Q200 C

Вам также может понравиться