You are on page 1of 7

Real Time Operating Systems

UNIT I MCQ
1. What is Unix?
a) Unix is a programming language
b) Unix is a software program
c) Unix is an operating system
d) Unix is a text editor
Answer: c
Explanation: Unix is an operating system developed in the early 1970’s at Bell Labs by Dennis
Ritchie, Ken Thompson, and others. It is a multiuser, multitasking and timesharing operating
system. The power of Unix is derived from its commands and their multiple options.

2. The Unix shell is both _______ and _______ language.


a) scripting, interpreter
b) high level, low level
c) interactive, responsive
d) interpreter, executing
Answer: a
Explanation: The UNIX shell is both an interpreter and scripting language. We can also say that
shell can be interactive or non-interactive. When we log in to our system, interactive shell presents a
prompt and wait for our requests while a non-interactive shell is managed by an interactive shell
while executing a shell script.

3. In which language UNIX is written?


a) C++
b) C
c) JAVA
d) Python
Answer: b
Explanation: UNIX was originally written in Assembly language but Dennis Ritchie and Ken
Thompson wanted an operating system which could run on more than one type of hardware. So in
1973, they rewrote the whole operating system in C language due to which one of the strongest
features i.e. portability was added to the operating system.

5. Which of the following is not a feature of Unix?


a) multiuser
b) easy to use
c) multitasking
d) portability
Answer: b
Explanation: UNIX is a multitasking operating system i.e. a user can run multiple tasks
concurrently. Similarly, it is a multiuser system because it permits working with multiple users on a
single operating system. But a major disadvantage of UNIX lies in the fact that the richness
provided by its commands requires a special type of commitment to understand the subject. i.e. the
user must be well aware of commands he is using and the functions performed by them.

6. Which of the following is not true about Unix?


a) UNIX was not written in ‘C’ language
b) Linux is also known as a version of UNIX
c) A user can run multiple programs at the same time; hence UNIX is called a multitasking
environment
d) Many people can use a UNIX based computer at the same time; hence UNIX is called as a
multiuser system
Answer: a`
Explanation: One of the most attractive features of UNIX is that it supports multi-user and
multitasking environment which makes it so popular among its users. There are many UNIX
variants available in the market. Solaris Unix, AIX, HP Unix, BSD are some of the examples. Linux
is also a flavor of UNIX which is freely available. Unix was developed in 1969 by AT&T
employees Ken Thompson, Dennis Ritchie, Douglas McIlroy, and Joe Ossanna at Bell Labs and
was written in ‘C’.

7. Which editor is used by the Unix system to edit files?


a) word
b) notepad++
c) vi
d) notepad
Answer: c
Explanation: It doesn’t matter what kind of work we are doing on a UNIX system, we always need
an editor to edit some system files or ordinary files. For this purpose, vi editor is used in UNIX.
Currently, vim (vi improved) is an improved version which is supported by LINUX systems.

8. Which of the following is not a part of all the versions of Unix?


a) System Calls
b) Graphical user interface
c) Kernel and Shell
d) Commands and utilities
Answer: b
Explanation: The kernel is the heart of the operating system while the shell is the utility which
processes our requests. While system calls are a handful of functions which are used to interact with
the kernel and make available the services provided by the operating system. A Graphical user
interface (GUI) is available in UNIX, but the traditional UNIX interface is the command line only.

9. Which part of the Unix operating system interacts with the hardware?
a) Application program
b) Vi editor
c) Shell
d) Kernel
Answer: d
Explanation: The kernel is the core of the operating system. It is a collection of routines written in C
which directly communicates with the hardware. User programs that need to interact with the
hardware access the services of the kernel. There is only one kernel running on a system, unlike
shells which can be multiple.

10. Which command is used to display the documentation of commands in Unix?


a) man
b) whatis
c) help
d) search
Answer: a
Explanation: UNIX provides us with a facility of man command, which is used for getting
documentation of any command. For example, to seek help on wc command simply type man wc.
This will simply display all the possible operations, options, description, synopsis of wc command.
The POSIX specification requires only one available option with man command i.e. -k, which prints
a one-line description of the command. whatis command is also available on many UNIX systems
which also displays a one-line description of the command. man -f emulates the behavior of whatis
command.

11. Which Unix command is used for changing the current directory?
a) pwd
b) rm
c) cd
d) cp
Answer: c
Explanation: cd (change directory) command is used for moving around the file system. cd
command is usually invoked with a argument. After invocation, it changes the current directory to
the directory specified as argument. Cp command is used for copying files while rm command is
used for deleting files.

12. Which command is used for printing the current working directory?
a) dir
b) HOME
c) cd
d) pwd
Answer: d
Explanation: pwd command is used for checking our current directory. Current directory is the
directory in which we are currently working. pwd displays the absolute pathname i.e. with respect
to the root directory.

13. Which command is used for listing files in a directory?


a) list
b) ls
c) wc
d) ps
Answer: b
Explanation: ls command is one of the most powerful commands used in UNIX system. It comes
available with a bunch of options for listing files available in the directory. There are a number of
options like -l, -a which are used for listing files in different manners according to user’s need.

14. Permissions of a file are represented by which of the following characters?


a) r,w,x
b) e,w,x
c) x,w,e
d) e,x,w
Answer: a
Explanation: A file can have three types of permissions; read, write and execute which is
represented by characters r, w and x respectively.

15. A file named abd.txt has the following set of permissions


-rwxrwxrwx

All the three operations i.e read, write and execute can be performed on the file by file owner, group
owner and others.
a) True
b) False
Answer: a
Explanation: UNIX provides a three tired file protection system that determines the file access
rights i.e. the permissions are dived into three groups as
r w x r w x r w x

The first group has all the three permissions i.e. file is readable, writable and executable by the file
owner.
The second group also has all the three permissions i.e. file is readable, writable and executable by
the group owner.
The third group also has all the three permissions i.e. file is readable, writable and executable by
others who are neither a part of the group nor they are an owner of the file.
16. Which command is used to change the permissions of a file?
a) chmod
b) ch
c) chown
d) chgrp
Answer: a
Explanation: The chmod (change mode) command is used to change the permissions of files. This
command can only be run by the owner of the file or by the super user.

17. What are the permission of file01 after executing this command?
chmod 777 file01

a) rwxrwxrwx
b) rw-rw-rw
c) r–r–r–
d) r–r—-

Answer: a
Explanation: Since the octal number for the above command is 777 and we know
that 7(111) represents all the three sets of permissions (read, write and
execute) for a category of user. As we have 777, the file is readable, writable
and executable by anyone.

18. A process is an instance of _______ program.


a) waiting
b) executing
c) terminated
d) halted

Answer: b
Explanation: A process is simply an instance of a running program. A process
passes through many states throughout its life cycle i.e. when it is born until
it is executed. After the process has completed it is said to be terminated.

19. A process is said to be ____ when it starts its execution.


a) born
b) die
c) waiting
d) terminated
Explanation: A process is said to be born when it starts its execution. It is
the initial state of a process. The process is assigned to CPU for its execution
further.

20. Programs and process are synonymous.


a) True
b) False

Answer: b
Explanation: Program should not be confused with the process. Both differ from
each other but very slightly. The process is only an instance of a running
program. Until a program hasn’t started its execution it is referred to a
program only but as soon it is in execution state it is called as a process.

21. Which data structure is used to store information about a process?


a) process control block (pcb)
b) array
c) queue
d) program control block
Answer: a
Explanation: A process control block is a data structure which is used for storing information about
a process. It is also known as task control block and is maintained by the kernel for maintenance of
a process. Each process has its own pcb.
22. Each process is identified by a unique integer called ______
a) PID
b) PPID
c) TID
d) PTID

Answer: a
Explanation: Each process is uniquely identified by a unique integer called as the Process ID (PID)
which is allotted by the kernel when the process is born. This PID is used for controlling the process
of killing it.
23. Which command shows some attributes of a process?
a) pid
b) $$
c) ps
d) HOME
Answer: c
Explanation: ps command is used to show some attributes of a process. This command reads
through the kernel’s data structures and process tables to fetch the characteristics of a process. By
default, ps command displays the processes owned by the user running the command.
24.Which of the following system call is used for creating a new process?
a) read
b) fork
c) wait
d) new
Answer: b
Explanation: A process in UNIX is created using fork() system call. It creates an exact copy of the
process that invokes it. Now there will be two processes, one parent process and one child process.
The process which invokes the fork system call is called parent process and the new process created
is called child process.
25.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.

26. 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.

27. 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: All UNIX and LINUX systems have one thing in common; they use the same set of
system calls.

28. 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.

29. 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.
30. 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.

31.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.

You might also like