DHA SUFFA UNIVERSITY
Department of Computer Science
Mid Semester Examinations – Fall 2024
COURSE TITLE: Operating Systems Lab COURSE CODE: ___CS-3002L_
Class/ Section : BS-CS-5A Time Allowed: 2 Hours
Course Instructor: __Mr. Afaq Sabghatullah____________ Max Marks: 20
Date of Exam : 11-12-2024
Student’s Name: _____________________ Reg. No: ___________________
Moderated by: ___Miss Huma_
Note/ Instructions: Answer all the questions.
Code: B
Question 1: Basic Linux Commands [5 marks]
1. Create a directory named ExamB.
2. Inside ExamB, create the following:
a. Two files: [Link] and [Link].
b. A subdirectory named Submissions.
c. Move [Link] into the Submissions directory.
d. Delete the [Link] file.
3. List all files and directories in ExamB in long format
4. Create a file named [Link] inside the ExamB directory.
5. Change its permissions so that:
a. The owner has full permissions (read, write, and execute).
b. The group has read and execute permissions.
c. Others have only write permissions.
d. Verify the updated permissions of [Link] using the appropriate command.
Question 2: Write a script that uses nested loops to print a pattern of stars (*) in the form of a pyramid.
[5
marks]
Page 1 of 2
DHA SUFFA UNIVERSITY
Department of Computer Science
Mid Semester Examinations – Fall 2024
Question 3: Write a shell script that does the following: [10 marks]
1. Accepts a number from the user.
2. Provides the user with a menu of options:
Option 1: Check if the number is prime.
Option 2: Display the Fibonacci sequence up to the given number using a recursive function.
Option 3: Exit the program.
Ensure the script uses a case statement for handling the options, and validate that the user inputs a valid positive
integer
Page 2 of 2