JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD MCA 2022 LINUX PROGRAMMING Previous Question Paper (September/October - 2022 - R17)
Answer any five questions
All questions carry equal marks
Main
Write a shell script to find the factorial of a given number.
Answer
To calculate the factorial of a number in a shell script, we can use a loop to multiply the sequence of integers from 1 to the input number.
#!/bin/bash
echo "Enter a number:"
read num
fact=1
for (( i=1; i<=num; i++ ))
do
fact=$((fact * i))
done
echo "Factorial of $num is $fact"Explain about the input redirection and output redirection in shell script.
Answer
Input and output redirection allow a shell to change the source of input and the destination of output for commands, moving away from the default standard input (keyboard) and standard output (screen).
Output Redirection: This uses the > operator to overwrite a file with the output of a command, or the >> operator to append output to an existing file. For example, ls > files.txt saves the list of files into files.txt.
Input Redirection: This uses the < operator to take input from a file instead of the keyboard. For example, sort < data.txt reads the contents of data.txt and sorts them.
Additionally, Error Redirection (using 2>) allows capturing error messages separately from standard output, which is useful for logging purposes.
Write a shell script to find out whether a given year is a leap year or not.
Answer
Sign in to view the complete answer paper.
Explain the process of debugging in shell script.
Answer
Sign in to view the complete answer paper.
Explain the assignment statements used in perl programming.
Answer
Sign in to view the complete answer paper.
Write a program to delete duplicate lines in a file and display the count of lines.
Answer
Sign in to view the complete answer paper.
Explain about the standard I/O functions used in Linux.
Answer
Sign in to view the complete answer paper.
How to find the greatest number given in the array by using perl programming?
Answer
Sign in to view the complete answer paper.
Distinguish between reliable and unreliable signals.
Answer
Sign in to view the complete answer paper.
Explain about the process control.
Answer
Sign in to view the complete answer paper.
Explain about the process attributes in Linux.
Answer
Sign in to view the complete answer paper.
Explain about the signal generation and handling.
Answer
Sign in to view the complete answer paper.
Explain about the IPC between processes on different systems.
Answer
Sign in to view the complete answer paper.
Write a Client program to implement the interprocess communication with system V message queues.
Answer
Sign in to view the complete answer paper.
Explain about the file locking with semaphore.
Answer
Sign in to view the complete answer paper.
Explain about the unix kernel support for shared memory.
Answer
Sign in to view the complete answer paper.