Thursday 6 September 2012

December 2010 - Question 31-35

31. Object code is the output of ______.

(A) Operating System
(B) Compiler or Assembler
(C) only Assembler
(D) only Compiler

Ans:-B

Explanation:- Again this is one of those questions where more than one option looks correct. I think option B is correct because both compiler and assembler converts the source language code to the object code. If anyone has any other version,please post it and we can discuss it.


32. 'Macro' in an assembly level program is _______.

(A) sub program
(B) a complete program
(C) a hardware portion
(D) relative coding

Ans:-A

Explanation:-Looking at all the other options, the only one which seems more appropriate is option A.


33. Grammar of the programming is checked at ________ phase of compiler.

(A) semantic analysis
(B) code generation
(C) syntax analysis
(D) code optimization

Ans:-C

Explanation:- The following are the main phases of a compiler and the activities done in each one of the phases.
1.Lexical Analysis:-In this phase the source program is split into what are called 'tokens'.
2.Syntax Analysis:-The tokens are grouped together into phrases which should match some specified grammar.Normally, one of the outputs of a syntax analysis phase would be a Abstract Syntax Tree.(AST)
3.Semantic Analysis:-This phase would traverse through the AST and refine it.
4.Intermediate code generation:-This phase generates a machine independent code.
5.Code optimization:-Use some strategies to optimize the code that is generated.
6.Code generation:-Generate the machine dependent code finally.
Symbol table generation and error handling would be part of almost all phases. So the grammar checking would be done at syntax analysis phase. Hence the option is C.


34. The register or main memory location which contains the effective address of the operand is known as

(A) pointer
(B) special location
(C) indexed register
(D) None of the above

Ans:-A


35. Macro-processors are ______.

(A) Hardware
(B) Compiler
(C) Registers
(D) None of the above

Ans:-B


2 comments:

  1. In question number 35, I think the answer should be D) None of the above. because somewhere I read that macro processor is a program..Please explain your ans B.

    ReplyDelete
  2. COMPILER ITSELF A PROGRAM, AND ALSO MACRO ARE THE PART OF ASSEMBLERS AND COMPILERS.

    ReplyDelete