CS609 - Final Term Solved Subjective With References by Moaaz
CS609 - Final Term Solved Subjective With References by Moaaz
Q#3 A disk is divided into three partition. What type of information is represented in code part of
partition table?
Answer:- (Page 219)
code part contains valid executable code
1
Q#5 How ISR sends EOI (End of interrupt) signals to master and slave .Required statement must be in C
program
Answer:-
void irq_handler(registers_t regs)
{
// Send an EOI (end of interrupt) signal to the PICs.
// If this interrupt involved the slave.
if (regs.int_no >= 40)
{
// Send reset signal to slave.
outb(0xA0, 0x20);
}
// Send reset signal to master. (As well as slave, if necessary).
outb(0x20, 0x20);
if (interrupt_handlers[regs.int_no] != 0)
{
isr_t handler = interrupt_handlers[regs.int_no];
handler(®s);
}
Q#6 Suppose a disk is divided into two partition and we have read MBR at LBA=0 to get information
about primary partition
a) How many bytes of code part we need to skip to get information about primary partition?
b) How many bytes of code part we need to read information?
Q#8 Write down procedure to convert a cluster number into sector number
Answer:- (Page 308)
NTFS simply the following formula will be used to translate the sector number into cluster number.
Sector # = Cluster # * Sector Per Cluster
2
Q#10 Describe how a chain of cluster in FAT12 is managed?
Answer:- (Page 291)
3
what is the control information in PSP (program segment prefix) contain?
Answer:- (Page 321)
It contains control information like DTA (Disk Transfer Area) and command line parameters.
What does it indicates if the value of first bytes of data part of partition table is 00H?
Suppose we want to program the interval timer, why we do prefer to use the channel 2 for this purpose and
why?
3 Marks
How many possible entries are there in FAT12 and FAT16?
Answer:- Click here for detail
FAT12 and FAT16 media typically use 512 root directory entries.
Write down the names of three data structure used for memory management?
Answer:- (Page 321)
• DOS makes use of various Data Structures for Memory Management:
• MCB ( Memory Control Block )
• EB ( Environment Block )
• PSP ( Program Segment Prefix )
5 Marks.
What are interrupt function pointers? Explain with examples.
Answer:- (Page 22)
Interrupt pointers and functions
Interrupt functions are special function that as compared to simple functions for reasons discussed earlier. It can be
declared using the keyword interrupt as shown in the following examples.
void interrupt newint ( )
{
...
...
}
Similarly a pointer to such interrupt type function can also be declared as following
void interrupt (*intptr) ( );
where intptr is the interrupt pointer and it can be assigned an address using the getvect() function
intptr = getvect(0x08);
Now interrupt number 8 can be invoked using the interrupt vector as following
(*intptr) ( );
4
What is fragmentation? And how we remove it using defragmentation.
Answer:- (Page 316)
• Fragmentation means that clusters of a same file are not contiguously placed, rather they are far apart,
increasing seek time hence access time.
• So its desirable that files clusters may be placed contiguously, this can be done by compaction or defragme
notation.
• Defragmentation Software reserves space for each file in contiguous block by moving the data in clusters and
Re-adjusting.
• As a result of defragmentation the FAT entries will change and data will move from one cluster to other
localized cluster to reduce seek time.
• Defragmentation has high computation cost and thus cannot be performe d frequently.
A cluster is not the same as block and also there are no system calls available which use the cluster number. All
the system calls use the LSN address. If the cluster number is known it should be converted into LSN to access
the blocks within the cluster. Moreover all the information about file management uses the cluster number
rather than the LSN for simplicity and for the purpose of managing large disk space. So here we devise a
formula to convert the cluster number into LSN.
After calculating the sector number for the cluster the contents of the file can be accessed by reading all the
blocks within the cluster. In this way only the starting cluster will be read. If the file contains a number of
cluster the subsequent clusters numbers within the file chain can be accessed from the FAT.
Int 0*0f can be used to perform program interrupt printer I/O. what are the requirements to enable it.
Answer:- (Page 96)
The interrupt should be enabled in the printer control register; secondly it should also be unmasked in the IMR in
PIC. The program can then intercept or set the vector of interrupt 0x0f by placing the address of its function
newint();
The newint() will now be called whenever the printer can perform output. This newint() function writes the next
byte in buffer to the data registers and then send a pulse on the strobe signal to tell the printer that data has been sent
to it. When whole of the buffer has been sent the int 0x0f vector is restored, interrupt is masked and the memory for
the program is de-allocated.
5
CS609 - Final Term Papers Fall 2012
4 question of 2 marks
Q1) when we talk about FAT32 what is the size of FSInfo block?
Answer:- Rep
Q2) what is the control information in PSP (program segment prefix) contain?
Answer:- Rep
Q3) what does it indicates if the value of first byte of data part of the partition table is 80h?
Q4) What is the difference between the getvect and sectvect function?
Answer:-
setvect() :- Get Interrupt Vector Entry
Setvect() stores the address of an interrupt handler (which must be declared to be of type void interrupt) in the
specified interrupt vector. For example, the code needed to store the address of kb_ih() (the keyboard interrupt
handler) in interrupt vector location KEY_INT (with the value 9) is:
setvect(KEY_INT, kb_ih);
4 question of 3 marks
Q1) suppose we read the contents of Drive parameter block and get the following information .
Number of reserved blocks=2
Number of blocks in FAT= 7
Number of blocks in root directory=32
Find the number of systems blocks .make the appropriate assumptions when needed.
6
Answer:-
Each file on an NTFS volume is represented by a record in a special file called the master file table (MFT).
NTFS reserves the first 16 records of the table for special information.
4 question of 5 marks
Q1) Write down the TSR program that intercepts the interrupt 17H and gives all the spaces in print
document.
Answer:- (Page 88)
#include <dos.h>
void interrupt (*old)( );
void interrupt newint ( );
main( )
{
old = getvect(0x17);
setvect(0x17,newint);
keep(0,1000);
}
void interrupt new ()
{ if (_AH==0)
{
if ((_AL=='A') || (_AL=='Z')) //corrected
return;
(*old)();
}
}
Q2) Write down a procedure to convert the cluster number into sector number?
Answer:- Rep
7
• Performs the CRC test on data read back.
• If there is an error then the data on that block is not stable the cluster of that block should be marked bad.
• The cluster is marked bad by placing the appropriate code for bad cluster so that they may not be allocated to
any file.
Q4) Write down an algorithm that can be used to extract the entries from a FAT12 data structure?
Answer:- (Page 267)
offset = cluster No * 3/2
temp = cluster No * 3%2
if (temp == 0)
{
Then the entry is even, consider the word at this
offset. Make a 12-bit value, by selecting the low
Nibble of the high byte of this. Use this Nibble as
the higher 4-bits. And use the low byte as the lower
eight bits.
}
else
{
The entry is odd, consider the word at this offset.
Select the high Nibble of the low byte as lower 4-bits.
And select high byte as the higher 8-bits.
}
2) Find the root directory sector where Reserved sector =1 Sector per FAT = 9 use appropriate assumption
when needed?
3) How many maximum directories entries are possible in FAT12 & FAT 16?
Answer:- Rep
8
Answer:- (Page 279)
• The contents can be recovered by placing a valid file name, character in place of E5 and then
recovering the chain of file in FAT.
• If somehow the clusters used by deleted file have been overwritten by some other file, it cannot be
recovered.
10) De fragmentation has high computation cost explain why & how?
Answer: - (Page 316)
• Defragmentation Software reserves space for each file in contiguous block by moving the data in clusters and
readjusting.
• As a result of defragmentation the FAT entries will change and data will move from one cluster to other
localized cluster to reduce seek time
• Defragmentation has high computation cost and thus cannot be performe d frequently.
How many maximum root directory entries are pssible in FAT12 and FAT16?
Answer: - Rep
What is MFT?
Answer: - Rep
What is virus ?
Answer: - (Page 331)
Viruses are special program having ability to embed themselves in a system resources and there on propagate
themselves.
10
keyboard on which this bit will turn to 1.
OBF ( output buffer full bit of port 64H which remains set as long as the byte is not received by the keyboard.
Q-2: How to convert the Logical address directly into the Physical address?
Answer: - (Page 325)
In Protected Mode the direct method of seg * 10H + offset for Logical to Physical address translation is
discarded and an indirect method is adopted.
2.Write down direct method for logical to physical address translation. (2)
Answer: - Rep
3.How can we calculate the correct cylinder number between two partitions of a high capacity hard disk? (2)
5. Write down the formula to translate cu\luster number into LSN for FAT 32. (3)
Answer: - (Page 259)
No. of System Area Blocks = Reserved Block + Sector per FAT * No. of FAT’s + No. of entries * 32 / Bytes per Block
First User Block No. = No. of System Area Blocks
=>Sector No. = (Clust_no – 2)* Blocks per Clust + First User Block #
7. How many maximum root directory entries are possible in FAT12 and FAT16? (3)
Answer: - Rep
8. Write down the value of CH, CL and DH registers on entry when intrupt 13H/3H is invoked? (3)
Answer: - (Page 42)
CH = Track # ,
CL = Sector #
DH = Head #
Answer: -
// Turn the speaker on setting the lowest two bits in port 61h.
outportb(0x61,inportb(0x61)|0x03);
// Turn the speaker off clearing the lowest two bits in port 61h.
outportb(0x61,inportb(0x61)&0xFC);
10. Why we need to convert cu\luster number into sector number? (5)
Answer: - (Page 258)
The user data area is divided into clusters. The first cluster in user data area is numbered 2 in a FAT based
systems. A cluster is not the same as block and also there are no system calls available which use the cluster
number. All the system calls use the LSN address. If the cluster number is known it should be converted into
LSN to access the blocks within the cluster. Moreover all the information about file management uses the
cluster number rather than the LSN for simplicity and for the purpose of managing large disk space.
12. What are cross reference and how this problem can be solved? (5
Answer: - (Page 316)
• If a cluster lie in more than one file chain, then its said to be Cross Referenced.
• Cross references can pose great problems.
• Cross references can be detected easily by traversing through the chain of all files and marking the cluster #
during traversal.
• If a cluster is referenced more than once then it indicates a cross reference.
12
• To solve the problem only one reference should be maintained.
Which command is use befor changing the typematic rate and LED status.
Answer: - (Page 181)
If the device driver needs to change the status then the LED status byte should be written on the keyboard. But
before writing this byte the keyboard should be told that the control byte is to be written. This is done by sending the
code 0XED before sending the status byte using the above described protocol.
Purpose of UART
Answer: - (Page 107)
The UART is a device used for asynchronous communications. UART is capable Of encapsulating a byte that might
be 5, 6, 7 or 8 bits wide in start and stop bits. Moreover it can attach an extra parity bit with the data for error
detection.
13
If a file size is 12K and the size of the cluster is 4K then clusters are used for the file.
Answer: -
3 clusters
14
write the structure of root directory
Answer: - (Page 256)
The DOS directory structure is a Tree like structure. The top most level of the tree being the root directory. The root
directory contains files and folders. Each folder can contains more files and folders and so on it continues
recursively
5) What is highest capacity of disk using IDE and extended Bios Function?
Answer: - (Page 212)
• Hence highest physical capacity of the disk according to the IDE interface is
255x16x65536x512 = 127GB
•Extended BIOS functions allow to access disk with sizes greater than 504 MB through LBA translation.
3 Marks
In which media storage head touches the surface of the disk and why?
Answer: - (Page 206)
The head is touching the surface of floppy disk which rotates at a low speed of 300 RPM
In DMA programming Model, what is the main purpose of base register? [2 Marks]
15
Answer: - (Page 197)
Before the channel is unmasked and the channel mode is programmed the base address the count and the higher 4 or
8 bits of the address should be placed in base register, count register and Latch B respectively.
From where, in partition table’s data part we can check the drive is bootable or not.
Answer: -
In the data part of partition table there are 16 byte code for each partition the first byte out of these 16 bytes
decide whether it is a bootable drive or not if value stored in this byte is 80h than it is a boot device and if zero
than it is not a boot device
Which data structure is derived from BPB and where it resides? [2 Marks]
Answer: - (Page 242)
BIOS parameter block is a data structure maintained by DOS in the boot block for each drive. The boot block is
typically a 512 byte block which as seen the previous slides is the first logical block i.e. LSN = 0. It contains
some code and data. The data part constitutes the BPB.
Fat32 Entry
•Each entry is of 32-bits size but only lower 28-bits are used.
•Higher 4-bits are not tempered.
•While reading higher 4-bits are ignored.
•While writing higher 4-bits are not changed.
16
A Descriptor describes a Memory Segment by storing attributes related to a Memory Segment.
Significant attributes of a Memory Segment can be its base (starting) address, it length or limit and its access
rights.
17