Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Repairing
IT (2012)
for
Second Semester
Sample Question
1. Explain Hand Drive Physical Installation. (20 Marks)
2. Describe Hard Disk Installation Produces. Explain Hard Drive Physical
Installation. (20 Marks)
3. Describe High-Level (Operating System) Formatting. (10 Marks)
4. Explain FDISK and FORMAT limitations. (10 Marks)
5. Explain BIOS Hardware/Software. (15 marks)
6. Briefly explain ROM, PROM, EPROM, EEPROM /Flash ROM.
(20 marks)
7. Describe system components and explain processor, floppy disk and removable
drives, CD/DVD-ROM drive, keyboard and pointing device (Mouse), Video card
and Display, sound card and speakers. (20 marks)
8. Explain about motherboard installation. (20 marks)
9. Describe connect of the power supply, replacement of the cover and connection of
the external cables. (10 marks)
10. Explain connect I/O and other cable to the motherboard. (20 marks)
11. Explain running the Motherboard BIOS setup program. (CMOS setup)
(20 marks)
16. What are sample weekly and monthly maintenance procedures? (10 marks)
IT (2012)
for
Second Semester
PROM
PROMs are a type of ROM that is blank when new and that must be programmed
with data .The PROM has been avabiable in size from 1 KB (8 KB) to 2MB (16MB) or more.
They can be identified by path numbers which are 27 nnnn-where the 27 indecates the TI
type PROM and the nnnn indicates the size of the chips in KB (not bytes) .
Although these chips are blank when new, they are preloaded with binary 1’s
A blank PROM can be programmed . This requires a special machine call a device
programmer .
Each binary 1 –bit can be thought of as a fuse, which is intact. Most chips run on 5
volts, but when a PROM is programmed , a higher voltage is placed at the various addresses
with the chip.
PROM chips are used at OTP chips . The act of programming a PROM takes
anywhere from a few seconds to a few minutes , depending on the size of the chip and the
algorithm used by the programming device. A typical PROM programmer has multiple
sockets .This is called gang programmer and can program several chips at once.
EPROM
7. Describe system components and explain processor, floppy disk and removable
drives, CD/DVD-ROM drive, keyboard and pointing device (Mouse), Video card
and Display, sound card and speakers. (20 marks)
System Components
The components used in building a typical PC are fuse and power supply,
Motherboard, Processors with heat sink.
Memory Video card and display
Floppy drive Sound card and speakers
Hard disk drive cooling fans
CD-ROM/DVD drive cables
Keyboard Hardware (nuts, bolts, screw and brackets)
Pointing device (mouse) Operation system software
Processors
The motherboard should have one of the following processor sockets or slots:
Super 7: Supports the Intel Pentium, Pentium MMX, AMD K5, K6, K6-2, K6-3 Cyrix
6x86, 6x8xMx and MII Processors.
Socket 370 (also called PGA 370): Supports the socket versions of the Intel Celeron
processor.
Slot 1 (also called SC-242): Support the slot versions of the Intel Celeron, Intel
Pentium II and Pentium III processors
Slot 2 (also called SC-330): Supports the Intel Pentium II Xeon and Pentium Xeon
processors.
Floppy Disk and Removable Drives
Since the advent of the CD-ROM, the floppy disk drive has largely been
relegated to a minor role as an alternative system boot service.
LS-120(Super Disk) drives, which is a floppy drive that can read and write not
only the standard 720kB and 1.44MB formats but a high capacity 120MB format as
well.
Super Disk drive functions don’t need a standard floppy. Zip drive need to
install a conventional floppy for backward compatibility, system configuration and
system maintenance issues.
CD/DVD-ROM Drive
A CD/DVD-ROM drive should be considered a mandatory item in any PC
construction. This is because virtually all software is now being distributed on CD-
ROM, and many newer titles are on DVD. DVD drives can read CD-ROM drives as
well as DVD-ROMs, so they are more flexible.
DVD-ROM is a high-density data storage format that uses a CD sized disc to
store a great deal more data than a CD-ROM from 4.7 – 17GB, depending on the
format.
These drives can read standard drums and audio CDs as well as the higher
capacity DVD data and video discs.
Keyboard and Pointing Device (Mouse)
Two types of keyboard connectors are found in systems today. The purchasing
keyboard must be matched with the connectors on the motherboard.
10. Explain connect I/O and other cable to the motherboard. (20 marks)
There are several connections that must be made between a motherboard and the
case. If the motherboard has onboard I/O, use the following procedures to connect the
cables:
1. Connect the floppy cable between the floppy drives and the 34 pin floppy
controller connector to the motherboard.
2. Connect the IDE cables between the hard disk, IDE CD-ROM, and athe 40-
pin primary and secondary IDE connectors on the motherboard.
3. On non-ATA boards, a 25-pin female cable port brackets in normally used
for the parallel port.
4. If the ports don’t have card slot-type brackets, the essential expansion slots
may be port knockouts on the back of the case that can use instead.
5. Advanced motherboards include a built-in mouse port. The connector for
this port is not built into the back of the motherboard. In that case, plug the
cable into the motherboard mouse connector and then attach the external
mouse connector bracket to the case.
6. Attach the front panel switch, LED, and internal speaker wires from the case
front panel to the motherboard.
11. Explain running the Motherboard BIOS setup program. (CMOS setup)
(20 marks)
Now that everything is connect, the system will also test itself to determine
whether there are any problems:
1. Power on the monitor first, and then the system unit, observe the
operation via the screen and listen for any beeps from the system
speakers.
2. The system should automatically go through a power-on self-test (POST)
consisting of video BIOS checking, RAM testing and usually an installed
component report. If there is a fatal error during the POST, you may not
see anything on screen and the system might beep several times,
indicating a specific problem. Check the motherboard BIOS
documentation to determine what the beep bodes mean.
3. If there are no fatal errors, you should see the POST display on screen.
Depending on the type of motherboard, press a key or series of keys to
interrupt the normal boot sequence and get to the setup program screen
that allow you to enter the important system information. Normally, the
system will indicate via the onscreen display which key to press to
activate the BIOS setup program during the POST, check the
motherboard manual for the key to press to enter the BIOS setup.
4. After the setup program is running, use the setup program menus to enter
the current data and time, your hard drive settings, floppy drive types,
video cards, keyboard settings and so on. Most new motherboard enters
any parameters for it.
5. Once you gave checked over all the setting in the BIOS setup, follow the
instructions on the screen or in the motherboard manual to save the
settings and exit the setup menu.
12. Explain troubleshooting new installations. (20 marks)
At this point, the system should reset and attempt to boot normally from either a
floppy disk or hard disk. The system should boot from Drive A and either reaches an
installation menu or an A: prompt. If there are any problems, there are some basic
items to check.
If the system won’t power up at all, check the power cord. If the cord is plugged
into a power strip, make sure the strip is switched on. There is usually a power switch
on the front of the case, but some power supplies have a switch on the back as well.
Check to see if the power switch is connected properly inside the case. There is
a connection from the switch to the motherboard, check both ends to see that they are
connected properly.
Check the main power connector from the supply to the board. Make sure the
connection are seated fully and if the motherboard is a Baby-AT type, make sure they
are plugged in with the correct orientation and sequence.
If the system appears to be running but you don’t see anything on the display,
check the monitor to ensure that it is plugged in, turned on, and properly connected to
the video card.
Make sure the monitor cord is securely plugged into the cord. Check the video
card to be sure it is fully seated in the motherboard slot. Remove and reseat the video
card and possibly try a different slot if it is a PCI card.
If the system beeps more than once, the BIOS is reporting a fatal error of some
kind, look in the BIOS section for a table of beep codes.
codes, onscreen text messages, and hexadecimal numeric codes that are sent to
Beep codes are used for fatal errors only, which are errors that occur so
early in the process that the video card and other devices are not yet functional.
Because no display is available, these codes take the form of a series of beeps that
identify the faulty component. When your computer is functioning normally you
should hear one short beep when the system starts up at the completion of the
POST.
POST checkpoint codes can be used to track the system progress through
the boot process from power-on right up to the point at which the bootstrap
loader runs. When placing a POST code reader card into a slot, during the
POST, will see two digit hexadecimal numbers flash on the card’s display. If the
system stops unexpectedly or hangs, can identify the test that was in progress
during the hang from the two-digit code. This step usually helps to identify the
malfunctioning component.
failure. These messages can be displayed only after the point at which the video
checkpoint code for various BIOS versions. If your BIOS is different from what I
have listed here, consult the documentation for your BIOS or the information
products.
SCSI Diagnostics
SCSI is an add-on technology, and most SCSI host adapters contain their
own BIOS that enable you to boot the system from a SCSI hard drive. The SCSI
BIOS contains configuration software for the adapter’s various features and
For SCSI adapters that use direct memory access (DMA) a Host adapter
adapter and the main system memory array by performing a series of DMA
transfer. It this test fails, you are instructed how to configure the adapter to use a
The term boot comes from the word bootstrap and describes the method by
which the PC becomes operational. Just as you pull on a large boot by the small
strap attached to the back, a PC loads a large operating system by first loading a
small program that can then pull the operating system into memory. The chain
of events begins with the application of power and finally results in a fully
functional computer system with software loaded and running. Each event is
triggered by the event before it can initiate the event after it.
Error messages displayed during the boot process and those displayed
OS Independent OS Dependent
- Window (win.com)
16. What are sample weekly and monthly maintenance procedures? (10 marks)
- Check for and install any updated drivers for video cards, modems and
other devices.
- Clean the system, including the monitor screen, keyboard, CD/DVD drives,
- Check that all system fans are operating properly, including the CPU heat
Problems that occur during the POST are usually caused by incorrect
IT (2013)
for
Second Semester
Sample Question
PART (I)
PART (II)
13. (a) Why an IT learns Assembly Language? (10-marks)
(b) DEBUG the following simple programs. (10-marks)
1. mov ax,5
2. add ax,10h
3. add ax,20h
4. mov sum, ax
5. int 20
14. What is debugger? Explain the debug commands. (20 marks)
15. Trace the instructions using DEBUG and write down the final contents of AX and
BX registers. (20 marks)
16. Describe the CPU registers and explain the data registers with diagram. (20 marks)
17. (a) What is the Segment Registers? (10 marks)
(b) Describe the Index Registers. (10 marks)
18. Explain the conditions of control flags and status flags. (20 marks)
19. (a) Draw the IBM PC-XT/AT memory map.
(b) Demonstrate the data exchange the two variables from memory. (20-marks)
20. (a) If any of the following MOV statements are illegal, explain why:(10-marks)
(b) What will be the hexadecimal value of the destination operand after each of the
following moves? (If any instruction is illegal, write the word ILLEGAL as the
answer.) (10-marks)
21. (a) What will be the hexadecimal value of the destination operand after each of the
following Statements has executed? You may assume that var1 is a word variable
and that count and var2 are byte variables. If any instruction is illegal, write the
word ILLEGAL as the answer. (10-marks)
(b) As each of the following instructions is executed, fill in the hexadecimal value of
the operand listed on the right-hand side: (10-marks)
22. Explain direct addressing mode and indirect addressing mode. (20 marks)
Microprocessor Interfacing & Programming
IT (2013)
for
Second Semester
Device-selection signals
2. (b) Briefly explain about using read and write signals. (10marks)
Explain Read & Write siganls are supplied to the Decading circuit
The microprocessor reads information from device A and write information to
device B. Signal CS, can therefore be active by supplying a unique address and activating
the read line. This signal enables device A to supply information to the data bus. Device
A can be the source of the information, or it can act as carrier can activate signal CS2 in
the same way expect for activating the writing rather than the read line. This resc in
enabling device B to accept information can be used by device B, or passed or an external
circuit or system.
decoding
circuit
address and
control lines
CS2 CS1
microcomputer device
data line A
device
B
4. Design a circuit to generate four active low control signals to allow an 8086
microprocessor to communicate with memory mapped or input/output mapped devices.
The signals should permit the processor to read from or write to these devices
individually.(10 marks)
Answer:
The requirement can be satisfied by using three control lines from the processors,
namely RD ,WR and M/IO line is low for input/output mapping and high for memory
mapping The required output signals are normally referred to as:
MEMR (MEMORY READ)
MEMW (MEMORY WRITE )
IOR (INPUT / OUTPUT READ)
IOW(INPUT / OUTPUT WRITE )
The MEMR and MEMW signals are used to identify the aim of the
microprocessor to communicate (read or write) by using the memory-mapping method
.On the other hand ,IOR and IOW signals indicate whether the microprocessor wants to
read from or write to a device by using the input/output-mapping method .The circuit in
figure uses two ICS,
1. 74ls32 (quad 2 input OR gate 2c) and
2. 2.74LS14 (hex schmitt-trigger inverting gates)
RD
MEMR
WR
MEMW
M/IO o
IOR
IOW
.
Fig . Generating device-control signals using the 8086.
5. Design a circuit to generate four active low control signals to allow an Z80
microprocessor to communicate with memory mapped or input/output mapped devices.
The signals should permit the processor to read from or write to these devices
individually.(10 marks)
Answer:
The z80 provides one line for the input/output request(IORQ) and another for the
memory request(MEMRQ) when the z80 wants to receive information from an external
source, it activates either of these lines and sets the read line (RD) to a logic 0 state.
Similarty , writing to an external destination is performed by activating either of these
lines and the write line (WR).
The required four signals can be produced by using these two lines with the read
and write lines, where all the signals are active-low. So the circuit in figure use only one
TC (1 74LS32 (quad 2input OR gate IC).
RD
MEMR
WR
MEMW
MEMRQ
IOR
IORQ
IOW
.
Fig: Generating device-control signal using the Z80.
Let us now consider generating device-control signals from the 68000 microprocessor.
Answer:
Since 6800 microprocessor uses memory mapping, reading from or writing to
add-one is treated as a memory read or a memory write respectively. Both the read and
write signals are supplied on a single line and can be separated by using a single inverting
gate to produce active low read and write signals.
R/W oR
MEMR
W
MEMW
MEM
Answer
A simple circuit which can be used to allow the microprocessor to send
information (write) to the add-on. Once the device receives the information, it activates
the DTACK line informing the micro- processor of the reception of data.
If the aim of the interface is to receive data from the add-on (read), then an
inverting gate is required to invert the R/W signal before supplying it to the input of the
OR gate.
68000
data bus
AS decoding
device
circuit
address bus
En
R o
Ack
DTACK
68000
data bus
AS decoding
device
circuit
address bus
En
W o
Ack
DTACK
Signal X1 will be low when A15 is high white A14 and A13 are low.
For X1,
100x xxxx xxxx xxxx
8000H 9FFFH
Reserving area is
13
9FFFH – 8000H = 1FFFH = 2 = 8 KB
-Since X1 is low, the state of each output depends on the state of A12
X2 will be low (active) when X1 and A12 are low.
For X2,
1000 xxxx xxxx xxxx
8000H 9FFFH
Reserving area is
8FFFH – 8000H = FFFH = 12bit = 2 12 = 4 KB
X3 will be low (active) when X1 is low and A12 is high
For X3,
1001 xxxx xxxx xxxx
9000H 9FFFH
Reserving area is
12
9FFFH – 9000H = FFFH = 12 bit = 2 = 4 KB
A15 o X1
A14
A13
X2
A12
X3
o
2-input OR -4
Inverter -2
8. Modify the circuit presented in Example 2.4 so that a smaller addressing area is reserve
for the two addressing signals. (10 marks)
8. (a)Assume address
8700H Æ 87FFH
1000 0111 1111 1111
Signal X1 will be low, when A15 and A3 to A10 are high while A11, A12, A13, and A14 are
low.
For X1,
1000 0111 1111 1xxx
87F8H Æ 87FFH
Reserving area is
87FFH – 87F8H = 7F =111=23= 8 bytes
Since X1 is low , the state of each output depends on the state of A2.
A14
A13
A12
A11
X1
A10
A9
A8
o
A7
A6 o
A5
A4
A3 o
A15 X2
A2
X3
o
2-input OR -8
3-input NAND - 3
Inverter
A14 o
A13 o
A12 o
A11
o
A10
A9 X1
A8
o X2
A7
X3
A6
o
A5
A4
A3
A15
A2
2-input OR -2
13-input NAND - 1
Inverter -5
8. (b)
Assume address
9FF8 H Æ 9FFF H
Signal X1 will be low, when A15 and A3 to A12 are high while A13, and A14 are low.
For X1,
1001 1111 1111 1xxx
9FF8 H Æ 9FFF H
Reserving area is
9FFF H Æ 9FF8 H = 7H =111=23= 8 bytes
Since X1 is low , the state of each output depends on the state of A2.
A14 o
A13 o
A12
A11
A10 X1
A9
o X2
A8
X3
A7
o
A6
A5
A4
A3
A2
9. Design a circuit to provide an 8086 microprocessor with the ability to read from two
add-ons using I/o mapping. Assume that the area between 8700H to 87FFH.(10marks)
Both Read line and Input/output mapping line are zero, IOR is active-low
state.
1 2 input OR gate
Derive addressing signal
Let address locations are between 8700H to 87FFH.
A15
A14 o
A13 o
A12 o
A11 o
A10 X1
A9
o X2
A8
X3
A7
o
A6
A5
A4
A3
A2
IOR
CS2
o
X3
2 2 input OR gate
when IOR is low, CS1and CS2 depend on that X2 and X3 Both CS1 and CS2
are low active . The reserved addressing of both CS1 and CS2 are 4 byte.
10. Derive two active-low device-selection signal to read from two add-ons to 8086
microprocessor by using input/output mapping. Assume that the addressing area
between A7C8H to A7CFH can be used.(10 marks)
Using A2 line to divide two addressing signal X1 and X2 from X which occupied given
addressing area each. These area are
X = A7C8H to A7CFH = 8 bytes
X1 = A7C8H to A7CBH = 4 bytes and
X2 = A7CCH to A7CFH = 4 bytes occupied.
The given control signals from 8086 up are RD, WR and M/IO. The required control
signal IOR is derived by combining RD and IO signals.
Required device-selection signals can be combined by addressing signals and device
control signal.
D.S.S = A.S + D.C.S
C.S1 = X1 = IOR and C.S2 = X2 + IOR
8 OV 8 OV
Fig: Address decoders ( a) two 74LS138 ICS
The addressing area reserved for each device is reduced by using a second 74
LS138 decoder which is enabled when A8 is high and both of address line A9 and output
Y0 of the first decoder are low. For Y0 of second decoder the area 2100H to 21FFh . so
reserving area is 21FFH-210FH=FF H =8 bit=28=256 bytes . Each device reserve 32
bytes.
The addressing area reserved per signal is 1 kilobyte for outputs Y1 to Y7 of
the first decoder and 32 bytes for output Y0 to Y7 of the second decoder.
An input port is a 3 state buffer whose output is equal to its input only when
enabled by a controlling device, such as a microprocessor. It consists of several channels.
An input port can be formed from using one of many ICS.74LS244 is an 8 line 3
state buffer which contains two active low enable signals (1G and 2G). Each of these
signals control four buffer lines. Line 1G controls the four lines whose inputs are
A1,A2,A3 and A4whose output are C1,C2,C3and C4. Similarly, line 2G controls the four
lines B1,B2,B3 and B4 whose outputs are D1,D2,D3 and D4.An output line is at the same
logic state as its corresponding input when its control line is activated (logic 0 state)
By supplying the same command signal to both 1G and 2G.Lines, the IC will act
as an 8 bit port. The eight buffers of the IC are non-latching which makes the IC suitable
for use as input parts. An enabled input port supplies information to a data bus which is
time shared by several devices and accepts signals from one device at a time IC is
required for connection to an 8 bit data bus where as a 16 bit data bus requires two such
Ics to receive 16 bit information.
Each of these Ics contains four buffers, each of which can be enabled or disabled
independently of the others. The difference between the two Ics is in the state of the
enable line . It is active low in the 74LS125 and active high in the 74LS126.
1 20
1G VCC
2 19
A1 2G
3 18
D4 C1
4 A2 B4 17
5 D3 C2 16
6 15
A3 B3
7 14
D2 C3
8 13
A4 B2
9 D1 C4 12
10 11
GND B1
Fig 2.11 These state non latching buffers (a) the 74LS244 octal bufferI
(ii)Output ports
A widely used IC is the 74LS374 octal D type latch. It contains eight 3-state edge-
triggered flip-flops and provides two control lines, the first (pin 1) is the output enable
line, while the second (pin11) is the clock line D and Q represent the input and the
output . When the IC is utilized as an output part, the output enable line is connected to
the o-v rails so that the output is always enabled when the clock line changes from a logic
0 to a logic1 state, each of the outputs is latched to the same logic state as its
corresponding input. The IC can be connected to the data bus when the microprocessor
wants to transfer information to the output it delivers the information to the data bus and
alters the state of the clock line to command the 74LS374 IC to accept and latch
information.
1 20
CE VCC
2 19
Q0 Q7
3 18
D0 D7
4 D1 D6 17
5 Q1 Q6 16
6 15
Q2 Q5
7 14
D2 D5
8 13
D3 D4
9 Q3 Q4 12
10 11
GND CU
The 74LS374 octal 3 state latch
The address and data buses of microcomputers are capable of driving several
external devices in addition to those already connected inside the microcomputer. Buffers
can be introduced to increase the drive capability of the microcomputer.
The address bus is unidirectional; it passes signals from the microprocessor to the
devices. It can be buffered by using the 74LS244 octal buffer IC. It can be buffer up to
eight address lines supplied to its inputs. The IC is enabled by connecting its 1G and 2G
lines to the o.v rail. Control lines, IOR and IOW van also be buffered in the same way.
The data bus is bidirectional; it needs a different type of buffer. It uses the
74LS245 octal bus transceiver IC .Pin 1 is the direction pin and indicates to the IC
whether the microprocessor wants to receive or transmit data. The IC has an enable pin
(pin 19); if that pin is connected to the o.v rail, the IC is enabled .A device selection
signal van be used to enable the IC only when the microprocessor executes a read or a
write to a particular address. Two 74LS245 ICS are required for a 16 bit bus each
connected to eight of the 16 data lines.
+5V _
_ 0V _
10 20
GND VCC
2 18 LSB
D0 A1 B1
_
3 17
D1 A2 B2
D2 4 A3 B3 16
data buffered data
bus 5 15 lines
D3 A4 B4
lines
D4 6 A5 B5 14
D5 7 13
A6 B6
D6 8 12
A7 B7
D7
9 A8 B8 11 MSB
DIR CS
direction 1 19
command
device-selection
signals
Fig: Using the 74LS245 octal 3-state transceiver
15. Trace the instructions using DEBUG and write down the final contents of AX and
BX registers.(20 marks)
(a)
mov al, FFFE
sub al, 2
mov bl, 8C
mov bh, 2D
add bx, ax
int 20
(b) (The INC instruction adds 1 to a number, and the DEC instruction
subtracts 1.)
mov ax, 0
dec ax
dec ax
add ax, 2
inc ax
int 20
16. Describe the CPU registers and explain the data registers with diagram.(20 marks)
Registers are special work areas inside the CPU designed to be accessed at
high speed. The registers are 16 bits long, but you have the option of
accessing the upper or lower halves of the four data registers:
Data register 16-bit: AX, BX, CX, DX
8-bit: AH, AL, BH, BL, CH, CL, DH, DL
Segment registers CS, DS, SS, ES
Index registers SI, DI, BP
Special registers IP, SP
Flag registers Overflow, Direction, Interrupt, Trap, Sign, Zero,
Auxiliary Carry, Parity, Carry
Data Register. Four registers, named data registers or general-
purpose registers are used for arithmetic and data movement. Each register
may be addressed as either a 16-bit or 8-bit value. For example, the AX
register is a 16-bit register; its upper 8 bits are called AH, and its lower 8 bits
are called AL. Bit positions are always numbered from right to left, starting
with 0.
bits: 15 . . . . . . . . . . . . . . . . . . . . . 0
16 bit AX register
AH register AL register
bits: 7. . . . . . . . . . 07 . . . . . . . . . . 0
Instructions may address either 16-bit or 8-bit data registers from the
following list:
AX BX CX DX
AH AL BH BL CH CL DH DL
18. Explain the conditions of control flags and status flags.(20 marks)
Control Flags. Individual bits may be set in the Flags register by the
programmer to control the CPU's operations. These are the Direction,
Interrupt and Trap flags. Abbreviations used by DEBUG and CODEVIEW
debugger programs are shown in parentheses.
The Direction flag controls the assumed direction used by string
processing instructions. The flag values are 1 = Up (UP) and 0 = Down (DN).
The programmer controls this flag, using the STD and CLD instructions.
The Interrupt flag makes its possible for the external interrupts are caused
by hardware devices such as the keyboard, disk drives, and the system clock
timer. The Interrupt flag is cleared by the programmer when an important
operation is going to on that must not be interrupted. The flag must be then set
to allow the system to process to process interrupts normally again. The flag
values are 1 = Enabled (EI) and 0 = Disabled (DI), and are controlled by the
CLI and STI instructions.
The Trap flag determines whether the CPU should be halted after each
instruction. Debugging programs use this flag to allow the user to execute one
instruction at a time (called tracing). The flag values are 1 = Trap on and 0 =
Trap off, and the flag may be set by the INT 3 instructions.
Status Flag. The status flag bits reflect the outcome of arithmetic and logical
operation performed by the CPU. These are the Overflow, Sign, Zero,
Auxiliary Carry, Parity, and Carry flags.
The Carry flag is set when the result of an arithmetic operation is too large
to fit into the destination. For example, if the values 200 and 56 were added
together and placed in an 8-bit destination, the result (256) would be too large
and the Carry flag would be set. The flag values are 1 = Carry (CY) and 0 =
No carry (NC).
The Overflow flag is set when the signed result of an arithmetic operation
may be too large to fit into the destination area. The flag values are 1 =
overflow (OV) and 0 = no overflow (NV).
The Sign flag is set when the result of an arithmetic or logical operation
generates a negative result. Since a negative number always has a 1 in the
highest bit position, the Sign flag is always a copy of the destination's sign bit.
The flag values are Negative (NG) and Positive (PL).
The Zero flag is set when the result of an arithmetic or logical operation
generates a result of zero. The flag is used primarily by jump and loop
instructions, in order to allow branching to a new location in a program based
on the comparison of two values. The flag values are Zero (ZR) and Not Zero
(NZ).
The Auxiliary Carry flag is set when an operation causes a carry from bit 3
to bit 4 (or a borrow from bit 4 to bit 3) of an operand. It is rarely used by the
programmer. The flag values are Aux Carry (AC) and No Aux Carry (NA).
The Parity flag reflects the number of bits, the Parity is even (displayed as
PE). If there is an odd number of bit, the Parity is odd (displayed as PO). This
flag is used by the operation system to verify memory integrity and by
communications software to verify correct transmission of data.
640 K
User RAM
(memory)
0A
AX: 00 0A (Value 1)
14
(memory)
0A (Value 1)
AX: 00 14
(Value 2)
0A
(memory)
14 (Value 1)
AX: 00 14
(Value 2)
0A
20. (a) If any of the following MOV statements are illegal, explain why:(10-marks)
a. mov ax, bx
b. mov var_2, al
c. mov ax, bl
d. mov bh, 4A6Fh
e. mov dx, 3
f. mov var_1, bx
g. mov al, var_3
h. mov cs, 0
i. mov ip, ax
j. mov word ptr, var_3, 10
k. mov var_1, var_2
l. mov ds, 1000
m. mov ds,es
20. (b). What will be the hexadecimal value of the destination operand after each of the
following moves? (If any instruction is illegal, write the word ILLEGAL as the
answer.) (10-marks)
a. 00A5h
b. 03AFh
c. 8F1Ah
d. illegal
e. 0100h
f. 0020h
g. A000h
h. illegal
i. illegal
21.(a) What will be the hexadecimal value of the destination operand after each of the
following Statements has executed? You may assume that var1 is a word variable
and that count and var2 are byte variables. If any instruction is illegal, write the
word ILLEGAL as the answer. (10-
marks)
a. A523h
b. 09AFh
c. 8F09h
d. FF00h
e. 07E9h
f. FFFFh
g. A025h
h. 41h
i. illegal
j. 00h
21. (b) As each of the following instructions is executed, fill in the hexadecimal value of
the operand listed on the right-hand side:
(10-marks)
a. 0020h
b. 0030h
c. 001Eh
d. 1E2Fh
22. Explain direct addressing mode and indirect addressing mode. (20 marks)
Direct Addressing
The MASM documentation distinguishes between two types of operands
used jin direct addressing: direct-memory operands and relocatable operands. A direct
memory operand combines a sement value with an offset that represents an absolute
memory address at runtime. A relocatable operand is any label or symbol identifying a
16-bit displacement from a segment register. The syntax for creating a direct-memory
operand is :
Segment: offset
Segment refers to either a segment register or a segment name. its value is unknown at
assembly time, because it depends on where DOS will eventually load the program.
Offset may bbe an integer, symbol, lable, or variable. Eg are:
Mov ax, ds:5 ; segment register and offset
Mov bx, cseg:2Ch : segment name and offset
Mov ax,es:count ; segment register and variable
Relocatable operands are more common. Their location depends on the offset os a lable
from the beginning of a segment. The following segment registers are used by default:
Type of Lable Defalut Segment Register
Program code(instructions) CS
Variables(data) DS
The ES register usually addresses variables, but it can contain the base location of any
segment.
Register Indirect: Indirect operands are particularly powerful when processing lists
of arrays, because a base or indeedx register may be modified at runtime. In the following
example, BX points to two different array elements:
Mov bx, offset array ; point to start of array
Mov al,[bx] ;get first element
Inc bx ; point to next
` mov dl,[bx]
…
…/
Array db 10h,20h, 30h
In the following example, the three bytes in array are added together:
Mov si,offset array ;address of first byte
Mov al,[si] ;move the first byte to AL
Inc si ;point to next byte
Add al,[si] ;add second byte
Inc si
Add al,[si] ;add third byte
Inc si
…
…
Array db 10h,20h,30h
Operation Systems
IT (2014)
for
Second Semester
Sample Question
1. What requirements is memory management intended to satisfy? Discuss ANY
THREE. (20 marks)
2. (a)Discuss about logical organization and physical organization. (20 marks)
(b)Define Best-Fit, First-Fit and Next-Fit. (5 marks)
3. (a) Discuss about the buddy system. (10 marks)
(b) In a fixed-partitioning scheme, what are the advantages and disadvantages of
using unequal-size partitioning? (10 marks)
4. Describe memory management techniques and compare strengths and
weaknesses of these techniques. (20 marks)
5. (a) A 1-Mbyte block of memory is allocated using the buddy system.
(i) Show the results of the following sequence.
Request 70; Request 35; Request 80; Return A; Request 60; Return B; Return
D; Return C;
(ii) Show the binary tree representation following Return B. (10 marks)
(b) Describe the two difficulties with the use of equal-size fixed partitions.
(10 marks)
6. (a) Define First-fit, Best-fit, and Next-fit.
A dynamic partitioning scheme is being used, and the following is the memory
configuration at a given point in time.
20M 20M 40M 60M 20M 10M 60M 40M 20M 30M 40M 40 M
The shaded areas are allocated blocks; the white areas are free blocks. The next
three memory requests are for 40M, 20M, and 10M. Indicate the starting address
for each of the three blocks using the following placement algorithms:
First-fit, Best-fit, Next-fit
Assume the most recently added block is at the beginning of memory.
(10 marks)
6. (b) List and briefly define three versions of load sharing in multiprocessor
scheduling. (10 marks)
7. (a) What elements are typically found in a page table entry?
Briefly define each element. (10 marks)
(b) Explain Trashing. (5 marks)
8. (a) Draw the flowchart to show the use of Translation Lookaside Buffer (TLB).
(10 marks)
(b) Describe the advantages of segmentation to the programmer over a non-
segmented address space. (10 marks)
9. (a) Briefly define the alternative page fetch policies. (10 marks)
(b) What is the difference between Demand Cleaning and Precleaning.
(5 marks)
10. Define Optimal, LRU, FIFO, Clock Policy and illustrates the behavior of Four
Page Replacement Algorithms by using these page address stream.
232152453252 (20 marks)
11. (a) Define Associated Mapping and illustrate Direct Versus Associative Lookup
for Page Table Entries. (10 marks)
(b) Illustrate Address Translation in a Segmentation/Paging System. (10 marks)
12. (a) What is the purpose of Translation Lookaside Buffer and explain with
illustration. (10 marks)
(b) Illustrate Translation Lookaside Buffer and Cache Operation.
(10 marks)
13. (a) Briefly define round-robin scheduling.
(10 marks)
(b) What is the difference between turnaround time and response time?
(5 marks)
14. (a) Briefly define shortest-process-next scheduling. (10 marks)
(b) Briefly define feedback scheduling. (10 marks)
15. Compute Finish Time, Turnaround Time (Tr), Tr / Ts and Mean for FCFS, RR (
q=1 and q=4 ), SPN scheduling policies. Then illustrate a comparison of these
scheduling policies.
Process A B C D E
Arrival Time 0 2 4 6 8
Service Time (Tr) 3 6 4 5 2
(20 marks)
16. (a) Compute Finish Time, Turnaround Time (Tr), Tr / Ts and Mean for SRT,
Feedback ( q=1 and q=2i ) scheduling policies. Then illustrate a comparison of these
scheduling policies.
Process A B C D E
Arrival Time 0 2 4 6 8
Service Time (Tr) 3 6 4 5 2
(10 marks)
(b) What are the three types of uniprocessor scheduling. Briefly explain them.
(5 marks)
17. List and explain five general areas of requirements for a real-time operating
system. (20 marks)
18. (a) List and briefly define four techniques for thread scheduling.
(10marks)
(b) Illustrate about Address Translation in a Segmentation/Paging System.
(10 marks)
1
Operating Systems
IT (2014)
for
Second Semester
Relocation:
In a multiprogramming system, the available main memory is generally shared
among a number of processes. Typically, it is not possible for the programmer to know in
advance which other programs will be resident in main memory at the time of execution
of his or her program. In addition, we will like to be able to swap active processes in and
out of main memory to maximize processor utilization by providing a large pool of ready
processes to execute. Once a program has been swapped out to disk, it would be quite
limiting to declare that when it is next swapped back in, it must be placed in the same
main memory region as before. Instead, we may need to relocate the process to a different
area of memory.
Protection:
Each process should be protected against unwanted interference by other
processes whether accidental or intentional. Because the location of a program in main
memory is unpredictable, it is impossible to check absolute addresses at compile time to
assure protection. Furthermore, most programming languages allow the dynamic
calculation of addresses at run time. Hence all memory references generated by a process
must be checked at run time to ensure that they refer only to the memory space allocated
to that process. The memory protection requirement must be satisfied by the process
(hardware) rather than the operating system (software).
Sharing:
Any protection mechanism must have the flexibility to allow several processes to
access the same portion of main memory. For example, if a number of processes are
executing the same program, it is advantageous to allow each process to access the same
copy of the program rather than have its own separate copy.
Logical Organization:
Main memory in a computer system is organized as a linear, or one-dimensional,
address space. Secondary memory is similarly organized. It does not correspond to the
way in which programs are typically constructed. Most programs are organized into
modules. A number of advantages can be realized:
1. Modules can be written and compiled independently, with all references from one
module to another resolved by the system at run time.
2. With modest additional overhead, different degrees of protection (read only,
execute only) can be given to different modules.
3. It is possible to introduce mechanisms by which modules can be shared among
processes.
The tool that most readily satisfies these requirements is segmentation, which is
one of the memory-management techniques.
3
Physical Organization:
Computer memory is organized into at least two levels, main memory and
secondary memory. Main memory provides fast access at relatively high cost. It is
volatile. Secondary memory is slower and cheaper than main memory and is usually not
volatile. Thus secondary memory can be provided for long-term storage of programs and
data, main memory holds programs and data currently in use.
The flow of information between main and secondary memory is a major system
concern. The responsibility for this flow could be assigned to the individual programmer,
but his is impractical and undesirable for two reasons:
1. The main memory available for a program plus its data may be insufficient. In that
case, the programmer must engage in a practice known as overlaying, in which the
program and data are organized in such a way that various modules can be
assigned the same region of memory, with a main program responsible for
switching the modules in an out as needed. Even with the aid of compiler tools,
overlay programming wastes programmer time.
2. In a multiprogramming environment, the programmer does not know tat he time
of coding how much space will be available or where that space will be.
The task of moving information between the two levels of memory should be a
system responsibility.
Physical Organization:
Computer memory is organized into at least two levels, main memory and
secondary memory. Main memory provides fast access at relatively high cost. It is
volatile. Secondary memory is slower and cheaper than main memory and is usually not
volatile. Thus secondary memory can be provided for long-term storage of programs and
data, main memory holds programs and data currently in use.
The flow of information between main and secondary memory is a major system
concern. The responsibility for this flow could be assigned to the individual programmer,
but his is impractical and undesirable for two reasons:
3. The main memory available for a program plus its data may be insufficient. In that
case, the programmer must engage in a practice known as overlaying, in which the
program and data are organized in such a way that various modules can be
assigned the same region of memory, with a main program responsible for
4
switching the modules in an out as needed. Even with the aid of compiler tools,
overlay programming wastes programmer time.
4. In a multiprogramming environment, the programmer does not know tat he time
of coding how much space will be available or where that space will be.
The task of moving information between the two levels of memory should be a
system responsibility.
Inefficient use of
Main memory is divided into a
memory due to internal
number of static partitions at Simple to implement:
Fixed fragmentation;
system generation time. A process little operating system
Partitioning maximum number of
may be loaded into a partition of overhead.
active processes is
equal or greater size.
fixed.
Inefficient use of
Partitions are created dynamically,
No internal fragmentation: processor due to the
Dynamic so that each process is loaded into a
more efficient use of main need for compaction to
Partitioning partition of exactly the same size as
memory. counter external
that process.
fragmentation.
1M
Return C 1M
1M
512 M
256 M
128 M
64 M
5. (b) Describe the two difficulties with the use of equal-size fixed partitions.
(10 marks)
The two difficulties with the use of equal-size fixed partitions are as follows;
(i) A program may be too big to fit into a partition. In this case, the programmer must
design the program with the use of overlays so that only a portion of the program need be
in main memory at any one time. When a module is needed that is not present, the user’s
7
program must load that module into the program’s partition, overlaying whatever
programs or data are there.
(ii) Main memory utilization is extremely inefficient. Any program, no matter how small,
occupies an entire partition. For example, assume that there are fixed partitions with the
size of whose length is less than 2 Mbytes; yet it occupies an 8-Mbytes partition
whenever it is swapped in. This phenomenon, in which there is wasted space internal to a
partition due to that fact that the block of data loaded is smaller than the partition, is
referred to as internal fragmentation.
The shaded areas are allocated blocks; the white areas are free blocks. The next
three memory requests are for 40M, 20M, and 10M. Indicate the starting address
for each of the three blocks using the following placement algorithms:
First-fit, Best-fit, Next-fit
Assume the most recently added block is at the beginning of memory.
(10 marks)
First-Fit : First-fit begins to scan memory from the beginning and chooses the first
available block that is large enough.
Requests; 40 M, 20 M, 10 M
20M 20M 40M 60M 20M 10M 60M 40M 20M 30M 40M 40 M
Best-Fit : Best-fit chooses the block that closet in size to the request.
Requests; 40 M, 20 M, 10 M
20M 20M 40M 60M 20M 10M 60M 40M 20M 30M 40M 40 M
Next-Fit : Next-fit begins to scan memory from the location of the last placement, and
chooses the next available block that is large enough.
Requests; 40 M, 20 M, 10 M
20M 20M 40M 60M 20M 10M 60M 40M 20M 30M 40M 40 M
8
6. (b) List and briefly define three versions of load sharing in multiprocessor
scheduling. (10 marks)
Three different versions of load sharing are First come first served (FCFS),
Smallest number of threads first, Preemptive smallest number of threads first.
First come First served (FCFS): When a job arrives, each of its threads is placed
consecutively at the end of the shared queue. When a processor becomes idle, it picks the
next ready thread, which it executes until completion or blocking.
Smallest number of threads first: The shared ready queue is organized as a priority
queue, with highest priority given to threads from jobs with the smallest number of
unscheduled threads. Jobs of equal priority are ordered according to which job arrives
first. As with FCFS, a scheduled thread is run to completion or blocking.
Preemptive smallest number of threads first: Highest priority is given to jobs with the
smallest number of unscheduled threads. An arriving job with a smaller number of
threads than an executing job will preempt threads belonging to the scheduled job.
Virtual address
n bits
Page# Offset Control bits
Process
Page# ID Chain
n bits 0
Hash m bits i
Function
Thrashing:
When the operating system brings one piece in, it must throw another out. If it
throws out a piece just before it is used, then it will just have to go get that piece again
almost immediately. Too much of this leads to a condition known as thrashing.
8. (a) Draw the flowchart to show the use of Translation Lookaside Buffer (TLB).
(10 marks)
Return to faulted
instruction
Start
No
Access page table
Page transferred
from disk to
CPU generates
main memory
physical address
Yes
Memory full?
No Perform page
replacement
Page tables
updated
unless dynamic segment sizes are allowed. With segmented virtual memory, the data
structure can be assigned its own segment, and the operating system will expand or shrink
the segment as needed. If a segment that needs to be expanded is in main memory and
there is insufficient room, the operating system may move the segment to a larger area of
main memory, if available, or swap it out. In the latter case, the enlarged segment would
be swapped back in at the next opportunity.
2. It allows programs to be altered and recompiled independently, without requiring the
entire set of programs to be relinked and reloaded. Again, this is accomplished using
multiple segments.
3. It lends itself to sharing among processes. A programmer can place a utility program or
a useful table of data in a segment that can be referenced by other processes.
4. It lends itself to protection. Because a segment can be constructed to contain a well-
defined set of programs or data, the programmer or system administrator can assign
access privileges in a convenient fashion.
10. Define Optimal, LRU, FIFO, Clock Policy and illustrates the behavior of Four
Page Replacement Algorithms by using these page address stream.
232152453252 (20 marks)
11
11. (a) Define Associated Mapping and illustrate Direct Versus Associative Lookup
for Page Table Entries. (10 marks)
Because the TLB only contains some of the entries in a full page table, we cannot
simply index into the TLB based on page number. Instead, each entry in the TLB must
include the page number as well as the complete page table entry. The processor is
equipped with hardware that allows it to interrogate simultaneously a number of TLB
entries to determine if there is a match on page number. This technique is referred to as
associative mapping.
FIGURE 8.9 Direct Versus Associative Lookup for Page Table Entries
(page 344)
12
12. (a) What is the purpose of Translation Lookaside Buffer and explain with
illustration. (10 marks)
In principle, every virtual memory reference can cause two physical memory
accesses: one to fetch the appropriate page table entry and one to fetch the desired data.
Thus, a straightforward virtual memory scheme would have the effect of doubling the
memory access time. To overcome this problem, most virtual memory schemes make use
of a special high-speed cache for page table entries, usually called a translation lookaside
buffer (TLB).
quantum should be slightly greater than the time required for a typical interaction or
process function.
Round robin is particularly effective in a general-purpose time-sharing system or
transaction processing system. One drawback to round robin is its relative treatment of
processor-bound and I/O-bound processes.
13. (b) What is the difference between turnaround time and response time?
(5 marks)
Turnaround time: This is the interval of time between the submission of a process and
its completion. Include actual execution time plus time spent waiting for resources,
including the processor. This is an appropriate measure for a batch job.
Response time: For an interactive process, this is the time from the submission of a
request until the response begins to be received. Often a process can begin producing
some output to the user while continuing to process the request. Thus, this is a better
measure than turnaround time from the user’s point of view. The scheduling discipline
should attempt to achieve low response time and to maximize the number of interactive
users receiving acceptable response time.
Figure illustrates the feedback scheduling mechanism by showing the path that a
process will follow through the various queues. This approach is know as multilevel
feedback, meaning that the operating system allocates the processor to a process and,
when the process blocks or is preempted, feeds it back into one of several priority queues.
15. Compute Finish Time, Turnaround Time (Tr), Tr / Ts and Mean for FCFS, RR (
q=1 and q=4 ), SPN scheduling policies. Then illustrate a comparison of these
scheduling policies.
Process A B C D E
Arrival Time 0 2 4 6 8
Service Time (Tr) 3 6 4 5 2
(20 marks)
Process A B C D E
Arrival Time 0 2 4 6 8
Finish Time 3 9 13 18 20
Finish Time 4 18 17 20 15
Finish Time 3 17 11 20 19
.
RR (q=4) Turnaround Time(Tr) 3 15 7 14 11 10.00
Finish Time 3 9 15 20 11
0 5 10 15 20
A
B
First-come-First- C
Served (FCFS) D
E
A
Round-Robin B
C
(RR), q = 1 D
E
A
Round-Robin B
C
(RR), q = 4 D
E
A
Shortest Process B
Next (SPN) C
D
E
16. (a) Compute Finish Time, Turnaround Time (Tr), Tr / Ts and Mean for SRT,
Feedback ( q=1 and q=2i ) scheduling policies. Then illustrate a comparison of these
scheduling policies.
Process A B C D E
Arrival Time 0 2 4 6 8
Service Time (Tr) 3 6 4 5 2
(10 marks)
Table. A Comparison of Scheduling Policies
Process A B C D E
Arrival Time 0 2 4 6 8
Finish Time 3 15 8 20 10
0 5 10 15 20
A
B
Shortest Remaining C
Time (SRT) D
E
A
Feedback B
q=1 C
D
E
A
Feedback B
C
q = 2i D
E
16. (b) What are the three types of uniprocessor scheduling. Briefly explain them.
(5 marks)
The three types of uniprocessor scheduling are;
Long-term scheduling
Medium-term scheduling
Short-term scheduling
Long-term scheduling is performed when a new process is created. This is a
decision whether to add a new process to the set of processes that are currently active.
Medium-term scheduling is a part of the swapping function. This is a decision
whether to add a process to those that are at least partially in main memory and therefore
available for execution.
Short-term scheduling is the actual decision of which ready process to execute
next.
17. List and explain five general areas of requirements for a real-time operating
system. (20 marks)
external events and timings. The extent to which an operating system can
deterministically satisfy requests depends first on the speed with which it can respond to
interrupts and, second, on whether the system has sufficient capacity to handle all
requests within the required time.
One useful measure of the ability of an operating system to function
deterministically is the maximum delay from the arrival of a high-priority device interrupt
to when servicing begins.
Responsiveness is concerned with how long, after acknowledgment, it takes an
operating system to service the interrupt. Aspects of responsiveness include the
following.
1. The amount of time required to initially handle the interrupt and begin execution of the
interrupt service routine (ISR).
2. The amount of time required to perform the ISR. This generally is dependent on the
hardware platform.
3. The effect of interrupt nesting. If an ISR can be interrupted by the arrival of another
interrupt, then the service will be delayed.
User control is generally much broader in a real-time operating system than in
ordinary operating systems. In a real-time system, it is essential to allow the user fine-
grained control over task priority. The user should be able to distinguish between hard
and soft tasks and to specify relative priorities within each class. A real-time system may
also allow the user to specify such characteristics as the use of paging or process
swapping, what processes must always be resident in main memory, what disk transfer
algorithms are to be used, what rights the processes in various priority bands have, and so
on.
Reliability is typically far more important for real-time systems than non-real-time
systems. A real-time system is responding to and controlling events in real time. Loss or
degradation of performance may have catastrophic consequences, ranging from financial
loss to major equipment damage and even loss of life.
Fail-soft operation is a characteristic that refers to the ability of a system to fail in
such a way as to preserver as much capability and data as possible. A real-time system
will attempt either to correct the problem or minimize its effects while continuing to run.
Typically, the system notifies a user or user process that it should attempt corrective
action and then continues operation perhaps at a reduced level of service. In the event a
shutdown is necessary, an attempt is made to maintain file and data consistency.
18. (a) List and briefly define four techniques for thread scheduling.
(10marks)
For multiprocessor thread scheduling and processor assignment, four general
approaches stand out:
Load sharing
Gang scheduling
Dedicated processor assignment
Dynamic scheduling
1. Load sharing:
Processes are not assigned to a particular processor. A global queue of ready
threads is maintained, and each processor, when idle, selects a thread from the queue. The
term load sharing is used to distinguish this strategy from load balancing schemes in
which work is allocated on a more permanent basis.
18
2. Gang scheduling:
A set of related threads is scheduled to run on a set of processors at the same time,
on a one-to-one basis.
3. Dedicated processor assignment:
This is the opposite of the load-sharing approach and provides implicit scheduling
defined by the assignment of threads to processors. Each program is allocated a number
of processors equal to the number of threads in the program, for the duration of the
program execution. When the program terminates, the processors return to the general
pool for possible allocation to another program.
4. Dynamic scheduling:
The number of threads in a process can be altered during the course of execution.
IT 2015
For
Second Semester
Sample Question
1. A stack is a data storage device that are the last item stored is the first retrieved. Write
a program to test input and output of the stack. (20 marks)
2. Create string class that include a string str (an array of char) to concat of two string and
test it. (20 marks)
3. Write a function called reversit ( ) that reverses a string (an array of char). Use a for
loop that swaps a string firs and last characters, and so on. The string should be passed to
reversit ( ) as an argument. Write a program to exercise reversit ( ). The program should
get a string from the user call reversit ( ), and print out the result. Use an input method
that allows embedded blanks. (20 marks)
4. Create a class called employee that contains a name (an array of char) and employee
member (long). Include a member function called getdata( ) to get data from the user and
another function called putdata ( ) to display the data. Write a main ( ) program to
exercise this class. It should create an array of type employee and then input 100
employee. Finally it should print out the data for all the employees.
(20 marks)
5. A queue is a data storage divide like a stack. The difference is that in a stack the last
data item stored is the first one retrieved, while in a queue the First data item stored is the
first retrieved. Use two pointers, FRONT for retrieve and RARE for entry. The member
function push ( ) should include overflow checking and pop ( ) should include underflow
checking. Write a main ( ) program to implement a queue and test it.(10 marks)
6. To the Distance class, add on overloaded operator that subtracts two distance like dist
3 = dist 1 – dist 2. Assume that operator will never be used to subtract a longer number
from a smaller one. (20 marks)
7. To the Distance class, add an overloaded operator that add two distance like dist 1 +=
dist 2. (20 marks)
8. To the Distance class, add an overloaded operator that dis1 < dist2.
(20 marks)
9. Write a program the conversion of distance to meter, meter to Distance. (20 marks)
10. Create the time class with integer members (hours, minutes, seconds) and include
overloaded increment (++) and decrement (--) operators that operate in both prefix and
postfix notation and return value. Write a main program to test the above time calss.
(20 marks)
11. Create a class Int that contain an integer variable. Overload all five integer arithmetic
operators (+, -, *, /, %). So that they operate an object of type Int. If the result of any such
operation exceeds the normal range of int from -32768 to 32767, the operator prints a
warning and terminate the program. Write a program to test this class.
(20 marks)
12. Create the polar class to incorporate overloaded operators for multiplication and
division that require a constant (type double) as the second operand, not a polar. Write a
program to exercise all these operations with a variety of values.
( 20 marks)
13. Write a program to implement their hierarchy diagram. ( 20 marks)
Class Employee
name;
number;
Class Scientist
Class manager Class laborer
title; publications
dues;
15. Create a student class that includes the member data number (int) and marks of four
papers (ints). The member function are get-student ( ) to get student data and display ( )
to display the object details. The grade class also include the member data roll number
(int) and grade value (char) and the member function where a conversion function from
student class to grade class and a display function. The conversion condition are as
follow:
(i) Average of paper marks >= 75, grade = ‘A’
(ii) Average of paper marks < 75 and >= 65, grade ‘B’
(iii) Average of paper marks < 65 and > = 40, grade ‘C’
Write a program to create two different objects and test the conversion.
(20 marks)
16. Create the Type class which store dimension (string) grade (string) and Distance class
which store ft (int), in (float). From the type and Distance class derived class called
lumber that contain qty (int) price4 float. Implement main program and test it.
(20 marks)
17. Create a class publication that stores the title ( a string ) and price (type float). From
this class derive two classes: book which adds a page count (type int) and tape, which
adds a playing time in minutes (type float). Each of these three classes should have a
getdata ( ) function to get is data from the user and a putdata ( ) function to display its
data. Write a main ( ) program to implement this class. (20 marks)
18. A company rents both cars and trucks. A class transport stores the capacity (int), the
status (rented as available) and the cost of rental ( a float). From this class (derived car
class that include number of passengers and) three count ( an int); and truck which adds a
load limit measured in matric tones (an int). Each of these three classes should have a
getdata ( ) function to obtain data from user and a showdata ( ) function to display data on
the screen. Implement these three classes and write a main ( ) program to test a car and
truck classes. (20 marks)
19. Create a class publication that stores the title (string) and price (float) and sale class
that holds an array of three float. The book and tape that they are derived from
publication and sale. Add a disk class that like book and tape, is derived from publication.
The disk class should incorporate the same member functions as the other classes. The
data item unique to this class is the disk size: either 3-1/2 inches or 5-1/4 inches. You can
use an enum Boolean type to store this item, but the complete size should be displayed.
The user could select the appropriate size by typing 3 or 5. (20 marks)
20. Start with the publication, book and tape classes. Suppose you want to add the date of
publication for both books and tapes. From the publication class, derived a new class so
called publication 2 that includes this member data. Then change book and tape so they
are derived from publication 2 instead of publication. Make all the necessary changes in
member functions to the user can input and output data along with the other data. For the
data class, use three ints of months, day and year. The member functions are getdata ( )
and showdata ( ). (20 marks)
21.Create a linklist program using pointer. Add a destructor to the linklist program. It
should delete all the links when a linklist object is destroyed. It can to this by following
along the chain, deleting each link as it goes. You can test the destructor by having it
display a message each time it deletes a link; it should delete the same number of links
that were added to the list. (20 marks)
22. Revise the additem ( ) member functions from the linklist program so that it adds the
item at the end of the list, rather than the beginning. This will cause the first item inserted
to be the first item displayed. To add the item you will need to follow the chain of
pointers to the end of the list, then change the last link to point to the new link.
(20 marks)
23. Create an employee class that certain name, number and student class that holds
school, degree, the manager class that are derived from employee and student’s class.
That certain title (string), class (double). From the manager class derive a class called
executive. The additional data in executive class will be the size of the employee’s yearly
bonus and the number of shares of company stock held in his or her stock option plan.
Add the appropriate member functions so these data items can be input and display along
with the other manager data. (20 marks)
24. Define the following. (20 Marks)
25. Explain system design with diagram. (10 marks)
26. Explain about the following types of software process model.(10 Marks)
Software Engineering
IT 2015
For
Second Semester
2. Create string class that include a string str (an array of char) to concat of two string and
test it. (20 marks)
# include < iostream .h>
# include < string . h >
Class string
{
Private:
char st[50];
Public:
String(){st[0]='\0';}
String(char s[]) {strcpy(st,s);}
Void show()
{cout<<"string="<<st;}
Void concat(string s1)
{ if ((strlen(st)+strlen(s1.st))<50)
Strcat(st,s1.st);
Else
Cout<<"string is too long";
}
};
Void main()
{ string s1("Merry Christismas");
String s2(" How are you?");
s1.concat(s2);
s1.show();
}
3. Write a function called reversit ( ) that reverses a string (an array of char). Use a for
loop that swaps a string firs and last characters, and so on. The string should be passed to
reversit ( ) as an argument. Write a program to exercise reversit ( ). The program should
get a string from the user call reversit ( ), and print out the result. Use an input method
that allows embedded blanks. (20 marks)
4. Create a class called employee that contains a name (an array of char) and employee
member (long). Include a member function called getdata( ) to get data from the user and
another function called putdata ( ) to display the data. Write a main ( ) program to
exercise this class. It should create an array of type employee and then input 100
employee. Finally it should print out the data for all the employees.
(20 marks)
# include <iostream.h>
# include <conio .h>
class employee
{
private :
char name [20];
long eno;
public:
void getdata( )
{
cout<< “ \n Enter employee name.”;
cin.getline (name ,20);
cout<< “ \n Enter employee number;”
cin>>eno;
}
void putdata( )
{
cout<< “ \n Employee name:”<<name;
cout<< “ \n Employee number;”<<eno;
}
}
void main( )
{
employee e[100];
int I;
for (i=0;i<100;i+ +)
{
cout<< “ \n Enter employee name and number”;
e[i].getdata( );
}
for(i=0;i<100;i + +);
{
cout<< “\n Employee name and number: \n”;
e[i].putdata( );
}
getch( );
}
5. A queue is a data storage divide like a stack. The difference is that in a stack the last
data item stored is the first one retrieved, while in a queue the First data item stored is the
first retrieved. Use two pointers, FRONT for retrieve and RARE for entry. The member
function push ( ) should include overflow checking and pop ( ) should include underflow
checking. Write a main ( ) program to implement a queue and test it.(10 marks)
# include<iostream.h>
# include<conio.h>
cnst int max = 20;
class queue
{
private;
int q[max], FRON,RARE;
public;
queue( )
{ FRONT =RARE =-1;}
void push(int d)
{
if(RARE<max-1)
q[+ +RARE] =d;
else cout<< “Overflow”;
}
void pop( )
{
if(FRONT<RARE)
cout<< “\n”<<q[+ +FRONT];
else cout<< “Underflow”;
}
};
void main( )
{
queue q;
clrscr( );
q.push(11);
q.push(33);
q.pop( );
q.pop( );
q.pop( );
getch( );
6. To the Distance class, add on overloaded operator that subtracts two distance like dist
3 = dist 1 – dist 2. Assume that operator will never be used to subtract a longer number
from a smaller one. (20 marks)
# include<iostream.h>
# include<conio.h>
class Distance
{
private;
int feet;
float inches;
public:
Distance( )
{ feet =0; inches = 0.0;}
Distance(int ft ,float in)
{feet = ft;inches = in;}
void getdist( )
{
cout<< “\nEnter feet and inches”;
cin>>feet>>inches;
}
void showdist( )
{
cout<<feet<< “\ “-”<<inches<< “\””;
}
Distance operator-(Distance d1)
{
int f = feet-d1.feet;
float I =inches-d1.inches;
if(i<0)
return Distance(f,i);
}
};
void main( )
{
Distance dist1(11,6.25);
Distance dist2.dist3;
dist2.getdist( );
dist3 =dist1 –dist2;
cout<< “\ndist1 =”;dist1.showdist( );
cout<< “\ndist2 =”;dist2.showdist( );
cout<< “\ndist3 =”;dist3.showdist( );
getch ( );
}
7. To the Distance class, add an overloaded operator that add two distance like dist 1 +=
dist 2. (20 marks)
#include<iostream.h>
#include<conio.h>
class Distance
{
private;
int feet;
float inches;
public;
Distance( )
{ feet = 0;inches = 0.0;}
Distance(int ft,float in)
{ feet = ft;inches =in;}
void getdist( )
{
cout<< “\nEnter feet and inches”;
cin>>feet>>inches;
}
void showdist( )
{
cout<<feet<< “\ “-”<<inches<< “\””;
}
void operator += (Distance d1)
{
feet +=d1.feet;
inches += d1.inches;
if ( inches>= 12.0)
{
inches - = 12.0;
feet ++;
}
};
void main( )
{
Distance dist1( 11,6.25);
Distance dist2;
cout<< “\n dist1=”;
dist1.showdist( );
dist2.getdist( );
dist1+ = dist2;
cout <<”\n dist1=”;
dist1.showdist( );
cout <<”\n dist2=”;
dist2.showdist( );
getch( );
}
8. To the Distance class, add an overloaded operator that dis1 < dist2.
(20 marks)
#include<iostream.h>
#include<conio.h>
enum Boolean {false , true};
class Distance
{
private:
int feet;
float inches;
public;
Distance( )
{ feet = 0;inches = 0.0;}
Distance(int ft,float in)
{ feet = ft;inches = in;}
{
cout<< “\nEnter feet and inches”;
cin>>feet>>inches;
}
void showdist( )
{
cout<<feet<< “\ “-”<<inches<< “\””;
}
Boolean operator<(Distance d1)
{
float f1 = feet + inches/12;
float 12 = d2.feet + inches/12;
return (f1<f2)? true:false;
}
};
void main( )
{
Distance dist;
dist1. getdist( )
Distance dist2(6,2.5);
cout<< “\ndist1 =”;dist1.showdist( );
cout<< “\ndist2 =”;dist2.showdist( );
if(dist1<dist2)
cout<< “Dist1 is less than Dist2”;
else cout<< “Dist2 is greater than Dist1”;
getch ( );
}
#include<iostream.h>
const float MTF = 3.280833;
class Distance
{ private : int ft;
float in;
public : Didtance ( )
{ft.in = 0;}
Distance ( int f, float i)
{ ft = f;
in = I;}
void show ( )
{ cout<<ft<< “\’”<<in<< “\” ”; }
Distance ( float m)
{ float f = m * MTF;
ft = f;
in = ( f- ft)*12; }
Operator Float ( )
{ Float f = ft + in/12;
Float m = f / MTF ;
return m;}
};
void main ( )
{ Distance d ( 5,5.5);
float m;
cout<< “ meter =”<<m;
cout<< “ Enter meter”;
cin>> m;
d = m;
d.show ( );
}
10. Create the time class with integer members (hours, minutes, seconds) and include
overloaded increment (++) and decrement (--) operators that operate in both prefix and
postfix notation and return value. Write a main program to test the above time calss.
(20 marks)
#include<iostream.h>
#include<conio.h>
class time
{
private:
int hr.min.sec;
public:
time( )
{ hr = 0;min =0;sec = 0;}
time(int h,int m, int s)
{ hr =h;min = m;sec =s;}
void gettime ( )
{
cout<< “\nEnter hour,minute and second”;
cin>>hr>>min>>sec;
}
void puttime ( );
time operator + +( )
{
+ + sec;
return time (hr,min,sec);
}
time operator+ +( )
{
- - sec;
return time(hr,min,sec);
{
sec - -
return time(hr,min,sec);
}
};
void time::puttime ( )
{
if(see<= -1)
{sec+ = 60;
min--;
if(min< = -1) {
min+=60;
hr--;
}
}
if(sec>=60)
{sec-=60;
min+ +;
if(min>=60)
{min-=60;
hr++;}
}
void main( )
{
time t1(5,59,59);
time t2(10,10,10);
time t3,t4;
13=t1++ ;
14 = ++t1;
cout<< “time 3 =”:t3.puttime( );
cout<< “time 4 =”:t4.puttime( );
13=t1 --;
14 =--t1;
cout<< “time 3 =”:t3.puttime( );
cout<< “time 4 =”:t4.puttime( );
getch( );
}
11. Create a class Int that contain an integer variable. Overload all five integer arithmetic
operators (+, -, *, /, %). So that they operate an object of type Int. If the result of any such
operation exceeds the normal range of int from -32768 to 32767, the operator prints a
warning and terminate the program. Write a program to test this class.
(20 marks)
# include <iostream.h>
# include <conio.h>
# include <stdio.h>
class int
{
private :
int a;
public :
int ( )
{a = 0; }
int (int x)
{ a = x; }
void getdata ( )
{ cout << “\n Enter an integer number”;
cin >> a;
}
void putdata ( )
{
cout << “The Result =” << a;
}
int check (long y)
{ if ( y >= -32768 && y < 32768 )
return 1;
else return 0;
}
int operator + (int i)
{
long y = long (a) + long (i.a);
if check(y) return int(y);
else {
cout << “Over Range”;
exit (0);
}
}
int operator – (int i)
{
long y = long (a) – long (i.a);
if check(y) return int(y);
else {
cout << “Over Range”;
exit (0);
}
}
int operator * (int i)
{
long y = long (a) *long (i.a);
if check(y) return int(y);
else {
cout << “Over Range”;
exit (0);
}
}
# include <iostream.h>
class polar
{ private : double radius, angle;
public : polar ( )
{ radius = angle = 0.0; }
Polar (double r, double a)
{ radius = r;
angle = a;
}
void get ( )
{ cout << “Enter radius & angle”;
cin >> radius >> angle;
}
void show ( )
{ cout << radius << “\t” << angle; }
Polar operator * (double x)
{ return polar (radius * x, angle); }
Polar operator / (double x)
{ return polar (radius/x, angle); }
};
void main ( )
{ Polar P;
P.get ( );
double x;
cout << “Enter Multiplication number”;
cin >> x;
P=P*x;
cout << “Multiplication =” ;
P.show ( );
cout << “Enter division number”;
cin >> x;
P = P/x ;
cout << “Division”;
P.show ( );
}
Class Scientist
Class manager Class laborer
title; publications
dues;
# include <iostream.h>
# include <string.h>
# define max 20
class employee
{ protected : char name [max];
long num;
public : employee ( )
{ name [0] = ‘\0’;
num = 0.0;
}
employee (char s[ ], long n)
{ stcpy (name, s);
num = n;
}
void get ( )
{ cout << “enter name”;
cin.get (name, max)
cout << “Enter number”;
cin >> num;
}
void show ( )
{ cout << “\n Name =” << name;
cout << “\n Number =” << num;
}
};
# include <iostream.h>
# include <string.h>
# define max 20
class employee
{ protected : char name [max];
long num;
public : employee ( )
{ name [0] = ‘\0’;
num = 0.0;
}
employee ( char n [ ], long n )
{ strcpy (name, n);
num = n;
}
void get ( )
{ cout << “Enter name” ;
cin.get (name, max);
cout << “Enter number”;
cin >> num;
}
void show ( )
{ cout << “\n Name =” << name;
cout << “\n Number =” << num;
}
};
class student
{ protected : char sch [max];
char deg [max];
public : student ( )
{ sch [0] = ‘\0’;
deg [0] = ‘\0’;
}
student ( char s[ ], char d[ ] );
{ strcpy (sch, s);
strcpy (deg, d);
}
void get ( )
{ cout << “enter school”;
cin.get (sch, max);
cout << “Enter degree”;
cin.get (deg, max);
}
void show ( )
{ cout << “\n School =” << sch;
cout << “\n Degree =” << deg;
}
};
class laborer : public employee
{ };
class scientist : public employee, public student
{ private : int pubs;
public : scientist ( ) : employee ( ) , student ( )
{ pubs = 0; }
scientist ( char n[ ], long n, char s[ ], char d[ ],
int p ) : employee (n, n), student (s, d)
{ pubs = p; }
void get ( )
{ employee : : get ( );
student : : get ( );
cout << “Enter publications”;
cin >> pubs;
}
void show ( )
{ employee : : show ( );
student : : show ( );
cout << “Publications =” << pubs;
}
};
class managewr : public employee, public student
{ private : char tit [max];
double dues;
public : manager ( ) : employee ( ), student ( )
{ tit [0] = ‘\0’;
dues = 0.0;
}
manager ( char n[ ], long n, char s[ ], char d[ ],
char t[ ], double d): employee (n,n),
student (s, d)
{ strcpy (tit, t);
dues = d;
}
void get ( )
{ employee : : get ( );
student : : get ( );
cout << “Enter title”;
cin.get
cout << “Enter dues;
cin >> dues;
}
void show ( )
{ employee : : show ( );
student : : show ( );
cout << “\n Title =” << tit;
cout << “\n Dues =” << dues;
}
};
void main ( )
{ laborer l;
scientist s;
manager M;
l.get ( );
l.show ( );
s.get ( );
S.show ( );
M.get ( );
M.show ( );
}
15. Create a student class that includes the member data number (int) and marks of four
papers (ints). The member function are get-student ( ) to get student data and display ( )
to display the object details. The grade class also include the member data roll number
(int) and grade value (char) and the member function where a conversion function from
student class to grade class and a display function. The conversion condition are as
follow:
(i) Average of paper marks >= 75, grade = ‘A’
(ii) Average of paper marks < 75 and >= 65, grade ‘B’
(iii) Average of paper marks < 65 and >= 40, grade ‘C’
Write a program to create two different objects and test the conversion.
(20 marks)
# include <iostream.h>
class student
{ private : int rno, m1 , m2 , m3 , m4 ;
public : void get ( )
{ cout << “Enter rno and marks”;
cin >> rno >> m1 >> m2 >> m3 >> m4 ;
}
void show ( )
{ cout << rno << “\t” << m1 << “\t” << m2 <<“\t”
<< m3 << “\t” << m4 ;
}
int getrno ( )
{ return rno; }
int get m1 ( )
{ return m1 ; }
int get m2 ( )
{ return m2 ; }
int get m3 ( )
{ return m3 ; }
int get m4 ( )
{ return m4 ; }
};
class grade
{ private : int r;
char gvalue;
public : void get ( )
{ cout << “Enter rno & gvalue”;
cin >> r >> gvalue;
}
void show ( )
{ cout << r << “\t” << gvalue; }
grade ( student st )
{ int P1 , P2 , P3 , P4 ;
r = st. getrno ( );
P1 = st.getm1 ( );
P2 = st.getm2 ( );
P3 = st.getm3 ( );
P4 = st.getm4 ( );
float avg = ( P1 + P2 + P3 + P4 ) /4 ;
if ( avg >= 75 ) gvalue = ‘A’;
else if ( avg >= 65 ) gvalue = ‘B’;
else if ( avg >= 40 ) gvalue = ‘C’;
}
};
void main ( )
{ student s;
grade g;
s.get ( );
g = s;
g.show ( );
}
16. Create the Type class which store dimension (string) grade (string) and Distance class
which store ft (int), in (float). From the type and Distance class derived class called
lumber that contain qty (int) price4 float. Implement main program and test it.
(20 marks)
# include <iostream.h>
# include < string.h>
const int max = 40;
class Type
{ private : char dimensions [max];
char grade [max];
public : Type ( )
{ strcpy ( dimensions, “N/A” );
strcpy ( grade, “N/A” );
}
Type ( char di[ ] , char gr[ ] )
{ strcpy ( dimension, di);
strcpy (grade, gr);
}
void get type ( )
{ cout << “\n Enter dimensions (2 * 4 etc):”;
cin >> dimensions;
cout << “\n Enter grade (rough-cut, construction-
grade, surface-four-sides,)” ;
cin >> grade;
}
void show type ( )
{ cout << “\n Dimensions =” << dimensions;
cout << “\n Grade=” << grade;
}
};
class Distance
{ private : int feet;
float inches;
public : Distance ( )
{ feet = 0; inches = 0.0; }
Distance ( int ft, float in )
{ feet = ft; inches = in; }
void getdist ( )
{ cout << “\n Enter feet:”; cin >> feet;
cout << “\n Enter inches:”; cin >> inches;
}
void showdist ( )
{ cout << feet << “\’-” << inches << ‘\”’; }
};
class lumber : public Type, public Distance
{ private : int quantity;
float price;
public : lumber ( ), Type ( ), Distance ( )
{ quantity = 0; price = 0.0; }
lumber ( chart di[ ], char gr[ ], int ft, float in,
int qu, float prc);
Type (di, gr), Distance (ft, in)
{ quantity = qu ; price = prc; }
void getlumber ( )
{ Type : : gettype ( );
Distance : : getdist ( );
cout << “\n Enter quantity:”; cin >> quantity;
cout << “\n Enter price:”; cin >> price;
}
void showlumber ( )
{ Type : : showtype ( );
Distance : : showdist ( ) ;
cout << “\n Price for:” << quantity << “is $”
<< quantity * price;
}
};
void main ( )
{ lumber siding;
cout << “\n Siding Data : \n”;
Siding.getlumber ( );
lumber studs ( “2*4”, “constru”, 8, 0.0, 200, 4.45 );
cout << “\n siding”; siding.showlumber ( );
cout << “\n studs”; studs.showlumber ( );
}
17. Create a class publication that stores the title ( a string ) and price (type float). From
this class derive two classes: book which adds a page count (type int) and tape, which
adds a playing time in minutes (type float). Each of these three classes should have a
getdata ( ) function to get is data from the user and a putdata ( ) function to display its
data. Write a main ( ) program to implement this class. (20 marks)
# include <iostream.h>
# include <string.h>
# define max 20
class publication
{ protected : char title [max];
float pri;
public : void get ( )
{ cout << “Enter title”;
cin.get (title, max );
cout << “Enter price”;
cin >> pri;
}
void show ( )
{ cout << “\n Title =” << title;
cout <, “\n Price =” << pri;
}
};
class book : public publication
{ private : int pcount;
public : void get ( );
{ publication : : get ( );
cout << “Enter page count”;
cin >> pcount;
}
void show ( )
{ publication : : show ( );
cout << “\n Page Count =” << pcount;
}
};
class type : public publication
{ private : float min;
public : void get ( )
{ publication : : get ( )
cout << “Enter minute” ;
cin >> min;
}
void show ( )
{ publication : : show ( );
cout << “\n Minute =” << min;
}
};
void main ( )
{ book b;
tape t;
b.get ( );
b.show ( );
t.get ( );
t.show ( );
}
18. A company rents both cars and trucks. A class transport stores the capacity (int), the
status (rented as available) and the cost of rental ( a float). From this class (derived car
class that include number of passengers and) three count ( an int); and truck which adds a
load limit measured in matric tones (an int). Each of these three classes should have a
getdata ( ) function to obtain data from user and a showdata ( ) function to display data on
the screen. Implement these three classes and write a main ( ) program to test a car and
truck classes. (20 marks)
# include <iostream.h>
# define max 5
class transport
{ protected : int cop;
char status [max];
float cost;
public : void get ( )
{ cout << “Enter capacity”;
cin >> cap;
cout << “Enter status”;
cin.get (status, max);
cout << “Enter cost”;
cin >> cost;
}
void show ( )
{ cout << “\n Capacity =” << cap;
cout << “\n Status =” << status;
cout << “\n Cost =” << cost;
}
};
class car : public transport
{ private : int no: per; int count;
public : void get ( )
{ transport : : get ( )
cout << “Enter no: of person”;
cin >> no: per;
cout << “Enter count”;
cin >> count;
}
void show ( )
{ transport : : show ( );
cout << “\n No: of person =” << no: per;
cout << “\n count =” << count;
}
};
class truck : public transport
{ private : int ton;
public : void get ( )
{ transport : : get ( );
cout << “Enter ton”;
cin >> ton;
}
void show ( )
{ transport : : show ( );
cout << “Enter ton”
cin >> ton;
}
void show ( )
{ transport : : show ( );
cout << “\n Ton =” << ton;
}
};
void main ( )
{ car c;
truck t;
c.get ( );
c.show ( );
t.get ( );
t.show ( );
}
19. Create a class publication that stores the title (string) and price (float) and sale class
that holds an array of three float. The book and tape that they are derived from
publication and sale. Add a disk class that like book and tape, is derived from publication.
The disk class should incorporate the same member functions as the other classes. The
data item unique to this class is the disk size: either 3-1/2 inches or 5-1/4 inches. You can
use an enum Boolean type to store this item, but the complete size should be displayed.
The user could select the appropriate size by typing 3 or 5. (20 marks)
# include <iostream.h>
# define max 20
class publication
{ protected : char title [max];
float pri;
public : void get ( )
{ cout << “Enter title”;
cin.get (title, max);
cout << “enter price”;
cin >> pri;
}
void show ( )
{ cout << “\n Title =” << title;
cout << “\nPrice =” << pri;
}
};
class sale
{ protected : float m[3];
public : void get ( );
void show ( );
};
void sale : : get ( )
{ for (int i = 0; i < 3; i++ )
{ cout << “Enter sale amount for one month”;
cin >> m[i];
}
}
void sale : : show ( )
{ for (int i = 0; i < 3; i++ )
{ cout << m[i]; }
}
class book : public publication, public sale
{ private : int pcount;
public : void get ( )
{ publication : : get ( );
sale : : get ( );
cout << “Enter page count”;
cin >> pcount;
}
void show ( )
{ publication : : show ( );
sale : : show ( );
cout << “\n Page count =” << pcount;
}
};
class tape : public publication, public sale
{ private : int min;
public : void get ( )
{ publication : : get ( );
sale : : get ( );
cout << “Enter Minute”;
cin >> min;
}
void show ( )
{ publication : : show ( );
sale : : show ( );
cout << “\n Minute =” << min;
}
};
enom size { three, five };
class disk : public publication
{ private : size s;
public : void get ( )
{ int n;
cout << “Enter 3 or 5”;
cin >> n;
s = ( n = = 3 ) ? three : five;
publication : : get ( );
}
void show ( )
{ cout << ( s = = three ) ? “disk size = 3 ½”;
“disk size = 5 ¼”;
publication : : show ( );
}
};
void main ( )
{ book b;
tape t;
disk d;
b.get ( ); b.show ( );
t.get ( ); t.show ( );
d.get ( ); d.show ( );
}
20. Start with the publication, book and tape classes. Suppose you want to add the date of
publication for both books and tapes. From the publication class, derived a new class so
called publication 2 that includes this member data. Then change book and tape so they
are derived from publication 2 instead of publication. Make all the necessary changes in
member functions to the user can input and output data along with the other data. For the
data class, use three ints of months, day and year. The member functions are getdata ( )
and showdata ( ). (20 marks)
# include <iostream.h>
# define max 20
class publication
{ protected : char title [max];
float pri;
public : void get ( )
{ cout << “enter title”;
cin.get (title, max);
cout << “Enter price”;
cin >> pri;
}
void show ( )
{ cout << “\n Title =” << title;
cout << “\n Price +” << pri;
}
};
class publication 2 : public publication
{ protected : int mon, day, year;
public : void get ( )
{ publication : : get ( );
cout << “Enter month, day and year”;
cin >> mon >> day >> year;
}
void show ( )
{ employee : : show ( );
student : : show ( );
cout << “\n Title =” << tit << “\t” << “Dues =”
<< dues;
}
};
class book : public publication2
{ private : int pcount;
public : void get ( )
{ publication 2: : get ( );
cout << “Enter page count”;
cin >> pcount;
}
void show ( )
{ publication 2: : show ( );
cout << “\n Page count =” << pcount;
}
};
class tape : public publication2
{ private : int min;
public : void get ( )
{ publication 2: : get ( );
21.Create a linklist program using pointer. Add a destructor to the linklist program. It
should delete all the links when a linklist object is destroyed. It can to this by following
along the chain, deleting each link as it goes. You can test the destructor by having it
display a message each time it deletes a link; it should delete the same number of links
that were added to the list. (20 marks)
# include <iostream.h>
struct link
{ int data;
link * next;
};
class linklist
{ private : link * F;
public : linklist ( )
{ F = NULL; }
void add ( int d );
void display ( );
~ linklist ( );
};
void linklist : : add ( int d )
{ link * L;
L = new link;
L → data = d ;
L → next = F;
F = L;
}
void linklist : : display ( )
{ link * c;
c = F;
while ( c! = NULL )
{ cout << c → data;
c = c → next;
}
}
linklist : : ~ linklist ( )
{ link * d ;
d = F;
while ( d ! = NULL )
{ F = d → next;
delete d;
d = F;
}
}
void main ( )
{ linklist li;
Li.add (5);
Li.add (6);
Li.display ( );
}
22. Revise the additem ( ) member functions from the linklist program so that it adds the
item at the end of the list, rather than the beginning. This will cause the first item inserted
to be the first item displayed. To add the item you will need to follow the chain of
pointers to the end of the list, then change the last link to point to the new link.
(20 marks)
# include <iostream.h>
struct link
{ int data;
link * next;
};
class linklist
{ private : link * F
public : linklist ( )
{ F = NULL; }
void add ( int d );
void display ( );
void operator = (linklist L1 );
~ linklist ( );
};
void linklist : : add ( int d )
{ link * L;
L = new list;
L → data = d;
L → next = NULL;
if ( F == NULL )
{ F = L; }
else { link * P ;
P = F;
while ( P → next != NULL )
{ P = P → next; }
P → next = L;
}
void linklist : : display ( )
{ link * c ;
c = F;
while ( c != NUL )
{ cout << c → data;
c = c → next;
}
}
void linklist : : operator = ( linklist L1 )
{ link * t, * temp, * P;
L = F;
while ( t != NULL )
{ temp = new link;
temp → data = t data;
temp → next = NULL;
if ( F = = NULL )
{ F = temp;
P = temp;
t = t → next;
}
else { P → next = temp;
P = temp;
t = t → next;
}
}
}
linklist : : ~ linklist ( )
{ link * d ;
D = F;
while ( d ! = NULL )
{ F = d → next;
delete d ;
d = F;
}
}
void main ( )
{ linklist L1 , L2 ;
L 1.add (5);
L1 .add (6);
L 1. add (7);
L 1.display ( );
L 2 = L2 ;
L 2. display ( );
}
23. Create an employee class that certain name, number and student class that holds
school, degree, the manager class that are derived from employee and student’s class.
That certain title (string), class (double). From the manager class derive a class called
executive. The additional data in executive class will be the size of the employee’s yearly
bonus and the number of shares of company stock held in his or her stock option plan.
Add the appropriate member functions so these data items can be input and display along
with the other manager data. (20 marks)
# define max 20
# include <iostream.h>
# include <string.h>
class employee
{ protected : char name [max];
long num;
public : employee ( ) { }
employee (char n[ ], long n)
{ strcpy ( name , n )
num = n;
}
void get ( )
{ cout << “Enter name”;
cin.get ( name, max );
cout << “Enter number”;
cin >> num;
}
void show ( )
{ cout << “\n Name =” << name;
cout << “\n Number =” << num;
}
};
class student
{ protected : char sch [max];
char deg [max];
public : void get ( )
{ cout << “Enter school”;
cin.get ( sch, max);
cout << “Enter degree”;
cin.get (deg, max);
}
void show ( )
{ cout << “\n school =” << sch;
cout << “\n degree =”;
}
};
class manager : public employee, public student
{ protected : chartit [max];
double dues;
public : void get ( )
{ employee : : get ( );
student : : get ( );
cout << “Enter title”;
cin.get (tit, max);
cout << “Enter dues”;
cin >> dues;
}
void show ( )
{ employee : : show ( );
student : : show ( );
cout << “\n Title =” << tit << “\t” << “Dues =”
<< dues;
}
};
class executive : public manager
{ private : int bonus, shares;
public : void get ( )
{ manager : : get ( );
cout << “Enter bonus and shares”;
cin >> bonus >> shares;
void show ( )
{ manager : : show ( );
cout << “\n Bonus =” << bonus << “\t” <<
“ shares =” << shares;
}
};
void main ( )
{ executive e;
e.get ( ); e.show ( );
}
Software Engineering
Solution
i. Software – computer programs and associated documentation. Software product
may be developed for a particular customer or may be developed for a general
market.
Software Engineering – software engineering is an engineering discipline which is
concerned with all aspects of software production.
iii. Software process- a set of activities whose goal is the development or evolution of
software.
software process model- a simplified representation of a software process,
presented from a specific perspective.
iv. Software engineering methods-structured approaches to software development
which include system models, notation, rules, design advice and process guidance
CASE-computer aided software engineering.software systems which are intended
to provide automated support for software process activities. CASE systems are
often used for method support.
Partition
Define sub-system
requirement
interfaces
s
Assign requirements
To sub-system
Sol
Workflow model
This shows the sequence of activities in the process along with their inputs,
outputs and dependencies. This represent human actions.
Dataflow model
This represents the process as a set of activites, each of which carries out some
data transformation. It shows how the input to the process, such as a specification, is
transformed to an output, such as a design.
Role/action model
This represents the roles of the people involved in the software process and the
activities for which they are responsible.
Waterfall approach
This takes the above activities and represents them as separate process phases
such as requirements specification, software design, implementation, testing and so
on.
IT 2023
for
Second Semester
s
Sample Question
1. Show the state of the 5-bit register in figure, for the specified data input and clock
waveforms. Assume that the register is initially cleared (all 0s). (15 Marks)
C C C C C
CLK
CLK
Data
input
R 0 1 0
2. Determine the state of the bi-directional shift register after each clock pulse for the
given RIGHT/ LEFT control input waveform in figure . Assume that Q0 =1, Q1 =1,
Q2 =0 and Q3 =1 and that the serial data input line is LOW. (20 Marks)
RIGHT /
(right) (left) (right) (left)
LEFT
CLK
3. Determine the amount of time delay between the serial input and each output in
figure. Show a timing diagram to illustrate. (10 Marks)
A
Data in SRG 8*
B
CLR
o
CLK
500KHz
Q0Q1Q2Q3Q4Q5Q6Q7
CLK
4. What is register and draw basic data movements of shift register. (20 Marks)
5. Draw the storing process of 4-bit register step-by-step with input of 1010. (20 Marks)
6. Show the state of the 4-bit registers (SRG-4) for the data input and clock waveform in
figure. The register initially contains all 1s. (10 Marks)
SRG-4
D
Q0 Q1 Q2 Q3
0 1 1 0
Data in
CLK
IT (2023)
For
Second Semester
1
1. Show the state of the 5-bit register in figure, for the specified data input and clock
waveforms. Assume that the register is initially cleared (all 0s). (10 Marks)
C C C C C
CLK
CLK
Data
input
R 0 1 0
Solution
CLK
Data
Input 0
1 1 0
Q0 0
Data
1 bits
Q1 stored
after
Q2 0 five
1
Q3
1
Q4
2. Determine the state of the bi-directional shift register after each clock pulse for the given
RIGHT/ LEFT control input waveform in figure (b). Assume that Q0 =1, Q1 =1, Q2 =0
and Q3 =1 and that the serial data input line is LOW. (20 Marks)
2
RIGHT /
(right) (left) (right) (left)
LEFT
CLK
Solution
Data In ‘0’
RIGHT/
( right ) ( left )
( right ) ( left )
CLK
Q0
1
Q1
1
Q2 0
Q3
1
3. Determine the amount of time delay between the serial input and each output in figure.
Show a timing diagram to illustrate. (10 Marks)
3
A
Data in SRG 8*
B
CLR
o
CLK
500KHz
Q0Q1Q2Q3Q4Q5Q6Q7
CLK
Solution
f =500kHz
f =1/t
t =1/f
=1/500 103
= 1/5 105
=0.2 10-5
t =2 10-6s
t =2µs
For SRG 8*, the time delay can be increased or decreased in 2µs increments from a
minimum of 2µs to a maximum of 16µs. This is shown in the following figure.
CLK
Data in
Q0
Q1
Q2
Data
out Q3
Q4
Q5
Q6
Q7
2µs
4µs
6µs
8µs 10µs
4 12µs
14µs
16µs
4. What is registered and draw basic data movements of shift register. (20 Marks)
Register
A register is a digitae circuit with two basic functions: data storage and data
movement. The storage capability of a register makes it an important type of memory
device. A register, unlike a counter, has no specified sequence of states.
The basic data movements of shift register are shown in the following.
5
Data Data
Data in Data out out in
(a) Serial in/ shift right/serial (b) Serial in/ shift left/serial out
Data in
Data in
Data
out
(c) Parallel in /serial out Data out
(d) Serial in /parallel out
Data in
Data
out
Data out
(e) Parallel in/Parallel put (f) Rotate right
6
5. Draw the storing process of 4-bit register step-by-step with input of 1010. (20 Marks)
C C C C Register
initially
clear
C
1 0 1 0
1st data Q3
bit=0 D D D D
After
C C C C CLK1
CLK 1
0 0
2nd data 0 0 Q3
bit=1 D D D D
C C C After
C CLK2
CLK2
1 0 0 Q3
3rd data 0
D D D D
bit=1
C C C C After
CLK3
CLK3
1 1 0
4th data 0 Q3
D D D D
bit=1
C C C C After
CLK4
CLK 4
The 4-bit number is completely stored in register after four clock pulse.
7
6. Show the state of the 4-bit registers (SRG-4) for the data input and clock waveform in
figure. The register initially contains all 1s. (10 Marks)
SRG-4
D
Q0 Q1 Q2 Q3
0 1 1 0
Data in
CLK
Solution
Data 0
in 1 0
1
CLK
Q0
Q1
Q2
Q3
8
Chapter (12)
Address Bus
Address
Data bus
decoder Memory array
Read Write
Fig: Block diagram of a memory
8. Explain the memory write operation with appropriate figure. (10 Marks)
The write operation: To store a byte of data in the memory, a code held in the address
register is placed on the address bus. Once the address code is on the bus, the address
decoder decodes the address and selects the specified location in the memory. The
memory then gets a write command and the data byte held in the data register is placed on
the data bus and stored in the selected memory address. When a new data byte is written
into a memory address, the current data byte stored at that address is overwritten and
destroyed.
9
Address Register
Data register
Byte organized memory array
101 10001101
0
1
Address 2
decoder 3
1 4 2
5 10 0 0 1 1 01
Address Bus 6 Data Bus
7
3 Write
Fig: Illustration of the write operation
9. Explain the memory read operation with appropriate figure. (10 Marks)
The read operation: In figure: a code held in the address register is placed on the address
bus. Once the address code is on the bus, the address decoder decodes the address and
selects the specified location in the memory. The memory then gets a read command, and
a “copy” of the data bytes that is stored in the selected memory address is placed on the
data bus and loaded into the data register. When a data byte is read from a memory
address, it also remains stored at that address and is not destroyed. This is called
nondestructive read.
Address Register
Data register
Byte organized memory array
011 11000001
0
1
Address 2
decoder 3 11 0 0 0 0 01
1 4 3
5
Address Bus 6 Data Bus
7
2 Read
Fig: Illustration of the Read operation
RAMs are read/write memories in which data can be written into or read from any
selected address in any sequence. When a data unit is written into a given address in the
RAM, the data unit previously stored at that address is replaced by the new data unit.
When a data unit is read from a given address in the RAM, the data unit remains stored
and is not destroyed by the read operation. This nondestructive read operation can be
viewed as copying the content of an address while leaving the content intact. A RAM is
typically used for short-term data storage because it cannot retain stored data when power
is turned off.
10
11. Explain RAM family and draw the block diagram of RAM family. (10 Marks)
The two categories of RAM are the static RAM (SRAM) and dynamic RAM
(DRAM). Static RAM use flip-flops as storage elements and can therefore store data
indefinitely as long as dc power is applied. Dynamic RAM use capacitors as storage
elements and cannot retain data very lone without the capacitors being recharged by a
process called refreshing. Both SRAMs and DRAMs will lose data when dc power is
removed and, therefore, are classified as volatile memories.
Random Access
Memory(RAM)
11
12. Use 1M x 8 SRAM to create a 1Mx16 SRAM. (10 Marks)
Address A0
bus
A1
I/O8
0 SRAM 2
0 SRAM 1 A 0
A 0 I/O0 19 1048 575
19
1048 575
I/O15
E0
E1
Data I/O
G Data I/O I/O7
R/W
7
Data
8
out
15
Memory Array
256 rows 256 rows ×128
columns
×8 bits
8
bits
128 columns
12
o
Address
o
lines
o Row Memory Array
o decoder 256 rows ×128 columns
o
×8 bits
o
o
Eight
input o
Output
buffers
I/O1 data
Input Column I/O
data
control Column decoder
I/O8
o o o o o o o
Address lines
CS o
o
WE o
OE o Eight
output
buffers
(a) CD ROM: The basic compact Disk Read Only Memory is a 120 mm diameter disk
with a sandwich of three coating. The CD-ROM disk is formatted in a single spiral track
with sequential 2 k byte sector and has a capacity of 680 m bytes. Data is pre recorded at
the factory area surrounding the pits called lands. The pits are stamped into the plastic
layer and cannot be erased.
(b) CD-R: The CD-Recordable allows multiple write sessions to different areas of the
disk. The CD-R disk has a spiral track like the CD-ROM, but instead of mechanically
pressing indentations on the disk to represent data, the CD-R uses a laser to burn
microscopic spots into an organic dye surface. When heated beyond a critical temperature
with a laser during read, the burned spots change color and reflected less light than the
non-burned areas. Therefore, 1s and 0s are represented on a CD-R by burned and non-
burned areas. The data cannot be erased once it is written.
13
(c) CD-RW: The CD-Rewritable disk can be used to read and write data. When it is
heated to a certain temperature, it becomes crystalline when it cools, but if it is heated to a
certain higher temperature, it melts and becomes amorphous when it cools. To write data,
the focused laser beam heats the material to the melting temperature resulting in an
amorphous state. The data can be erased or overwritten by heating the amorphous areas to
a temperature above the crystallization temperature.
(a) WORM: Write Once/Read Many (WORM) is a type of optical storage that can be
written onto one time after which the data cannot be erased but can be read many times.
1s and 0s are represented by the burned and non-burned areas.
(b) DVD-ROM : DVD was an abbreviation for Digital Video Disk but eventually came
to represent Digital Versatile Disk. DVD-ROM data are pre-stored on the disk. However,
the pit size is smaller than for the CD-ROM, allowing more data to be store on a track.
The major difference between CD-ROM and DVD-ROM is that the CD is single sided,
while the DVD has data on both sides. Also, in addition to double sided DVD disks, there
are also multiple layer disks that use semi transparent data layer placed over the main data
layers.
16. Show a basic ROM that programmed for a 4-bit binary to Gray conversion with required
truth table. (20 Marks)
Solution
BINARY GRAY
B3 B2 B1 B0 G3 G2 G1 G0
0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 1
0 0 1 0 0 0 1 1
0 0 1 1 0 0 1 0
0 1 0 0 0 1 1 0
0 1 0 1 0 1 1 1
0 1 1 0 0 1 0 1
0 1 1 1 0 1 0 0
1 0 0 0 1 1 0 0
1 0 0 1 1 1 0 1
1 0 1 0 1 1 1 1
1 0 1 1 1 1 1 0
1 1 0 0 1 0 1 0
1 1 0 1 1 0 1 1
1 1 1 0 1 0 0 1
1 1 1 1 1 0 0 0
14
1 0
Address
decoder
0
5
Binary B0
6
code
applied B1
to 7
address
B2
input 8
lines
B3
9
10
11
12
13
14
15
G3 G2 G1 G0
15
17. Use 512k x 4 RAM to implement a 1M x 4 memory. (10 Marks)
A0
RAM 1
20-bit A
address 0
bus 524, 287
A18
A19 E0
& EN
E1
DI/O0 4-bit
DI/O1 data
DI/O2
DI/O3 bus
RAM 2
A
524, 287
1, 048,575
E0
& EN
Control E1
bus
A0 Address bus
16 bits
A15
Data
bus
16
Chapter (13)
19. Explain about the steps in placing a valid address on the 8288 bus controller. (20 Marks)
The 8288 bus controller is used to relieve the 8088 microprocessor of most bus control
functions in order to increase the processing efficiency. One function of the bus controller
in the CPU is to provide the signals to multiplex the AD0-AD7 bus lines coming from the
microprocessor. The bus controller generates these control signals based on the codes on
the status lines ( s0 , s1 , s2 ) from the microprocessor.
When the microprocessor needs to communicate with memory or I/O, it sends a code
on the status lines to the bus controller. The bus controller then generates an ALE signal,
which latches the address placed on AD0-AD7 and AD8-AD19 by the microprocessor into
system address lathes. There are twenty latches (AD0-AD19), whose tristate outputs form
the system address bus. The steps in this operation are shown in figure. During a memory
read/write cycle, a valid address is available on the address bus; therefore, the lower eight
bits (AD0-AD7) of the microprocessor’s combined bus are freed up to send or receive data.
17
20. Explain the example of an 8088 memory- read operation. (20 Marks)
When the bus controller receives the status code of read operation, it sends a read
command ( IORC or MRDC ) to the appropriate device, and it also sends two signals to
the tristate data bus transceiver (XCVR). These two signals are DT/ R (data
transmit/ receive ) and DEN (data enable). The DEN signal enables the data bus
transceiver, and the DT/ R signal selects the direction of data on the data bus (D0-D7).
MRDC
4 Bus controller issues
MWTC memory- read
IORC
command ( MRDC )
IOWC
DT/ R
DEN
ALE
Bus controller
1 (8288) 2 Bus controller issues
8088 sends DT/ R and DEN
status code signals to data bus
to bus 1 0 1 XCVR
controller
for memory EN
S2 S1 S0
read.
.
. Address
. Address is held on
20 bit
latches bus
AD7 .
.. .
. .
AD0
.
. Data bus
. XCVR
. 8 bit Data Bus
18
21. Explain the example of an 8088 memory - write operation. (20 Marks)
When the bus controller receives the status code of write operation, it sends a write
command ( IOWC or MWTC ) to the appropriate device, and it also sends two signals to
the tristate data bus transceiver (XCVR). These two signals are DT/ R (data
transmit/ receive ) and DEN (data enable). The DEN signal enables the data bus
transceiver, and the DT/ R signal selects the direction of data on the data bus (D0-D7).
MRDC
4 Bus controller issues
MWTC memory- write
IORC
command ( MWTC )
IOWC
DT/ R
DEN
ALE
Bus controller
1 (8288) 2 Bus controller issues
8088 sends DT/ R and DEN
status code signals to data bus
to bus 1 1 1 XCVR
controller
for memory EN
S2 S1 S0
write.
.
. Address
. Address is held on
20 bit
latches bus
AD7 .
.. .
. .
AD0
.
. Data bus
. XCVR
. 8 bit Data Bus
19
22. (a) Define the term DMA. (5 Marks)
(b) Compare a memory I/O data transfer handled by the CPU to a DMA transfer.
(15 Marks)
(a) The technique of data transfer called direct memory access (DMA). DMA bypass the
CPU for certain types of data transfers, thus eliminating the time consumed by the normal
fetch and execute cycles required for each read or write operation.
(b)
CPU
Data
Bus
IOWC
MRDC
CPU
Data
Bus
MEMR IOW
RAM DMA I/O port
controller
20
23. Describe the internal buses system in a typical system in a typical personal computer.
(10 Marks)
Main
Coprocessor Microprocessor
Memory
Cache
Local bus
PCI bus
controller
PCI devices
PCI bus
(card slots)
ISA bus
controller
ISA devices
ISA bus
(card slots)
Figure (a) - Simplified illusion of the basic bus system in a typical personal computer
21
24. Describe the RS-232 C bus (25 pins). (10 Marks)
PIN
Protective ground
1
Transmitted data (TD)
*2
Received data (RD)
*3
Request to send (RTS)
4
Clear to send (CTS)
5
Data set ready (DSR)
6
Signal ground
*7
Data carrier detect (DCD)
8
9 Test Pin
10 Test Pin
11 Unassigned
Secondary RCVD line signal detect
12
DTE Secondary CTS (SCTS) DCE
13
Secondary TD (STD)
14
Transmission timing
15
Secondary RD (SRD)
16
Receiver timing
17
Local loopback (LL)
18
Secondary RTS (SRTS)
19
Data terminal ready (DTR)
20
Remote loopback (RL)
21
Ring indicator
22
Data rate select
23
Transmit signal timing
24
Test Mode (TM)
25
Figure (b) – Full RS-232C 25- pin interface with typical personal configuration indicated
by blue and three signals marked by an asterisk (pins 2,3,7)
22
Instrumentation and Data Acquisition
IT (2033)
for
Second Semester
Sample Question
Q1. Describe the features of 8259APIC. (5 marks)
Q2. Explain I/O devices requesting interrupt service. (10 marks)
Q3. Explain interrupt service routines. (10 marks)
Q4. Explain DMA controllers. (5 marks)
Q5. Explain initialization required for DMA control. (10 marks)
Q6. Explain DMA modes. (10 marks)
Q7. Explain Repeat String Instruction. (10marks)
Q8. Draw the timing chart of 8-bit memory access. (20marks)
Q9. Draw the timing chart of 16-bit memory access. (20 marks)
Q10. Draw the timing chart of 8-bit I/O access. (20 marks)
Q11. Draw the timing chart of 16-bit I/O access. (20 marks)
Q12. Explain Expanded memory system. (10 marks)
Q13. Explain ISA bus. (10 marks)
Q14. Explain the PCI ,COMPACT PCI and PXI bus. (10marks)
Q-15. Explain A/D boards (10-Marks)
Q-16.What is successive approximation A/D converter? (10-Marks)
Q-17. What is Flash A/D converter? (10-Marks)
Q-18.What is integrating A/D converter? (10-Marks)
Q-19 Explain D/A boards. (10-Marks)
Q-20 Explain digital to analog converters. (10-Marks)
Q-21. Explain digital I/O boards. (10-Marks)
Q-22. What is (EIA) RS-232 interface standard? (5-Marks)
Q-23. What is the functional circuit of EIA-232? (10-Marks)
Q-24 What is RS-485 interface standard? (5-Marks)
Q-25. What is comparison of the RS-232 and RS-485 interface standard? (5-Marks)
Instrumentation and Data Acquisition
IT (2033)
for
Second Semester
******************************
Before any DMA operation can occur, the DMA controller must be initialized.
Items requiring initialization are as follows:
• Select whether the DMA controller will read or write to memory.
• Configure the type of DMA data transfer. Four modes of DMA data transfer
are available:
- Single transfer mode
The DRQx signal must be asserted for every byte/word transferred.
- Block transfer mode
A single DRQx signal DMA request initiates the transfer of an entire
block of data.
- Demand transfer mode
Data is transferred as long as the DRQx signal DMA request is
asserted and the terminal count has not been reached.
- Cascade mode
All DMA channels are programmed for single transfer mode.
• The total number of bytes to be transferred is loaded into the appropriate total
byte/word count register. The current byte/word count register is then
automatically initialized.
• The memory address to which the first data byte will be read/written is loaded
into the start memory address register. The current memory address register is
automatically initialized.
• The 4-bit page register corresponding to the upper four bits of the 20-bit
address is written using the I/O port addresses of the PC.
• The DMA channel priorities should be set. When the PC is booted up, the
ROM BIOS sets the priorities so that the lowest numbered channel has the
highest priority.
• The DMA controller(s) channels that are to be used should be enabled.
Channels to be enabled have the channel mask register bits cleared.
******************************
******************************
The ISA signal are divided into 4 groups according to their function:
• Address and data bus signal group
• Data transfer control signal group
• Bus arbitration signal group
• Utility signal group
Q14. Explain the PCI ,COMPACT PCI and PXI bus. (10marks)
******************************
Q-15. Explain A/D boards (10-Marks)
Analog input (A/D) boards convert analog voltages from external signal
sources into a digital format, which can be interpreted by the host computer. The
functional diagram of a typical A/D board is shown in Figure and comprises the
following main components:
Input channel sample and hold circuits (for simultaneous sampling)
• Input multiplexer
• Input signal amplifier
• Sample and hold circuit
• A/D converter (ADC)
• FIFO buffer
• Timing system
• Expansion bus interface
Each of these components plays an important role in determining how fast and
how accurately the A/D board can acquire data.
The successive approximation technique generates each bit of the output code
sequentially, starting with the most significant bit (MSB).
If the analog input signal is greater, the most significant bit (MSB) of the D/A
converter input is set to logic 1 and the next most significant bit of the D/A converter
input is set to logic 1. If the analog input signal was less, the MSB of the D/A input is
cleared to logic 0 and the next most significant bit of the D/A input is set to logic 1.
***********************
Q-17. What is Flash A/D converter? (10-Marks)
Simultaneously compares the input signal voltage to a reference voltage
determined by its position in the resistor series, and corresponding to the output code
of the device. Flash A/D conversion is quicker than other methods of A/D conversion
because each bit of the output code is found simultaneously, irrespective of the
number of bits-resolution. However, the greater the resolution of the device, the
greater the number of comparators required to perform the conversion. In fact, each
additional bit doubles the number of comparators, and therefore increases the size and
cost of the chip.
Voltage appearing at V0
At the start of the A/D conversion, a fixed counter is cleared to zero and the
unknown analog input voltage is applied to the input of the integrating amplifier. As
soon as the output of the integrating amplifier reaches zero, a fixed interval count
begins. After a predetermined count period, T, the count is stopped.
These devices are low speed. They are capable of high accuracy and resolution
at low cost. They are principally used in low frequency applications, such as
temperature measurement, in digital multimeters and instrumentation.
*********************************
Analog output D/A boards typically have between two and sixteen dedicated
output channels, each with its own D/A converter and where required output
buffer/amplifier.
***************************************
Q-20 Explain digital to analog converters. (10-Marks)
Digital to analog converters (D/A converters or DACs) accept an n-bit parallel
digital code as input and provide an analog current or voltage as output using an
operational amplifier. A D/A converter consists principally of a network of analog
switches, controlled by the input code, and a network of precision weighted resistors.
The switches control currents or voltages derived from a precise reference voltage and
provide an analog output current or voltage. The output current/voltage represents the
ratio of the input code to the full-scale voltage of the reference source. The main types
of current output DACs and their specific important parameters are discussed in the
following sections.
***********************************
Q-21. Explain digital I/O boards. (10-Marks)
Digital I/O interfaces are commonly used in a PC based DAQ systems to
provide monitoring and control for industrial processes, generate patterns for testing
in the laboratory and communicate with peripheral equipment such as data loggers
and printers which have parallel digital I/O capabilities.
Non-latched digital I/O
Non-latched digital I/O is the mode of operation in which the state of a digital
output line is updated immediately a digital value is written to the digital I/O port.
Non-latched digital I/O is the most common and simplest implementation used in
digital I/O interfaces and is supported by all boards with digital I/O lines. The
direction of the digital lines of a digital I/O port is conveniently set by software and
can be changed as many times as required.
*****************************
*****************************************
24 What is RS-485 interface standard? (5-Marks)
The EIA RS-485 is the most versatile of the EIA standards, and is an
expansion of the RS- 422 standard. The RS-485 standard was designed for two-wire,
half duplex, balanced multidrop communications, and allows up to 32 line drivers and
32 line receivers on the same line.
RS-485 provides reliable serial communications for:
• Distances of up to 1200 m
• Data rates of up to 10 Mbps
• Up to 32 line drivers permitted on the same line
• Up to 32 line receivers permitted on the same line
****************************************