CS 502 : System Software / CO 207 : System Programming Exercises

  1. What do you understand by the term System Software?  3
  2. What is the importance of system software in a computer system ? Give an example of a system software and explain how the overall performance of the system depends on it.   4 + 3
  3. How will you classify a software as either an application software or a system software?  3
  4. Would you consider a text editor such as vi a system program or an application program? Justify.  1 + 3
  5. How would you classify system software ? In which categories would you put language processors and operating systems ? Why ?   3 + 3
  6. Why is "assembler" considered as a system program?  2
  7. What are the benefits of using "language processors" ?  5
  8. What are the various language processing activities in the domain of system software ? What do you understand by cross-compilation ?   4 + 3
  9. Mention some advantages of assembly language over machine language.   5
    or
    Why was assembly language invented ? 4 [Hint : What was the situation before and how was it improved by assembly languages ?]
  10. What are some advantages of assembly languages over high level languages?  3
  11. In an environment such as UNIX, several programs reside in the system simultaneously, and programs may be invoked by various users in any arbitrary order. How does assembly language or a high level language facilitate preparation of programs for such environments?  5
  12. What are assembler directives in assembly languages ? Illustrate with an example the importance of assembler directives.   3 + 3
  13. Consider the following program segment in a hypothetical assembly language. (Contents of a line after a semicolon are comments and are to be ignored during assembly)   2 + 2 + 2 + 2

    A DS 2 ; allocate 2 bytes for A
    MOV A, 10 ; put 10 in var A
    AGAIN: CALL PRINT ; call subroutine PRINT
    DEC A ; decrement the contents of A by 1
    JNZ AGAIN ; continue at AGAIN if previous
    ; operation produces zero

    (i) Indicate which type is each of the above statements of.
    (ii) How many machine instructions will be produced due to the above program ?
    (iii) What will be the contents of the main data structures during the assembly process ? (Indicate the entries, the exact values are not important)
    (iv) Which instructions are address sensitive in the above program segment ? Why ?
  14. Why is it useful to perform the assembly process in multiple passes? Give an outline of the division of activities among the passes of a multi-pass assembler.   3 + 4
  15. What are the activities performed in the analysis phase and synthesis phase of an assembler ?   4
  16. Draw a block diagram to show the steps involved in a two-pass assembler, indicating where the important data structures are built and used. What are the various fields and their types in the different data structures?  8 + 5
    [Hint: First draw a rough sketch in half a page]
  17. What are the main data structures necessary for an assembly scheme? State the purpose of each of them.   2 + 2
  18. What is the role of a mnemonic table in an assembler? What all information may be maintained in it ? When is a mnemonic table built ? Describe a possible organization of a mnemonic table (using C language if necessary).   2 + 3 + 1 + 4
  19. What is location counter processing ? Why and how is location counter processing performed by an assembler?  3 + 4
  20. Briefly describe a possible sequence of steps of an assembler. What is a major difference between the creation of a mnemonic table and that of a symbol table ?   5 + 2
  21. What does lexical analysis mean? Give a possible outline of a lexical analyser program/module (you may assume C programming language for the purpose).  2 + 5
  22. What is a commonly used and convenient method of creating an efficient lexical analyser (mention important steps in this method)? 4
  23. What is "flex" ?  3
  24. What is flex used for ? Write the regular expression that describes a word that has a sequence of hexadecimal digits followed by a dot and then another sequence of hexadecimal digits. The word may optionally have a hyphen as a prefix. Give two examples of such words.    2 + 2 + 1
  25. Why is a symbol table used by an assembler ? Give a possible format of a symbol table record and state why you would use either an array, a hash table, or any other data structure to keep these records.   5
  26. What are the different stages in which a symbol table is accessed during an assembly process ? Write C statements to define a possible symbol table.  3 + 4
  27. Suppose an assembly language allows the use of literals and literals can be alloted memory space either at the end of the program code or at places corresponding to ``LTORG" statements in the program. Describe how this can be handled by an assembler.   7
  28. Using a small segment (less than 10 statements) of an assembly language program as an example, show the contents of the symbol table and the literal table after an assembler performs analysis of the program. What do you understand by forward reference ?   6 + 2
  29. Why is Intermediate code needed in the translation process by an assembler ? Describe a suitable format for intermediate code.    3 + 3
  30. Give a small example that explains the usage and need of "table of incomplete instructions".  5
  31. Assume a statement in an assembly language program -  5
    LIR 4, TERM
    How will you represent this in intermediate code between two passes of an assembler. Justify the representation assuming any suitable format for the intermediate code.
  32. What are some of the errors that an assembler should detect? What course of action should the assembler take when it detects an error?   3 + 3
  33. Why do programming languages provide the macro feature despite the procedure call mechanism ? How does it affect the size and efficiency of the machine language program generated?   3 + 3
  34. Compare the two features - macro and subroutines in a programming language.  5
  35. What do you understand by conditional expansion during macro processing ?   4
  36. Give a small example to show the use of a macro in some hypothetical assembly language. Your example should contain parameters and conditional expansion statements.   5
  37. What are positional parameters, keyword parameters and expansion time variables in macros ? Give a smple example to show their usage.   6 + 2
  38. What data structures may be used for macro expansion? Explain.    4 + 5
  39. What are the various methods of binding formal and actual parameters in macros ? How is parameter passing in macros different from that in subroutines ?   3 + 3
  40. How are "expansion time variables" in macros different from normal program variables?  3
  41. What do you understand by the terms linking and relocation? What requirements do these tasks put on the translation process?   5
  42. How can program relocation be performed?  4
  43. What is relocation factor ?   3
  44. How do the segment registers in Intel 8086 processor affect the relocation requirements of program generated for it ?   4
  45. Why is "linking" required after a program is translated?  3
  46. What does the term object file mean in context of program linking? What are shared objects ?   3 + 3
  47. Briefly explain the phenomena of static and dynamic linking. Why is dynamic linking generally preferred?  5 + 3
  48. What are the advantages of "dynamic linking" over "static linking"? What kind of additional information processing (i.e., book keeping) does it require to support dynamic linking ?   5 + 5
  49. What is "lazy binding" in UNIX?  4
  50. Briefly describe the dynamic linking scheme in MS Windows.   5
  51. Explain with a small example how linking and loading of a required module of a program can be done depending on the runtime conditions during the program's execution.   6
  52. Briefly describe the dynamic linking scheme in UNIX.   5
  53. Why is relocation required during static linking?  3
  54. What does a assembler do to facilitate linking?  3
  55. What is a Module Table in MS Windows ? What are some of its important components?  4
  56. Briefly describe the ActiveX feature in MS Windows   5
  57. What is an activation record and why is it used ? Why are activation records maintained in a stack ?   4 + 2
  58. What are some of the optimisations that can be performed by a compiler ? Which kind of optimisation is more effective inside loops - space optimisation or time optimisation ? Why ?   5 + 2
  59. Why is optimization attempted by a compiler but not by an assembler ? 3
  60. What are the major stages in the process of compilation?   5
  61. What does parsing mean in the context of compilers?  3
  62. Describe the syntax for a variable definition statement in C language for simple scalar variables using Context Free Grammar. Give the rightmost derivation sequence for the statement -    4 + 2
    short a, count, *p;

  63. Why is the feature of putting "break points" very important in debuggers?  3
  64. Propose a suitable data structure scheme for an interactive text editor.   6
  65. What are some essential features in program debuggers ? How can these be implemented ?   3 + 3
  66. What are input-output redirection and pipes in shells in UNIX ?   5
  67. Briefly describe the UNIX utilities - make, sed, rcs.    5 + 5 + 5