Professional Documents
Culture Documents
19CSE35
Using the error status codes of APls, explain all the values of the global variable errmo that 12 CO1
could be applied.
OR
2a) Explain the efects caused by the various feature test macros if defined in the system L2 CO1
b) Explain the salient features of Unix Os L2 COI
Module 2
a) ustrate with example about the diferent categories of files and show how they can be CO2
created and deleted
bWhen the command ls -l is executed on a file atxt,the following output was obtained L3 CO2
dev 16 Aug 6 12:43 atxt
w-w cse
Apply the necessary commands which will give the following output
rwxrw-2 ise testing 18 Oct 16:40 a.txt
OR
4a)lustratewith necessary commands how to ensure that all fles created by users will have L3 CO2
the command to do this
thedefault permissions rwfApply your knowiedge identify
Kind ot modification with proper explanation of
to
the sgnificance of the identified
commands
b na directory called progs,with permission string as drwxr-xr-x,the following command is 10 L3 co2
executed in sequence
chmod a-t progs
Is progs
ca progs
Which all commands throw an error?Justify your answer with proper explanation
Module 3
Analyze the generic set of APls that can be used to manipulate more than one type of files 10 L4 CO3
L4 CO3
Analyze how to use access modifier flags with the access mode flags to alier the access
mechanism of the file using open function.
Examine the importance of fentl APl with the possible cmd values and also explain how co3
the control of a file can
access
changed
Page2
2of 2
19CSE35
OR
6a) Analyze how to create the block device file named /dev/bdsk with major and minor device L4 CO3
b)
numbers of 287 and 101respectively with all permission for everyone
Analyze how the locking files is done in Unix system. Why advisory locksare safe. And L4 c03
also explain about the APl which is used to lockthe files
)Interpret how the mv command can be emulated using the link and unlink APL L4 CO3
Module 4
Ta) Evaluate the use of appropriate Unix utility and filter commands which will help to list the 8 L5 CO4
dates of all Sundays of October 2020.
b) Two club events 'Code Clash' and Code Freeze' were organized in the college. Students L5 CO4
rom vanious sections participated in the events, Evaluate how the appropriate Unix filter
commands can be used to list out only those students who attended both the events.
)Determine the usage of filter commands for the following operations 8 L5 CO4
i) To convert the contents of the tile foo.txt to uppercase
ii) To find out the number of directory files in the current directory.
ii) To find the number of files in the current directory
OR
8a) Evalunte the usage of extended regular expression with appropriate examples L5 CO4
b) Evaluate the advantages of vfork ) over fork() system call. 4 L5 CO4
Determine the ways of running jobs in the background and also to sehedule a mail to be 8 L5 Co4
sent every Sunday at 9 am to clubhouse.
Module 5
9a) Evalute the usage of awk built in functions with suitable examples
L5 CO5,
C06
b) Deduce logic to write a shell script program which will check if the group user has read and 7 L5 CO5,
write permission for a file accepted as command line argument. Display appropriate error
CO6
messages.
c)Determine the logic to write a shell script which will check if a given file is a symbolic link
L5 CO5,
file or hard linked file. Display appropriate messages. C06
OR
103) Evaluate the usage of awk built in variables with suitable examples. L5 CO5,
CO6
b) Cho0se an appropriate logic to write a shell script program which will accept a number n
7 L5
from the user and prints the square and cube of that number
3
c)Deduce logic to write a shell script which emulates the working ofa simple calculator to
L5 CO5,
perform simple arithmetic operations.
CO6
Page 2 of 2
USN 19CSE35
Module 1
I a) Discuss the different POSIX versions available on the machine with the help of a C program. Coi
b) Explain the architecture of UNIX operating system by specifying the separate roles of the cOL
Kermet and the shell
OR
a) DEscuss the teatures of UNDX operating system. 10 L2 COI
b) Esplain the following parameters with the help of a POSIX complaint CC program, Number of L2 COI
clock ticks, Maximum number of child processes, Maximum path length, Maximum number
of characters in a file name and Maximum number of open files or
processes.
Module 2
3a) Solve the following dilemma of Alice with relevant examples where she wants to know L3 C02
t h e current working directory
i) display the encrypted passwords of users in the
system
C h a n g e the permission ot a fie atat to -rw-rwusing absloute permissions
d i s p l a y the inode number of a tie a.txt
change the modified time to October 2
b)lustrate with the help of example the output of ls-I emphasizing on each field. 10 L3 CO2
OR
4a) 1lustrate the creation of the following tree structure. A directory USP" created inside root L3 cO2
Inside which are 3 subdirectories "CSE, 1SE. "MECH. Subdirectory CSE' is divided into
A. "B and C. Creation of the above hierarchy has to be done using absolute pathname
'A" from
only. Navigate to subdirectory
and
rootcreated absoluteinpathname
using
b)
Deleteall the directories subdirectories
Given ls-li abe.tt the output is displayed as
by you a single step.
10 13 CO2
2221313-rw-rw-1becse 10 Oct02 10:30 foo.txt
Solve with the help of output and the inode number, the following scenarios
s-li foo
n to0.at fool.txt;
In-s foo.Ixt foo2.txt; Is -i
foo
Module S
Analyze any 5 functions defined for directory file functions defined in <dirent.h> or 10 L4 CO3
sys/dir.h> eaders
6 L4 CO3
Analyze the role of the operating system to enable the change of ownership for the user with
the help of chown APl by writing a C program which takes 2 arguments:user name.pathname
of file and emulates the working of chown system call.
L4 CO3
9Examine the role
offcntl API be used toset amandatory lock
can
permission at an offset of S12 to a length of 1024 bytes.
on a fle for read
Page 2 of 2
19CSE35
OR
6a) Devise a strategy to emulate the mv command using link and unlink APl L4 cO3
b) Analyze the working of FIFO files. Devise a C program that illustrates the use of mknod, 6 L4 CO3
open, read, write and close APls on a block device file
Interpret the role of acess mode flags along with acess modifier flags in the open API L4 cO3
Module 4
7a) Determine the usage of filter commands for the following operations 5 CO4
ito convert the words director in atxt to uppercase
ito find out the number of directory files in the current directory.
ii) to find the number of files in the curent directory
iv)To display following fields of a file: the type and pemission,link count of the file and the
owner ot the file.
b) Evaluate the working on commands difi, cmp, comm with respect to file comparison with LS co4
proper examples.
CO4
Evaluate the commands fork) and vforkO) with examples.
OR
a) Evaluate the different ways of running the jobs in the background CO4
b) There is a file called 'sample" which contains repeated information. Evaluate how the LS CO4
on the
intormation with proper examples.
oowing commands wok
)
sort-u of an audit every sunday at 10am.
A mail has to be sent to Mr.Haris to remind LS CO4
him
Evaluate how the cron command can be used for the same with proper explanation.
Module 5
9a) Interpret the usage of awk built in variables with suitable examples LS COS,
CO6
b) Evaluate the usage of BEGIN and END sections in awk. Devisea small awk program which LS CO5,
will compute the average marks in a file called student. txt with the fields as USN, Name CO6
And Marks, with the delimiter as " used in the file
shell script program to evaluate the while and wait using sieep 0 L5 CO5,
)Design
unction
a
working of CO6
OR
10a) Examine the usage of awk built in functions with suitable examples L5 CO5,
c06
b) Compare the various sources of list which can be used in a for loop in shell script. L5 cO5
c06
Justify how the awk command can be formulated which will enable us to count the number 7 L5 COs,
of managers present in a file called emp.lst which has the following fields in order CO6
EMP idem Name.Designation,Department,DateofJoin, Salary.The delimiter used in the file is
Page 2 of 2
19CSE35
New Horizon College of Engineering, Bangalore
Autonomous College affiliated to VTU, Accredited by NAAC with A' Girade & NBA
Supplementary Semester
End Examination October 2020
UNIX SYSTEM PROGRAMMING
Duration: 3 hrs Max. Marks: 100
Answer five full questions choosing one complete question from each module.
R
2a) Explain the common characteristics of API along with erTOr status 6
codes and their
meaning
L2
co
b) Write a POSIX complaint C program to explain follow ing limits at 6
runtime:
L2
CO
i) No. of clock ticks (i) Max. no. of child processes
(ii) Max. path length (iv) Max. no. of characters in a file name ()
e)
Max. no. of open files/ process
Summarize on the division of labor concept adopted in the UNIX
architecture win a necar
L2
cO
dagran Module 2
3a)
b)
ldentify the fields when execute the command Is
different
Identify the purpose of following commands
we
L3
CO2
C02
i) tput ii )calender ii) who iv)uname vxty
) h e output obtained on executing the command s too.txt is as 8 L3 CO2
follows.
rw-rw- Charlie Charlie 80 Aug 10 10:30 a.txt
Apply your knowledge on file commands and list
which will update the output of lstoo.txt output as tolows.
out the commands
rwxrw-r-x 2 John Sam 80 Sep 25 11:30 a.bxt.
R
4 a) lustrate the different types of files in UNIX SYSTEM. L3 cO2
e)ldentify the differences between soft and hard links. Apply your L CO2
knowledge on soft and hard links to explain the output of the given
command
Given Is-i 1oo.txt
a
2221313-rw-rw-rI John John 10 Aug 25 10:30 foo.txt
fool.txt ls -li foo"
) ln foo.txt
i) n -s foo.txt foo2.txt; Is-li foo
Page
elots
19CSE35
Module 3
5a) Analyze the impotant uses of fcnti API. Give its prototype 10 L4 CO3
description. Examine how we can use the APl in a C program to
check
if it is whether
not
the close.on_exec lag is set for a given
set, toset
ile, foo and
this lag
D) Analyze the working of fork system call with examples. Write a C 6 L4 CO3
program to illustrate the purpose of fork system call.
OR
6a) it
na certan application is requied to set a mandatory exclusive lock
on a tile, foo trom the position 50 to l00 from the starting of the file.
10 L4 CO3
it is has
Before setting the lock required check if any other process
to
) Analyze the APls used for creating opening reading rewinding 4 L4 CO3
and closing directories
Module 4
7a) Detcrmine theUNIX kernel support for process considering parent 8 L5 cO4
child the
process. Choose related data structure required.
b) Assess different forms of exec system call. Explain their prototype 4 L5 c4
also their purpose.
el Mal the -i and and L5 CO4
the
command with options-v, -n,
usca
-c
wilh the
bove options on the
options on m p lst
the eemp.lst file
file w
whose cOntents are
gen
2233:Charles:Manager:
86 72Bill:Director:production
5678: Robert:Manager:marketing
1006:Michaeldirector:marketing
0110:Julie:DIRECTOR:sales
OR
8a) Evaluate the APls that can be used by a parent process to wait for the 8 L5 CO4
child process. Explain their prototype and provIde comparison.
b) Determine and evaluate the commands that can be used to perform 4 LS cO4
he following
Running jobs in the background
c)
)ENeCute Jobs later
Consider a tile named studentdetails.txt. The contents of the file are as 8 LS CO4
tollows with field I thcir USN.2
field their name.3 the department and
4 of
the their date birth and the 5 field their rank
233 Manjunatha| cse |12/129209
602 (GauraV gUp Og 61
678| sumit chakrobarty | ece|19/04.92 61
Page 2 of 3
19CSE35
OR
10a) Examine the significance and importance of test statement in shell L5 CO5,
programming CO6
b) Evaluate a menu driven shell script perform the following tasks usin 7 L5
Case conditional statement COS,
CO6
i) list of users who are logged in
i) list of files in the current directory
Page 3 of 3
19CSE35
macros.
) S h o w the POSIX defined configuration options supported * 2 cOI
examples.
Module 2
3a) lustrate different calegories of files and show how they 13 cO2
can be crealed and deleted with an example outpu.
bAssume the file fun.txt is created by cat command with L3 CO2
the content "This is an example text file " and its default
OR 14 CO3
o) Justify the APl(with prototype and return value) which is
used to
i) Create the block device filc namcd /dev/bdsk with
major and minor device numbers of 287 and
10lrespectively with all permission for everyone
ii) Establish a connection between a proccss and a file
iii) Create a new regular files
iv) The cxistence and access permission of user to a
named file.
v) Deletes a link of an existing file 6 L4 C03
DAnalyze the fentl API for locking the record with the
explanation of struct flock lyped variablec L4 co3
Examine stat, fstat and Istat APls with their prototype and
return valuc.
Module 4
8
)How would you create the child process usinge program.
Justily your answer with proper explanation and output.
DChoose the command which will display he process L O
status along with system and user process. And also
Page 4 of 4
US CSE35
iv) stty OR
2 a) What s division of labor concept adopted in the UNIX architecture with a neat u co1
diagram.
b) Write UNIX command structure explaining the purpose of options and arguments co1
c) Write the syntax of following commands with options for each 8 LI cOL
) date ) lock i) script iv) pwd
Module 2
3 a) Explain along with a block diagram the three modes of vi and explain how you can C04
SwIch rrom one mode to another.
b Explain the search and replace function in vi editor with suitable examples. 6 L2 co2
with
)EXplain the UNIX commands in detail options used for performing the following
the cursor at row 12, column 25
8 L2 co2
clearing
i) knowingthe screen
your and placing
environment
the
in) finding out decimal equivalent of 1101001
the current date in the form
Display dd/mm/yyyy
the difference between internal and external commands with suitable
4 a)Summarize
exampies
6 2 co2
b)Summarize the following concepts in vi together with the commands used 6 2 COz
Insertion or text
Appending the text
ii) Replacing of text
c) Explain the purpose of following vi editor commands 2 cO2
3b li) Sw i) ^
iv) S v) x Sdd
vi) j vil) vii)odule
u
s a) ldentity the differences between hard link and symbolic link. Using Is command how 10 L3 co2
we can retrieve all soft links in t
b) Current permissions on a file named unix is given by the permission string r w-- w 6 L3 co2
r Identify the chmod symbolic and octal representations required for
the permissions to the updated string
changing
rr****
c)
11r wxrw X X
Identify the UNIX Commands required for 4 co2
relationship in UNIX and also the importance and purpose of each of the directories.
b) lGiven th compute the co2
7a)
Module 4
Examine the following commands with syntax and examples s L4co
c u t ) paste il) sort iv) u
b) Apply the UNIX commands to perform the following actions cO
) To change the case of first three lines of file "shortlist" from lower to upper cO4
) To count the number of characters in the first line of the file "shortlist"
C)Examine the grep command with the options-v, n , i and-C. Derive the output 4co
command is used with the above options on the emp.lst file
generated when grep
whose contents are given
2233:Charles:Manager: sales
9867:Bill:Director:production
5678:Robert:Manager:marketing
1006:Michael:director:marketing
0110:Julie:DIRECTOR:sales
OR
8 a) Examine the following commands with syntax and examples
CExamine the concepts of line addressing and context addressing in sed with B L4 co3
co4
examples
Module 5
9 a) $1, and $? in
Analyze the shell parameters $, $#,
the command
$0, UNIX. Discuss the values of L4
cOs
these variables for given
S test unix shell programming.
D ) w r i t e a shell program that will do the following tasks in order with suitable 7 L4 Cos
bExaminethe signitficance of BEGIN and END section in an awk program with help of 7 L4 cos
an example cO6
Page 2 of 2
ISE35/CSE35
Answer five full questions choosing one complete question from each module.
Module 1
1 a) Explain system calls and the role of system administrator in UNIX 10
co
machine
b) Analyze the division of labour between shell and kernel. COl
OR
3Discuss the different modes of vi editor. Explain with a neat diagram CO2
)
b) Dlscuss with examples deleting, yanking and changing of text. CO2
Page 1 of 2
ISE35/CSE35
OR
6 Assuming that files current permission is r w - r - x r , solve the chmod 10 CO2
expression using both octal and symbolic method without using
required to change the permission of a file foo.txt to
rwxrwxrwx i) r- r i)---r-r
OR
Given a file ,what will be the output of the following commands 8 L4 CO3, cO4
Page 2 of 2