JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD B.Tech IV LINUX PROGRAMMING Previous Question Paper (July - 2023 - R16)
Note: i) Question paper consists of Part A, Part B. ii) Part A is compulsory, which carries 25 marks. In Part A, Answer all questions. iii) In Part B, Answer any one question from each unit. Each question carries 10 marks and may have a, b as sub questions.
Part A
What is an associative array?
Answer
An associative array, also known as a map or dictionary, is a data structure that stores a collection of key-value pairs. Unlike traditional arrays that use integer indices to access elements, associative arrays use unique keys (which can be strings, numbers, or other hashable data types) to retrieve associated values. Each key in the array maps to a specific value. This allows for more flexible and intuitive data organization, especially when dealing with data that doesn't naturally fit into sequential integer indexing.
For example, in a programming context, you might use an associative array to store user information where the username is the key and the value is an object containing the user's details (email, age, etc.).
Distinguish between “awk” and “sed”.
Answer
Both awk and sed are powerful stream editors and text processing utilities in Unix-like operating systems, commonly used for pattern scanning and transformation. However, they differ significantly in their primary purpose and capabilities:
| Feature | sed (Stream Editor) | awk (Aho, Weinberger, and Kernighan) |
|---|---|---|
| Primary Use | Primarily used for text substitution and simple transformations on a line-by-line basis. It operates on a stream of text, applying editing commands. | Primarily used for pattern scanning and processing. It excels at parsing structured text files, performing calculations, and generating reports based on data fields. |
| Data Handling | Processes text line by line. It has limited capabilities for handling fields within a line. | Processes text line by line, but automatically splits each line into fields (based on whitespace or a specified delimiter), making it easy to work with columnar data. |
| Programming Constructs | Offers basic commands for substitution, deletion, insertion, and branching. Its scripting capabilities are relatively simple. | Provides a more sophisticated programming language with variables, arithmetic and string operators, control flow statements (if, while, for), and associative arrays. |
| Output | Typically outputs the modified stream. Can be used to extract specific lines. | Can format and print output, often generating reports or summaries based on processed data. |
| Example Use Case | Replacing all occurrences of 'foo' with 'bar' in a file. Deleting empty lines. | Calculating the sum of values in a specific column of a CSV file. Extracting and reformatting data from log files. |
What is an Inode?
Answer
Sign in to view the complete answer paper.
Distinguish between soft and hard links.
Answer
Sign in to view the complete answer paper.
What are signals used for?
Answer
Sign in to view the complete answer paper.
Distinguish between a thread and a process.
Answer
Sign in to view the complete answer paper.
Distinguish between named and unnamed pipes.
Answer
Sign in to view the complete answer paper.
Distinguish between IPC between processes on a single system and different systems.
Answer
Sign in to view the complete answer paper.
What is a client-server model?
Answer
Sign in to view the complete answer paper.
What is a shared memory used for?
Answer
Sign in to view the complete answer paper.
Part B
Describe the control statements in shell.
Answer
Sign in to view the complete answer paper.
Give the commands for backup, extracting, compressing and uncompressing and explain.
Answer
Sign in to view the complete answer paper.
Explain any five commands for working with files in Linux.
Answer
Sign in to view the complete answer paper.
Write a script for arithmetic calculator using command line arguments.
Answer
Sign in to view the complete answer paper.
Give the commands for moving, copying, removing and finding files along with examples.
Answer
Sign in to view the complete answer paper.
How to change file permissions and ownership in Linux?
Answer
Sign in to view the complete answer paper.
Explain the following Linux commands using examples: mkdir, opendir, readdir, closedir and rewinddir.
Answer
Sign in to view the complete answer paper.
Explain Linux system call interface for process management in detail.
Answer
Sign in to view the complete answer paper.
Explain the typical lifecycle of a signal and the Linux support for signals.
Answer
Sign in to view the complete answer paper.
Demonstrate with an example the use of semaphores for synchronization.
Answer
Sign in to view the complete answer paper.
Demonstrate with an example two-way communication using pipes.
Answer
Sign in to view the complete answer paper.
Explain IPC mechanism of message passing.
Answer
Sign in to view the complete answer paper.
How do you implement a semaphore in Linux?
Answer
Sign in to view the complete answer paper.
Explain the mechanism of IPC using shared memory and describe system calls for the same.
Answer
Sign in to view the complete answer paper.
Make a comparison of various IPC mechanisms.
Answer
Sign in to view the complete answer paper.
Give an overview of Berkeley sockets.
Answer
Sign in to view the complete answer paper.