Header Ads Widget

Operating system Concepts

1.Timer is used to prevent a single
a)Job
b)Time
c)Computer
d)Information
Answer : a

2. To run a program this Setup involves an amount of
a)Money
b)Resources
c)Users
d)Time
Answer :d

3. Time sharing technique handles
a)Single Interactive Job
b)Multiple Interactive Job
c)Recent Interactive Job
d)Old Interactive Job
Answer:b

4.Interrupts make an operating system more
a)Rigid
b)Expensive
c)Reliable
d)Flexible
Answer:d

5. With the use of multiprogramming batch processing work can be

a)Efficient
b)Rigid
c)Expensive
d)Flexible
Answer : a

6. The initial program that is run when the computer is powered up is called __________
a) boot program
b) bootloader
c) initializer
d) bootstrap program
Answer: d
Explanation: None.

7. How does the software trigger an interrupt?
a) Sending signals to CPU through bus
b) Executing a special operation called system call
c) Executing a special program called system program
d) Executing a special program called interrupt trigger program
Answer: b
Explanation: None.

8. What is a trap/exception?
a) hardware generated interrupt caused by an error
b) software generated interrupt caused by an error
c) user generated interrupt caused by an error
d) none of the mentioned
Answer: b
Explanation: None.

9. What is an ISR?
a) Information Service Request
b) Interrupt Service Request
c) Interrupt Service Routine
d) Information Service Routine
Answer: c
Explanation: None.

10. What is an interrupt vector?
a) It is an address that is indexed to an interrupt handler
b) It is a unique device number that is indexed by an address
c) It is a unique identity given to an interrupt
d) None of the mentioned
Answer: a
Explanation: None.

11. DMA is used for __________
a) High speed devices(disks and communications network)
b) Low speed devices
c) Utilizing CPU cycles
d) All of the mentioned
Answer: a
Explanation: None.

12. In a memory mapped input/output __________
a) the CPU uses polling to watch the control bit constantly, looping to see if a device is ready
b) the CPU writes one data byte to the data register and sets a bit in control register to show that a byte is available
c) the CPU receives an interrupt when the device is ready for the next byte
d) the CPU runs a user written code and does accordingly
Answer: b
Explanation: None.

13. In a programmed input/output(PIO) __________
a) the CPU uses polling to watch the control bit constantly, looping to see if a device is ready
b) the CPU writes one data byte to the data register and sets a bit in control register to show that a byte is available
c) the CPU receives an interrupt when the device is ready for the next byte
d) the CPU runs a user written code and does accordingly
Answer: a
Explanation: None.

14. In an interrupt driven input/output __________
a) the CPU uses polling to watch the control bit constantly, looping to see if a device is ready
b) the CPU writes one data byte to the data register and sets a bit in control register to show that a byte is available
c) the CPU receives an interrupt when the device is ready for the next byte
d) the CPU runs a user written code and does accordingly
Answer: c
Explanation: None.

15. In the layered approach of Operating Systems __________
a) Bottom Layer(0) is the User interface
b) Highest Layer(N) is the User interface
c) Bottom Layer(N) is the hardware
d) Highest Layer(N) is the hardware
Answer: b
Explanation: None.

16. How does the Hardware trigger an interrupt?
a) Sending signals to CPU through a system bus
b) Executing a special program called interrupt program
c) Executing a special program called system program
d) Executing a special operation called system call
Answer: a
Explanation: None.

17. Which operation is performed by an interrupt handler?
a) Saving the current state of the system
b) Loading the interrupt handling code and executing it
c) Once done handling, bringing back the system to the original state it was before the interrupt occurred
d) All of the mentioned
Answer: d
Explanation: None.

18. A system call is a routine built into the kernel and performs a basic function.
a) True
b) False
Answer: a
Explanation: All UNIX systems offer around 200 special functions known as system calls. A system call is a routine built into the kernel and performs a very basic function that requires communication with the CPU, memory and devices.

19. When we execute a C program, CPU runs in ____ mode.
a) user
b) kernel
c) supervisory
d) system
Answer: a
Explanation: When we execute a C program, the CPU runs in user mode. It remains it this particular mode until a system call is invoked.

20. In ____ mode, the kernel runs on behalf of the user.
a) user
b) kernel
c) real
d) all
Answer: b
Explanation: Whenever a process invokes a system call, the CPU switches from user mode to kernel mode which is a more privileged mode. The kernel mode is also called as supervisor mode. In this mode, the kernel runs on behalf of the user and has access to any memory location and can execute any machine instruction.

21. All UNIX and LINUX systems have one thing in common which is ____
a) set of system calls
b) set of commands
c) set of instructions
d) set of text editors
Answer: a
Explanation: As we know that, all UNIX and LINUX systems have one thing in common; they use the same set of system calls.

22. The chmod command invokes the ____ system call.
a) chmod
b) ch
c) read
d) change
Answer: a
Explanation: Many commands and system calls share the same names. For example, the chmod command invokes the chmod system call.

23. For reading input, which of the following system call is used?
a) write
b) rd
c) read
d) change
Answer: c
Explanation: The standard C library offers a set of separate functions to read a block of data. For example, to read a block of data fread is used, for reading a line fgets is used and for reading a character fgetc is used. All these functions invoke the system call -read, which is available for reading input.

24. Which of the following system call is used for opening or creating a file?
a) read
b) write
c) open
d) close
Answer: c
Explanation: To read or write to a file, we first need to open it. For this purpose, open system call is used. Open has two forms ; the first forms assumes that the file already exists and the second form creates the file if it doesn’t.

25. There are ___ modes of opening a file.
a) 4
b) 3
c) 2
d) 1
Answer: b
Explanation: There are three modes of opening a file, out of which only one mode is required to be specified while opening the file. The three modes are, O_RDONLY, O_WRONLY, O_RDWR.

26. Which of the following mode is used for opening a file in both reading and writing?
a) O_RDONLY
b) O_WRONLY
c) O_RDWR
d) O_WDR
Answer: c
Explanation: There are three modes of opening a file namely:

 O_RDONLY    -    opens files for reading
 O_WRONLY    -    opens file for writing 
 O_RDWR      -   opens file for reading and writing

27. open system call returns the file descriptor as ___
a) int
b) float
c) char
d) double
View Answer
Answer: c
Explanation: open returns the file descriptor as an int. This is the lowest number available for allocation and is used as an argument by the other four calls (read, write, close, lseek).

28. Which of the following system call is used for closing a file?
a) open
b) lseek
c) close
d) write
Answer: c
Explanation: A program automatically closes all open files before termination, but it’s a good practice to close them explicitly. The close system call is used for closing a file.
int close (int fd)

29. close system call returns ____
a) 0
b) -1
c) 1
d) 0 and -1
Answer: d
Explanation: The return type of close system call is an integer. It either returns 0 if the file is closed successfully or -1 otherwise.

30. ____ system call is used for writing to a file.
a) read
b) write
c) close
d) seek
Answer: b
Explanation: write system call is required for writing to a file which has previously been opened with the open system call. write system call returns the number of characters written.

31. write system call returns -1 when ___________
a) if disk fills up while write is in progress
b) when file doesn’t exist
c) if the file size exceeds the system’s limit
d) if disk fills up while write is in progress and if the file size exceeds
Answer: d
Explanation: write system call returns the number of characters written. However, it will return -1 if if disk fills up while write is in progress or if the file size exceeds the system’s limit.

32. ____ system call is used for positioning the offset pointer.
a) read
b) write
c) open
d) lseek
Answer: d
Explanation: The lseek system call moves the file offset pointer to a specified point. It doesn’t do any physical I/O rather it determines the position in the file where the next I/O operation will take place.

33. Which of the following offset is used with lseek system call to set the offset pointer to the end of the file?
a) SEEK_SET
b) SEEK_END
c) SEEK_CUR
d) SEEK_CR
Answer: b
Explanation: The offset signifies the position of the offset pointer which can take one of these three values:

 SEEK_SET    -    offset pointer set to the beginning of file
 SEEK_END    -    offset pointer set to the end of file
 SEEK_CUR    -    offset pointer remains at current location


34. Which of the following system call is used for truncating a file?
a) truncate
b) ftruncate
c) trunk
d) truncate and ftruncate
Answer: d
Explanation: The truncate and ftruncate calls can truncate a file to any length. These calls are often used in combination with lseek to overwrite a certain segment of a file.

35. truncate needs the ___ of the file as an argument but ftruncate works with _______
a) pathname, file descriptor
b) file descriptor, pathname
c) pathname, pathname
d) file descriptor, file descriptor
Answer: a
Explanation: The truncate and ftruncate calls can truncate a file to any length. truncate needs the pathname of the file as an argument but ftruncate works with the file descriptor.

Post a Comment

0 Comments