0% found this document useful (0 votes)
17 views6 pages

Mock Exam Paper Linux

The document is a mock examination for a Web Development and Operating Systems module, consisting of multiple-choice questions, basic Linux questions, shell scripting tasks, and a discussion on the advantages of Linux over Windows for servers. It covers topics such as Linux commands, file permissions, directory management, and scripting. The exam is structured to assess knowledge in Linux operating systems within a one-hour time frame.

Uploaded by

imanailham543
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views6 pages

Mock Exam Paper Linux

The document is a mock examination for a Web Development and Operating Systems module, consisting of multiple-choice questions, basic Linux questions, shell scripting tasks, and a discussion on the advantages of Linux over Windows for servers. It covers topics such as Linux commands, file permissions, directory management, and scripting. The exam is structured to assess knowledge in Linux operating systems within a one-hour time frame.

Uploaded by

imanailham543
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Mock Examination

Module-Web Development and Operating Systems


Time-1 hour

Question 01 ~ Linux MCQ questions (10 marks - each question carries 1 mark)

Note: Multiple answers are possible for some questions and in that case ‘select all that apply’
quotation is there. If a question has multiple answers, all correct answers must be selected to
be awarded marks.

1. The top-level directory on a Linux system is represented as _______ ?


a. *
b. /
c. $
d. ~
e. #
2. find / -name ‘*’ command will ____________.
a. List all files and directories in / directory.
b. List all files in / directory
c. List all files in / directory contains a * in the file name
d. List all files and directories recursively starting from /
e. List all directories in / directory
3. What permissions are set on a directory with the command chmod 527
mydirectory?
a. -rw-r-xrwx
b. d-wxr-xrwx
c. dr-x-w-rwx
d. -rwxrw—x
e. drw-r-xr–
4. What command would you type (as root) to change the ownership of somefile.txt
from ralph to tony?
a. chown ralph:tony somefile.txt
b. chmod somefile.txt tony
c. chown ralph somefile.txt tony
d. chown tony somefile.txt
e. chmod tony somefile.txt
5. Which of the following commands is the correct way to append “foo” in /temp/bar
file? (select all that apply)
a. /tmp/bar < echo foo
b. echo foo >> /tmp/bar
c. echo foo | /tmp/bar
d. echo foo > /tmp/bar
e. echo foo 1>> /tmp/bar
Mock Examination
Module-Web Development and Operating Systems
Time-1 hour

6. Which command is used to assign read-write permission to the owner of a file called
mytext.txt?
a. chmod og-r mytext.txt
b. chmod a+r mytext.txt
c. chmod o+r mytext.txt
d. chmod o+rw mytext.txt
e. chmod u=rw mytext.txt
7. What is the numerical value for "read" permission in Linux?
a. 1
b. 2
c. 4
d. 0
8. How do you remove a directory in Linux and its contents?
a. rmdir
b. rm -rf
c. delete
d. erase
9. How would you list all files, including hidden ones, in a directory using ls?
a. ls -a
b. ls -l
c. ls -h
d. ls -R
10. To move up one directory level, which command would you use?
a. cd ..
b. cd –
c. cd /
d. cd ~
Mock Examination
Module-Web Development and Operating Systems
Time-1 hour

Question 02 ~ Basic Linux Questions(10 marks)

1. What is the purpose of a bootloader in Linux operating systems? What is the


bootloader name of popular OS Ubuntu? [2 marks]
2. Briefly explain what each of the following Linux commands do. [4 marks]
a. grep “testuser” /etc/passwd
b. sudo chown testuser myfile.txt
c. find /usr/share -name *.txt
d. whoami > username.txt
3. Ishan is a software engineering intern. He has a computer with a Linux OS. He wants
to create the following directories and file hierarchy in his computer to manage his
work easily.

In the above diagram an oval shape represents a directory, and a rectangle represents a file.
You can assume that Ishan has logged in as the root user and now he is in the root directory.
If he enters the ‘ls’ command, he can see the following result.

As you can see, initially the ‘Introduction to ML.pdf’ file is in the root directory. Also, the
dotted rectangle means nothing exists there and in the later part of this question, it will
come to play.
Mock Examination
Module-Web Development and Operating Systems
Time-1 hour

a. Write all the commands step by step which are required to create the above
directories and file hierarchy. Please note that when you create the above file
system always you should stay in the root directory (i.e you should not
navigate to newly created directories using cd command) [5 marks]

b. Let’s say now Ishan wants to move the ‘Introduction to ML.pdf’ file to the
location of the dotted rectangle. Write down the required command to do
that. [1 mark]
Mock Examination
Module-Web Development and Operating Systems
Time-1 hour

Question 03 ~ Shell Scripting (10 marks)

1. Write a bash script to generate first 5 even numbers using a while loop. (0 is not an
even number) [02 Marks]
2.
a. You are tasked with creating a simple ticket price displaying system for an
event. The script should show available ticket types to the users and prompt a
message to select a ticket type to view its price. (You need to use if statements
for this without any functions.) Refer the below information to create your
script. [04 Marks]

Ticket Types Price


Standard – A Rs. 1000
Standard – B Rs. 1500
Premium Rs. 2500
VIP Rs. 5000

b. Modify above script to have two functions called display_tickets and


display_price. Call this function within the script to get the output. Full script is
needed. [04 Marks]
Mock Examination
Module-Web Development and Operating Systems
Time-1 hour

Question 04 ~ Identifying the usage of Linux (10 marks)

Briefly explain why some Linux distros are better than Windows for servers. You should
present at least six (04) different aspects to justify your answer. [10 marks]

You might also like