JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD B.Tech III LINUX PROGRAMMING Previous Question Paper (March - 2021 - R15)
Answer any five questions. All questions carry equal marks.
Main
Give the differences between cmp, diff and comm utilities.
Answer
These utilities are used for file comparison but serve different purposes:
- cmp: Performs a byte-by-byte comparison of two files. It is the fastest way to check if files are identical. It outputs the byte and line number where the first difference occurs and exits silently if the files are identical.
- diff: Performs a line-by-line comparison. It provides a detailed list of instructions (add, change, delete) required to transform one file into the other. It is primarily used for generating patches or viewing textual differences.
- comm: Compares two sorted files line-by-line and produces a three-column output: lines unique to the first file, lines unique to the second file, and lines common to both. It requires the input files to be pre-sorted.
Describe the contents of a directory, explaining the mechanism by which its entries are updated by cp, mv, and rm commands.
Answer
A directory in Linux is a special file that contains a list of mappings between filenames and their corresponding inode numbers. Each entry in this list consists of the filename and the inode index, which links to the actual file metadata and data blocks on the disk.
The cp, mv, and rm commands update these directory entries as follows:
- cp: Creates a new entry in the destination directory with a new inode number. It allocates new data blocks and copies the contents of the source file into them.
- mv: If moving within the same filesystem, it simply renames the entry by updating the directory list (changing the filename associated with the existing inode). If moving across filesystems, it behaves like a cp followed by an rm.
- rm: Removes the filename entry from the directory list and decrements the link count of the associated inode. If the link count reaches zero, the system marks the inode and its associated data blocks as free for future use.
What are the types of errors encountered in scripting? Give the causes and debugging options available in identifying and rectifying them.
Answer
Sign in to view the complete answer paper.
Give the syntax of while and until structures in Bash Shell and illustrate them with an example.
Answer
Sign in to view the complete answer paper.
Discuss the relative merits and demerits of fcntl() system call.
Answer
Sign in to view the complete answer paper.
Explain various status flags and file modes associated with an open() and create() system calls.
Answer
Sign in to view the complete answer paper.
Explain about the scanning direction function.
Answer
Sign in to view the complete answer paper.
What is job control? Explain the features of wait() and waitpid() system calls.
Answer
Sign in to view the complete answer paper.
Describe the need and usage of the following system calls:
fork()
Answer
Sign in to view the complete answer paper.
kill()
Answer
Sign in to view the complete answer paper.
signal()
Answer
Sign in to view the complete answer paper.
Explain the classical producer consumer problem of operating system using semaphores in Linux.
Answer
Sign in to view the complete answer paper.
Describe the functionality provided by system V IPC shared memory mechanism and discuss various kernel APIs associated with it.
Answer
Sign in to view the complete answer paper.