RIPHAH INTERNATIONAL UNIVERSITY, LAHORE CAMPUS
FC, Department of Computing (CS)
Mid Term – LAB Paper: Operating
System (OS)
Instructor: Rana Marwat Hussain
Name # _________________________ CMS/SAP #_____________ Signature#______________________
Note: (A) Attempt all Questions.
(B) List down all the commands and
code in the doc file and submit for grading on the Link Below.
(C) Please include all the code and outputs in one file you can submit only doc. or PDF with your name and CMS/Sap# (mandatory).
Q1. Perform Given Task Using Linux Terminal
only: (8 Marks)
1.
Create
directory midterm_exam in Downloads folder.
2.
Create another
directory name it as filnal_destination in the midterm_exam.
3.
Create text
file name it as midterm.txt in the final_destination and write your name and
lab name in it.
4.
Create file
named as printall.txt and write it using command line after writing it print
this file’s content on the cmd/terminal.
5.
Move
printall.txt file and midterm.txt.
6.
Remove
midterm_exam directory and all the containing files.
7.
Update the
printall.txt file with your personal information.
8.
List down all
the files containing by current working directory.
9.
Print the
current working directory’s path.
10. Write a command for search pattern in the text
file.
11. Write command to Count the word of the file.
12. Write a command to print text on cmd per
page.
13. Print all the process status on the cmd.
14. Write command for process kill.
15. file extension of the compile c file in Linux.
Q2. Write output of the code if you find any
error just state it below: (2
Marks)
1.
1 int main( )
2 {
3 int
identity=0;
4
identity=fork();
5
if(identity==0)
6 {
7 Char
*string[]={“ali”,”khan”,NULL};
8 printf(“
All the String elements on the screen %s”,string);
9 }
10 else
11 {
12 printf(“Parents
are always there for you”);
13 }
14 return
0;
15 }
2.
int main( ) (2 Marks)
{
int
identity=0,twins=0;
Char
*s[]={“Rana”,”Marwat”,”Hussain”,NULL};
identity=fork();
if(identity==0)
{
printf(“
All the String elements on the screen %s”,string);
twins=fork();
}
else
{
printf(“Parents
are always there for you”);
}
return
0;
}
Output:
(5 Marks)
Q3. Write a program which print the string “I’m
form other program” name it otherporgam.c. write another program which run the
binary of the otherprogram.c with the arguments list {“Class”,”OS”,NULL}.
Post a Comment