You are on page 1of 23

SECTION - A

I. Answer any ten questions. Each question carries two marks

1. Define System Programming.


System software consists of a variety of programs that support the operation of a
computer 
Ex:OS,compiler,loader linker ,assembler,macroprocessor 
System software acts as an intermediary between the users and the hardware. It
creates a virtual environment for the user that hides the actual computer
architecture

2. Mention the function of loader.


 Allocate space in memory for the programs (allocation)
 Resolve symbolic references between object decks(linking)
 Adjust all address dependent locations(relocation)
 Physically place the machine instructions and data into memory(loading)

3. Explain BCT and LTORG pseudo-ops.


 BCT indicates branch and count it is a RX type instruction whose size is 4 bytes.
 Ex: BCT 3, loop
 Decrements register 3 by 1 if result is not 0 branch back to loop
 LTORG is a pseudo opcode which tells the assembler to place the encountered
literals at an earlier location

4. Define DC and DS.


 DC is a declarative pseudo opcode used to create a memory area to hold a
constant value
Syntax: DC „constants‟
Ex: FOUR DC „F4‟
 DS is the pseudo opcode that reserves storage for the data and gives them a
name
Syntax <Label> DS „size‟
Ex: FOUR A DS 1F

5. What is Macro ? write down its syntax.


 Macro instructions are the single line of abbreviation for group of instructions 
OR 
 The design of macro processor is generally machine independent. 
 Every programming language must be uses the macro processor

6. Define open and closed subroutine.


 A closed subroutine will stored outside the main routine and there is a transfer
of control to the sub routine for processing it.
 It saves memory.
 No problem for executing larger size macros any number of times.
 Open subroutine or macro definition is one whose code will be inserted at the
point of function call within the main definition.
 It is a wastage of memory.
 If the macro definition is very large and if you call these functions frequently
shortage of memory may occur.

7. Define PSW.
It contains the value of the location counter, protection information and interrupts
status which is 64bits in length.

8. Define local and global Optimization.

9. What is MDT and MNT ?


 MDT[macro definition table] which is used to store the body of the macro
definition
 MNT[macro name table], which is used to store names of the defined macro

10. Whats is sorting ?

11. Differentiate between compiler and assembler.


12. Mention any 4 components of SP.
The various components of system software are:
1. Assemblers
2. Loaders
3. Macros
4. Compilers or interpreters
5. Operating system

SECTION - B
II. Answer any five questions. Each question carries five marks

13. Explain Data formats of IBM 360/370 machine.


The different types of data formats present in IBM system 360 are
1. Short form fixed point numbers
2. Long form fixed point numbers
3. Packed decimal numbers
4. Unpacked decimal numbers.
5. Short form floating point number
6. Long form floating point numbers
7. Logical or character data
1. Short form fixed point numbers

Example 1: Decimal number +257 is represented as


S(+) binary equivalent
0 000 0001 0000
0001
16bits

2. Long form fixed point numbers

Example: The byte address starting from 1016 it occupies four locations
4 bytes =32bits

0 000 0000 0000 0000 0000 0001 0000 1011


S(+) 1016 1017 1018 1019
Byte address

3. Packed decimal numbers 


 The numbers are represented in binary coded decimal format
 Sign bit contains the BCD of hexadecimal digits A,B,C,D,E & F  The hex digits
C,A,F,E indicates a +ve numbers
 While D & B indicates a –ve numbers

Example:-021 is represented as
2bytes

0000 0010 0001 1101

BCD 0f 021 sign bit(-)

4. Unpacked decimal numbers.

 The last 1byte (4+4 bits) is reserved for sign and data.
 In between the BCD of each numbers a 4 bit zone code/padding bit/internibble
bit is introduced which contains 0/1.
 The hex digits C,A,F,E indicates a +ve numbers
 While D & B indicates a –ve numbers

5. Short form floating point number


Example:-118.625e5

4byts(32bits)
1bit 7bits 24bits
1 1000010 0111 0110 1010 0000 0000 0000
S Exponent Fraction 
 1bit-sign bit(-ve)
 7bits represent exponent-in this example 5 is the exponent the range of the 7bit
is 127.so add 127+5=132 then 132 is convert to binary(2) by division method
 24bits represents fraction-in this example 0.625 is the fractional part then
convert 0.625 to binary by repeated multiplication by 2
6. Long form floating point numbers
It is same as short form floating point numbers but in Long form floating point
numbers consists of 64bits (8 bytes) are allocated for the floating point number
which contains the exponential and fractional part

7. Logical or character data

In character data each character code is stored in 8 bits (1byte) and its length varies
from 1 to 256 bytes.

Example: „A‟ is represented in IBM 360 as


1byte
0100 0001

14. Explain Long-Way-No-Looping with example.


 Register 2 is used as an accumulator
Index register is 0.therefore the contents of the index register is also 0.
Address of the storage operand=offset + contents of the base register.
Content of register 1 is 48
L 2,904(0, 1)
Load the first number into register 2
Address of the storage operand =904+contents of base register1
=904+48
=952 
Contents of register 2=contents of memory location 952=Data1
A 2,900(0, 1) 
Add 49 with data1 
Address of the storage operand =900+contents of base register1
=900+48
=948 
Contents of register 2 =contents of register2+contents of memory location 948
=Data1+49
ST 2,904(0, 1) 
Address of storage operand =904+contenet of register1
=904+48 =952 
Content of register 2 =content of base register2
=Data1+49
L and ST are RX type instruction. Whose size is 4 bytes.Therefore absolute and
relative address is incremented by 4.
Advantages 
Implementation is easy.
Disadvantages 
Instructions are repeated for all the data item.
It is impossible to access both the first data item and the last data item using
register 1 as the base
Wastage of memory
Need of relocation.
Instruction would overlap data in the core.

15. Sort following array using Radix exchange Sort.


21 , 14 , 19 , 11 , 7 , 12
16. Explain Macro definition with arguments with an example.
Macro definition attaches a name to a sequence of instruction
Structure of macro-definition
MACRO starting of macro definition
[ ] give a macro_name
…………….
……………. sequence of instruction
…………….
MEND ending of macro definition
The macro definition starts with MACRO pseudo op code. It indicates
beginning of the macro definition. The Macro-definition
Ex: Sequence of instruction will be
A 1, data
A 2, data
A 3, data
…..
…..
A 1, data
A 2, data
A 3, data
…..
…..
A 1, data
A 2, data
A 3, data
…..
…..
Data DC f „5‟
In the above example the sequence of
A 1, data
A 2, data
A 3, data
It repeats 3 times MACRO permits as to attach a name to this sequence
and to use the name in its place then the macro definition will be
MACRO
Add
A 1, data
A 2, data
A 3, data
MEND
Where
MACRO=> is a pseudo op indicates beginning of definition
Add => is the name of the macro
MEND => is a pseudo op indicate end of the macro definition
Between the name of the Macro Add and MEND we have the sequence of
instruction.

17. Write specification of databases used in pass 1 and pass 2 Assembler.


Pass 1: database
1. Input source program
2. Location counter (lc)-it is used to store each instruction location
3. MOT(machine opcode/operation table)-it is used to store mnemonic or symbols
for each instruction and its length
4. POT(pseudo operation table)-it is used to store the all pseudo opcodes in our
source program and corresponding actions.
5. ST(symbol table):it is used to store all the symbol /labels used in our program and
its corresponding value.
6. LT(literal table): it is used to store all the literals/constants used in our program
and its assigned location.
7. A copy of the input to be used later by pass 2

Pass 2: databases
1. copy of the source program input to pass-1
2. LC:it is used to store each instruction location
3. MOT:it is used to store all directives or mnemonics and its length, binary opcode
and instruction format
4. POT: it is used to store all directives and its action corresponding index
5. ST(symbol table)-it is used to prepare by pass 1 it consists of each label and its
value
6. BT(base table)-it is used to store which registers are currently specified as base
register by USING pseudo opcode and it specifies the contents of these registers
7. INST-this is a work space used to store each instruction as its various parts. Ex:
binary opcodes, register fields, length fields etc
8. Print line: it is also work space used to produces a printed listing
9. Punch card: it is also work space used for converting the assembled instructions in
the format needed by the loader.

18. Explain General Loader Scheme.


The general loader can be solve the draw backs of previous loader it is compiler and
go loader. This loader accepts multiple object programs at a time. Generally loader is
assumed smaller than the assembler so that more memory is available to the user.
Advantages: 
 In this scheme there is no require for retranslation for each and every program
because here we are storing the loader instead of assembler

19. Explain Machine independent optimization.


Machine Independent Optimization – This code optimization phase attempts to
improve the intermediate code to get a better target code as the output. The part of
the intermediate code which is transformed here does not involve any CPU registers
or absolute memory locations.

20. Explain databases used in lexical analysis phase of compiler.


Recognition of basics element or tokens and creation of uniform single table
The lexical phase performs the following three tasks:
1. Recognize basic elements are tokens present in the source code
2. Build literal and an identifier table
3. Build a uniform symbol table
Database:
Lexical phase involves the manipulation of 5 databases
1. Source program
2. Terminal table
3. Literal table
4. Identifier table
5. Uniform symbol table
1 Source program: The original form of the program created by the user 2 Terminal
table: It is a permanent database it consist of 3 fields

Symbol Indicator precedence

 Symbol:
operators, keywords and separators [(,;,:]
 Indicators: values are YES or NO Yes=> operators, separators No=> Keywords
 Precedence: Used in later phase

3 Literal table: It describes all literals constants used in the source program.
It consists of 6 fields:
Literal Base Scale Precision Other address
information

4 Identifier table:
It describes all identifiers used in the source program. It consists of three fields

1. Name
2. Data attribute
3. Address
Name Data attribute Address

5 Uniform symbol tables:


Uniform symbol table represent the program as a strange of tokens rather than
individual character. There is one uniform symbol for every token in the program It
consists of 2 fields:
Table class index

SECTION - C
III. Answer any three questions. Each question carries fifteen marks

21. (a) Explain General Machine Structure of IBM 360/370 with a neat
daigram.
The CPU consists of 
1. An instruction interpreter 
2. A location counter 
3. An instruction register 
4. Various working registers and 
5. General purpose registers
 Instruction interpreter 
It is a group of electrical circuits that performs the purpose of the instructions
fetched from the memory.
It is like a decoder that decodes the type of the instruction.
 Location counters (LC)
It is also known as program counter or instruction counter which holds the location
of the current instructions being executed
 Instruction registers (IR)
It contains a copy of the current instruction that is executed.
Working registers (WR) 
WR are memory devices that serves as „SCRATCH PAD‟S‟ (a plurality of multibit
storage locations) for instruction interpreter.  WR are general purpose registers.
General purpose register GPR‟S are used by the programmer as storage locations
and for special functions.
 Memory address registers (MAR)
It contains the address of memory location that is to be read from or stored into.
 Memory buffer register (MBR)
It contains a copy of the designated memory location specified by the MAR, after
read or write.
 Memory controller
It is hardware that transfers data between the MBR and the core memory location
the address of which in the MAR
 I/O channels
It may be through of as separate computers which interpret special instructions for
inputting and outputting information from the memory.

(b) Explain instruction formats of IBM 360/370 with syntax and example.
The different instruction formats are
 RR format
 RX format
 RS format
 SI format
 SS format
 RR instruction: 
RR instruction denotes register to register operation.i.e, both the operands are
register. 
The length of RR instruction is 2 bytes (16 bits) 
The general format of RR

Example: the instruction is Add 3, 4

 RX instruction: 
RX instruction denotes a register and indexed storage operation
The length of RX instruction is 4 bytes (32 bits)
The general format of RX instruction is

Indexed storage operand refers to the data stored in core memory. The address of
the storage operand is calculated as follows
Address=value of an offset or displacement + contents of a base register + contents
of an index register
=C(B2)+C(X2)+D2 
Example: ADD 3,16(0,5)

Assume base register 5 contains the number 1000 


The address of the storage operand= C(B2)+C(X2)+D2
=C(5)+0+16
=1000+0+16
=1016
 RS instructions 
RS instruction denotes register and storage operation
The length of RS type instruction is 4 bytes (32 bits).
The general format of RS instruction is

Address=value of an offset or displacement + contents of a base register =C (B2)+D2



Example 1: LM 1, 3 16(5)

The load instruction loads register 1 and 3 with the contents of location 1016
 SS instruction 
SS instruction denotes a storage to storage operation
The length of SS instruction is 6 bytes(48 bits)
The general format is


Example 1: MVC 32 (79, 5), 300(5)

In SS format, the length is always on less than the data moved.i.e.


If L=0 move 1 byte.  Here L=79, therefore move 80 bytes from location 1032[till
1111(1032+79)] to 1300[till 1379(1300 + 79)]

22. (a) Draw detailed pass 2 flow chat of an assembler.


(b) Give format of all five tables used in assembler.
 MOT table 
MOT table is used in both pass1 and pass2
The size of the MOT table will be 6 bytes
The both passes can take one MOT table.
In pass-1 the fields mnemonic opcode and instruction length are filled In pass 2 the
binary opcode and instruction format are filled
Format of the MOT table
 POT table 
This table is a fixed table
This is similar to the pass 1 and pass2.
It contains pseudo opcode and corresponding address
The size of this table is 8 bytes
Format

 Symbol table 
It is a variable table
Same table is used in both pass1 and pass2
The size of the table is 14 bytes per entry
The length field indicates the length in bytes of the instruction to which symbol is
attached
Absolute means the value of the symbol doesn‟t change if the program is moved in
core

 Literal table 
It is also a variable table 
It contains literal and its values
It is same as symbol table but instead of storing symbols we were store literals in a
table
The size of the table is 14 bytes per entry

 Base table 
It is a variable table
It is used to specify the base register
It is used only in pass2
The size of this table is 4 bytes per entry

23. (a) Write specification of databases used in pass 1 and pass 2 of


Macro processor.
Pass1 [Processing macro-definition and calls] 
 The input macro source code
 The output macro code copy to pass2
 MDT[macro definition table] which is used to store the body of the macro
definition
 MNT[macro name table], which is used to store names of the defined macro
MDTC[Macro Definition table Counter] which is used to indicate the next
available entry in MDT
 MNTC[Macro Name Table Counter] which is used to indicate the next available
entry in MNT
 ALA[Argument List array] to substitute index marker for the dummy argument
before storing a macro definition

Pass2 [Processing Macro Expansions] 


 Copy of the output macro source code from pass1
 Output expanded source code to be used as input to the assembler
 MDT created by pass1
 MNT created by pass1
 MDTP[Macro Definition Table Pointer] which is used to indicate the next line of
text during expansion
 ALA is the reverse function of pass1 to substitute macro call
arguments(positional arguments) for the index markers.

(b) Explain Macro instructions defining Macros with an example.

24. (a) Explain design of an absolute loader with a neat diagram.


 In this scheme the assembler outputs the machine language translation of the
source program.
 The data is punched on the cards instead of being placed directly in memory
 The loaders in turns simply accept the machine language text and places into
core at the location prescribed by the assembler.
 The main program assigned to location 100 to 247 and the subroutine is
assigned to the location 400 to 477, if the changes were made to main memory
i,e., increased its length more to an 300 byte at that time relocation is necessary

The loader functions are accomplished as follows in an absolute loader schemes


1. Allocation by the programmer
2. Linking is also by the programmer
3. Relocation is by assembler 4. Loading by loader

Design of an absolute loader: We can design an absolute loader we must and should
having two types cards
1. Text cards.
2. Transfer cards.
1 Text cards:
This type of card is used to store instructions and data. The capacity of this card is
80bytes.
It must convey the machine instructions that assembler has created along with
assigned core location.
2 Transfer cards:These cards must convey the entry point of the program, which is
where the loader is to transfer the control when all instructions are loaded.

(b) Write specification of databases used in pass 1 and pass 2 Direct


Linking Loader.
1 Pass1 database:
1. Input object decks
2. The initial program load addresses [IPLA]: The IPLA supplied by the programmer
or operating system that specifies the address to load the first segment.
3. Program load address counter [PLA]: It is used to keep track of each segments
assigned location
4. Global external symbol table [GEST]: It is used to store each external symbol and
its corresponding assigned core address
5. A copy of the input to be used later by pass2
6. A printed listing that specifies each external symbol and its assigned value.
2 Pass2 database:
1. A copy of object program is input to pass2
2. The initial program load address [IPLA]
3. The program load address counter [PLA]
4. A table the global external symbol table [GEST]
5. The local external symbol array [LESA]: which is used to establish a
correspondence between the ESD ID numbers used on ESD and RLD cards and the
corresponding External symbols , Absolute address value

25. (a) Explain different phases of compiler with neat diagram.


 Lexical phase:
The lexical phase performs the following three tasks:
1. Recognize basic elements are tokens present in the source code
2. Build literal and an identifier table
3. Build a uniform symbol table
Database: Lexical phase involves the manipulation of 5 databases
1. Source program
2. Terminal table
3. Literal table
4. Identifier table
5. Uniform symbol table
 Syntax Phase: The functions of the syntax phase are
1. To recognize the major construct of the language
2. To call the appropriate action routines that will generate the intermediate form or
matrix form the constructs
Databases:
1 Uniform symbol table
2 Stack
3 Reduction table
 Interpretation Phase:
1. Uniform symbol table
2. Stack
3. Identifier table
4. Matrix
 Optimization Phase:
Optimization performed by a compiler are of 2 types. They are
1. Machine dependent Optimization: It is related to the machine instructions that
get generated. So it is added into the code generation phase.
2. Machine independent Optimization: It is not related to the machine instructions.
It is used to increase efficiency of the code and reduces the lines of code.
 Code generation:
The Purpose of the code generation is to produce appropriate code. In this phase
Matrix is the input data base.
Data bases: 
1 Matrix
2 Identifier table
3 Literal table
4 Code productions.

(b) Explain syntax phase of a compiler.


The functions of the syntax phase are
1. To recognize the major construct of the language
2. To call the appropriate action routines that will generate the intermediate form or
matrix form the constructs
Databases:
1 Uniform symbol table:
The table create a by lexical phase The uniform symbols are the source of input to
the stack which s used by syntax and interpretation phase
Table classes index

2 Stack: The stack is a collection of uniform symbol i.e., currently being worked on
the stack is organized in LIFO technique
3 Reduction table: The syntax rules of the source language are contained in the
reduction table The general form of the reduction or rules is:- Label: old top stack/
action routine/ new top stack/ next reduction
Algorithm:
Step1: Reduction or tested consequently for match between old top of stack field
and the actual top of stack until match is found
Step2: When match is found the action routine specified in the action fields are
executed in ordered from left to right
Step3: when controlled return to the syntax analyzer, it modifies the top of stack to
agree with the new top of tack.
Step4: step1 is repeated starting with the reduction specified in the next reduction
field
SECTION - D
IV. Answer any one questions. Each question carries ten marks

26. (a) Explain the terms macro definition , macro call ,macro expansion
with syntax and example .
 Macro Definition:
Macro definition attaches a name to a sequence of instruction
Structure of macro-definition
MACRO starting of macro definition
[ ] give a macro_name
……………
……………. sequence of instruction
…………….
MEND ending of macro definition
The macro definition starts with MACRO pseudo op code. It indicates beginning of
the macro definition. The Macro-definition terminated with the MEND pseudo op
code.
Ex:
MACRO
Add
A 1, data
A 2, data
A 3, data
MEND
 MACRO Calls or Invocation:
Once the macro has been defined, the use of the macro name in the place of
sequence
Definition: Sequence of instruction are simply substituted at the point of call or
macro name is referred as macro call
Ex: In the above mentioned example sequence will be repeated thrice, then we
need to replace sequence by macro name like:
MACRO
Add
A 1, data
A 2, data
A 3, data
MEND
…….
Add
……
Add
……
Data DC f „5‟
 Macro Expansions:
Whenever the program needs the instruction in the place of macro name then we
need macro expansion.
Definition: The macro-processor replace each macro calls with the defined set of
instructions. This process of replacement is called macro expansion.
Source Expanded source
MACRO
Add
A 1, data
A 2, data does not appear
A 3, data
MEND
……..
Add A 1, data
…… A 2, data
…… A 3, data
Add A 1, data
…… A 2, data
….…… A 3, data
Data DC f „5‟

(b) Draw Micro flow chart for ADD instruction.

27. (a) Explain different types of cards used in Direct Linking Loader .
There are 4 types of cards available in the direct linking loader. They are
1. ESD-External symbol dictionary
2. TXT-card
3. RLD-Relocation and linking dictionary
4. END-card
1 ESD card:
It contains information about all symbols that are defined in the program but
reference some where
It contains:
Reference number
Symbol name
Type Id
Relative location
Length
There are again ESD cards classified into 3 types of mnemonics. They are:
1. SD [Segment Definition]: It refers to the segment definition [01]
2. LD It refers to the local definition [ENTRY] [02]
3. ER: it refers to the external reference they are used in the [EXTRN] pseudo op
code [03]
2 TXT Card:
It contains the actual information are text which are already translated.
3 RLD Card:
This card contains information about location in the program whose contexts
depends on the address at which the program is placed. In this we are used „+‟ and
„–„sign, when we are using the „+‟ sign then no need of relocation, when we are
using „-„sign relocation is necessary.
The format of RLD contains:
1. Reference number
2. Symbol
3. Flag
4. Length
5. Relative location
4 END Card:
It indicates end of the object program.
The size of the above 4 cards is 80 bytes

(b) Write a note on compile and go loader.


Compile and go loader:
It is a link editor or program loader in which the assembler its selfplaces the
assembled instruction directly into the designated memory location. After
completion of assembly process it assigns the starting address of the program to the
location counter, and then there is no stop between the compilation, link editing,
loading, and execution of the program

Advantages:
They are simple and easier to implement
Disadvantages: 
This loader can perform and take only one object program at a time 
A portion of memory is wasted because of the memory occupied by the assembler
for each object program due to that assembler necessary to retranslate the user
program every time 
It is very difficult to handle multiple segments or subprograms

You might also like