JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD MCA 2021 LINUX PROGRAMMING Previous Question Paper (July/August - 2021 - R17)
Answer any five questions
All questions carry equal marks
Main
Explain about shell variables and shell Meta characters with suitable examples.
Answer
Shell variables are used to store data in the form of strings, which the shell can access and manipulate. They are categorized into environment variables (inherited by child processes) and local/shell variables (defined within the current shell session). Variables are assigned using the syntax variable_name=value and accessed using the $ prefix.
Example:
echo "Hello, $USER_NAME"
Shell meta-characters are special characters that have a specific functional meaning to the shell, rather than being treated as literal text. They are used for pattern matching, redirection, and process control.
Key meta-characters include:
- * (Asterisk): Matches any string of characters, including null. Example: ls *.txt lists all files ending in .txt.
- ? (Question Mark): Matches any single character. Example: ls file?.txt matches file1.txt but not file10.txt.
- [] (Square Brackets): Matches any one of the characters enclosed within the brackets. Example: ls [a-c]* lists files starting with a, b, or c.
- ; (Semicolon): Used to execute multiple commands sequentially on a single line. Example: date; who.
- & (Ampersand): Executes a command in the background. Example: ./script.sh &.
- | (Pipe): Passes the output of one command as input to another. Example: ls | grep 'log'.
- > and >> (Redirection): Used to redirect output to a file, where > overwrites and >> appends. Example: ls > filelist.txt.
- \ (Backslash): Escapes the next character, treating it as a literal rather than a meta-character. Example: echo "Price is \$5" prints the dollar sign literally.
Explain about Piping and I/O redirection operators in Bourne Shell.
Answer
In the Bourne Shell, I/O redirection allows a user to change the standard input (stdin), standard output (stdout), or standard error (stderr) of a command. The primary operators include:
- >: Redirects stdout to a file, overwriting existing content.
- >>: Appends stdout to the end of a file.
- <: Redirects stdin from a file.
- 2>: Redirects stderr to a file.
- >&: Redirects one file descriptor to another (e.g., 2>&1 redirects stderr to stdout).
Piping is represented by the | operator. It connects the standard output of one command directly to the standard input of another command. This allows for the creation of complex command chains where the output of a process is processed incrementally by subsequent commands without requiring intermediate temporary files.
Write a shell script to display the contents of a file without using in-built utilities.
Answer
Sign in to view the complete answer paper.
Give the syntax for open( ) and create( ) system calls and explain.
Answer
Sign in to view the complete answer paper.
Describe the file descriptor and inode table entries with a neat diagram.
Answer
Sign in to view the complete answer paper.
Explain any two directory related system calls with neat syntax and example.
Answer
Sign in to view the complete answer paper.
Write about hashes and references in Perl.
Answer
Sign in to view the complete answer paper.
How does a fork( ) system call differs from an exec( ) system call? Explain.
Answer
Sign in to view the complete answer paper.
Write a program that illustrates the concept of zombie process.
Answer
Sign in to view the complete answer paper.
Illustrate the concept of kill( ) and raise( ) system calls.
Answer
Sign in to view the complete answer paper.
Explain about the primary features of reliable functions with an illustrative example program.
Answer
Sign in to view the complete answer paper.
What are the security problems associated with system V IPC mechanisms?
Answer
Sign in to view the complete answer paper.
What are the limitations of pipes? List the benefits of FIFOs compared to pipes.
Answer
Sign in to view the complete answer paper.
Describe all the elementary socket functions required to write a complete TCP client and server application.
Answer
Sign in to view the complete answer paper.