Name of the Student: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Scholar No.:_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
MAULANA AZAD NATIONAL INSTITUTE OF TECHNOLOGY, BHOPAL
DEPARTMENT OF CSE
End Term Exam, 19 June 2020 (Supplementary Exam)
Course: B.Tech Semester: VI Branch: CSE-I/CSE-II
Subject Name: Unix Internal & Shell Programming Subject Code: CSE 354
Time: 03:00 PM– 05:00 PM Max. Marks: 30
Note: i. Attempt all questions.
ii. Draw suitable diagram or take example, if required for explanation.
S.NO Questions Marks
Q1 Write proper commands for following cases: 5
a) How print only count of files in current directories?
b) Write basic regular expression to string of exact 5 characters including “P” or “p” in mid place?
c) For any file, how to revoke all permissions from all users in absolute manner?
d) For command ls –l <file name> , if file doesn’t exists then how to catch error message in a other
file?
e) Write symbols of extended regular expression which are not available in basic regular
expression, also write their definition.
Q2 a) Explain field wise information stored in etc/passwd file? 2
b) Design a filter to print file name, size, number of links, inode number of all files present in 3
current directory. (must follow the sequence for print as mentioned)
Q3 File named as “sample.txt” contains following data, column wise (name of students, subject, 5
marks), Data inside file:
Amit:Unix:50
Ruchi:Unix:40
Sumit:DBMS:45
Rupa:OS:67
Write awk script to print marks of students whose name starts with “R” and subject is “Unix”,
print all rows in following manner:
<subject> passed by <student name> with <marks> out of 100.
Also describe how to execute the above script.
Q4 Explain how sleep and awake state of processes are dependent to lock and unlock status of 5
buffers? Create a well defined scenario with multiple processes for explanation.
Q5 Calculate the maximum file size in exact memory units (MB), write all the steps 5
of calculations
i) Block size = 128 byte, address size = 16 bit, number of direct block = 2, number of single
indirect block = 2, number of double indirect =2
ii) Block size = 256 byte, address size = 16 bit, number of direct block = 2, number of single
indirect block = 1, number of double indirect =1, number of triple indirect =2
Q6 Explain in details output of program and also explain in detail each system call used. (Take 5
assumptions if required),
#include<stdio.h>
int main( )
{
for(int i=0; i<3; i++)
{
if(fork( ) == 0)
{
printf(" %d %d\n", getpid( ), getppid( ));
}
}
}
---***End***---