COMPILER DESIGN LEXICAL ANALYSIS, PARSING 1. Which of the following system program forgoes the production of object code to generate absolute machine code and load it into the Physical main storage location from which it will be executed immediately upon completion of the assembly? (a) Two pass assembler (b) Load-and-go assembler (c) Macro processor (d) Compiler 2. System program such as compiler are designed so that they are (a) Re-enterable (b) Non-reusable (c) Serially usable (d) Recursive 3. A system program that set-up an executable program in main memory ready for execution is (a) Assembler (b) Linker (c) Loader (d) Text editor 4. Assembler is a program that (a) Places programs into memory and prepares them for execution (b) Automates the translation of assembly language into machine language (c) Accepts a program written in a high level language and produces an object program. (d) Appears to execute a resource as if it were machine language. 5. An interpreter is a program that (a) Places programs into memory and prepares them for execution. (b) Automates the translation of assembly language into machine language. (c) Accesses a program written in a high level language and produces an object program. (d) Appears to execute a source program as if it were machine language. 6. A compiler is a program that (a) Places programs into memory and prepares them for execution. (b) Automates the translation of assembly language into machine language. (c) Accepts a program written in a high level language and produces an object program. (d) Appears to execute a source program as if it were machine language. 7. A compiler program written language is called (a) Source program (b) Object program
(c) Machine language program 8. Compiler can diagnose (a) Grammatical errors only (b) Logical errors only (c) Grammatical as well as logical errors (d) Neither grammatical nor logical errors 9. A programmer, by mistake, writes an instruction to divide, instead of a multiply, such error can be detected by a/an (a) Compiler (b) Interpreter (c) Compiler or interpreter test 10. A series of statements explaining how the data is to be processed is called (a) Assembly (b) Machine (c) Pascal (d) Program 11. The computer language generally translated to pseudocode is (a) Assembly (b) Machine (c) Pascal (d) PL I 12. Language which have many types, but the type of every name and expression must be calculated at complete time are (a) Strongly-type languages (b) Weakly typed languages (c) Loosely typed languages 13. A system program that sets up an executable program in main memory ready for execution is (a) Assembler (b) Linker (c) Loader (d) Load and go 14. A system program that combines separately compiled modules of a program into a form suitable for execution is (a) Assembler (b) Linking loader (c) Cross compiler (d) Load and go
15. Advantage of using assembly language rather than machine language is that (a) It is mnemonic and easy to read (b) Addresses any symbolic not absolute (c) Introduction of data to program is easier (d) All of these 16. Advantage of incorporating the macro-processor into pass-i is that (a) Many functions do not have to be implemented twice. (b) Functions are combined and it is not necessary to create intermediate files as output from the macro-processor and input to the assembler. (c) More flexibility is available to the programmer in that he may use all the features of the assembler in conjunction with macros. (d) All of these 17. In which way a macro processor for assembly language can be implemented? (a) Independent two-pass processor (b) Independent one-pass processor (c) Processor incorporated into pass 1 of a standard two pass assembler (d) All of these 18. In an absolute loading scheme, which loader function is accomplished by programmer? (a) Allocation (b) Linking (c) Reallocation (d) Both (a) and (b) 19. Uniform symbol table (a) Contains all constants in the program. (b) Is a permanent table of decision rules in the form of patterns for matching with the uniform symbol table to discover syntactic structure. (c) Consists of full or partial list of the token's as they appear in the program. Created by Lexical analysis and used for syntax analysis and interpretation. (d) A permanent table which lists all key words and special symbols of the language in symbolic form. 20. Which of the following is a phase of a compilation process? (a) Lexical analysis (b) Code generation (c) Both (a) and (b)
SYNTAX DIRECTED TRANSLATION 21. Which of the following translation program converts assembly language programs to object program? (a)assembler (b) Compiler (c) Macro processor (d) Linker 22. In a single pass assembler, most of the forward references can he avoided by putting the restriction (a) On the number of strings/ life- reacts., (b) That the data segment must be defined after the code segment. (c) On unconditional rump. (d) That the data segment be defined before the code segment. 23. The segment base is specified using the register named is a) ORG instructions (b) TITLE instruction (c) ASSUME instruction (d) SEGMENT instruction 24. Which is not true about syntax and semantic parts of a computer language? (a) Syntax is generally checked by the programmer. (b) Semantics is the responsibility of the programmer. (c) Semantics is checked mechanically by a computer (d) Both (b) and (c) 25. Left factoring is the process of factoring out common (a) Prefixed of alternates (b) Suffixes of alternates (c) Predictive parsing 26. A linker is given object module for a set of programs that were compiled separately. What information need not be included in an object module? (a) Object code (b) Relocation bits (c) Names and locations of all external symbols defined in the object module (d) Absolute addresses of internal symbols. 27. The root directory of a disk should be placed (a) at a fixed address in main memory at a fixed location On the disk (C) anywhere on the disk (d) On a fixed location on system disk 28. Which of the following is true for machine language? (a) Repeated execution of program segments
(b) Depicting flow of data in a system (c) A sequence of instructions which, when followed properly, solves a problem (d) The language which communicates with the computer using only the binary digits 1. and 0. 29. Which of the following statement is true? (a) SLR parser is more powerful than LALR. (b) LAIR parser is more powerful than Canonical LR parser. (c) canonical LR parser is more powerful than LALR parser. (d) The parsers SLR, Canonical LR and LALR have the same power. 30. Which of the following strings can definitely be said to be tokens without looking at the next input character while compiling a Pascal program? (a) Begin (b) Program (c)< > (d) All of these 31. Relative mode of addressing most relevant to writing (a) Co-routines (b) position-independent code (c) shareable code (d) interrupt handlers 32. An ideal compiler should (a) be smaller in size and take less time for compiling (b) be written in a high level language (c) produce object code that is smaller in size and executes faster 33. 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
RUNTIME ENVIRONMENTS, INTERMEDIATE AND TARGET CODE 34. In which of the following no information hiding is done? (a) compile prog 1, prog 2 (b) run test, prog (c) load R 1, A (d) 001001000010101 35. 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 d) data flow analysis 36. The graph that shows basic blocks and their successor relationship is called (a) DAG (b) Flow graph (c) Control graph (d) Hamiltonian graph 37. The specific tasks storage manager performs are (a)allocation/de-allocation of storage to programs (b) protection of storage area allocated to a program from illegal access by other programs in the system. (c) the status of each program (d) both (a) and (b) 38. When a computer is first turned on or restarted, a special type of absolute loader is executed called (a) "Compile and GO" loader (b) Boot loader (c) Boot strap loader (d) Relating loader 39. Disadvantage of "Compile and go" loading scheme is that (a) a portion of memory is wasted because the case occupied by the assembler is unavailable to the object program. (b) it is necessary to retranslate the users program deck every time it is run. (c) it is very difficult to handle multiple segments, especially if the source programs are in different languages and to produce orderly modular programs. (4) all of these
BASICS OF CODE OPTIMIZATION 40. In analyzing the compilation of PL/I program the description "resolving symbolic address (labels) and generating machine language" is associated with (a) assembly and output (b) code generation (c) storage assignment (d) syntax analysis 41. In analyzing the compilation of PL/I program the description "creation of more optimal matrix" is associated with (a) assembly and output (b) code generation (c) syntax analysis (d) machine independent optimization 42. Peephole optimization is a form of (a) loop optimization (b) local optimization (c) constant folding (d) data flow analysis 43. Substitution of values for names whose values are constant, is done in (a) local optimization (b) loop optimization (c) 4 constant folding (d) none of these 44. Local and loop optimization inturn provide motivation for (a) data flow analysis (b) constant folding (c) peephole optimization (d) DFA and constant folding 45. A compiler for a high level language that runs on one machine and produces code for a different machine is called (a) optimizing compiler (b) one pass compiler j cross compiler (d) multipass compiler 46. An optimizing compiler (a) is optimized to occupy less space (b) is optimized to take less time for execution (c) optimizes the code (d) none of these 47. Whether a given pattern constitutes a token or not, depends on the (a) source language (b) target language
(c) Compiler 48. The optimization technique which is typically applied on loops is (a) removal of invariant computation (b) peephole optimization (c) constant folding 49. Ud-chaining is useful for (a) determining whether a particular definition is used anywhere or not (b) constant folding (c) checking whether a variable is used, without prior assignment 50. Concept which can be used to identify loops is (a) dominators (b) reducible graphs (c) depth first ordering