Linux & Shell Programming – Semester
Exam Solution
Prepared for: B.Tech CSE (AI & DS)
Subject Code: 12CA609 / 121CS603
Exam Year: May 2024 & May 2025
SECTION A – Very Short Answer Questions
Paper 1: May 2024 (10x2=20 Marks)
Q1. Describe in the structure of UNIX.
Ans: The structure of UNIX consists of three main components:
1. Kernel – core of the OS, handles memory, CPU, device, and process management.
2. Shell – command interpreter that allows users to interact with the kernel.
3. File System – manages data in a hierarchical structure with files and directories.
Example: When you type a command in terminal, shell interprets it and kernel executes
it.
Q2. Define boot block and super block.
Ans:
• Boot Block: It contains the bootstrap loader which loads the OS into memory.
• Super Block: Contains metadata of the file system like size, block count, free blocks,
and inode information.
Q3. Define the vi editor.
Ans: 'vi' is a screen-oriented text editor in UNIX. It operates in three modes:
1. Command Mode – default mode to run commands
2. Insert Mode – used for inserting text (press 'i')
3. Last-line Mode – used for saving and quitting (use ':' commands like :wq)
Q4. Discuss the head and tail command.
Ans:
• head: Displays the first 10 lines of a file by default.
Syntax: head filename.txt
Example: head -n 5 file.txt → Shows first 5 lines.
• tail: Displays the last 10 lines of a file.
Syntax: tail filename.txt
Example: tail -n 5 file.txt → Shows last 5 lines.
Q5. Describe the split command.
Ans:
The split command is used to split a file into smaller files.
Syntax: split [options] filename prefix
Example: split -l 5 data.txt part → Splits data.txt into files of 5 lines each like partaa,
partab...
Q6. Describe the kill and com tab command.
Ans:
• kill: Used to terminate processes manually.
Syntax: kill [PID]
Example: kill 1234
• comm: Compares two sorted files line by line.
Syntax: comm file1 file2
Q7. Define the shell.
Ans:
A shell is a command-line interpreter that provides a user interface to access the kernel's
services.
Examples: Bash, Zsh, Korn, C Shell.
Q8. Explain the scripting in Python.
Ans:
Scripting in Python refers to writing small programs to automate tasks.
Example:
```python
print('Hello, Linux')
```
Used for automation, file handling, system administration, etc.
Q9. Discuss the Telnet.
Ans:
Telnet is a network protocol used to access remote computers.
Command: telnet hostname/IP
It allows you to log into another machine remotely.
Q10. Define the IPC.
Ans:
IPC (Inter-Process Communication) is used for data sharing between processes.
Methods: Pipes, Shared Memory, Message Queues, Sockets.