0% found this document useful (0 votes)
42 views15 pages

CSC203 Practical Exercise

This document provides instructions for a practical exercise on operating system commands. It outlines 23 scripts to practice initializing variables, arrays, hash tables, file input/output, loops, and algorithms. Students are asked to create a folder to store their work, run the examples, and save their files on their system or smartphone. The final exercise asks students to write PowerShell programs implementing shortest job first and round robin CPU scheduling algorithms.

Uploaded by

sadiq ibrahim
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)
42 views15 pages

CSC203 Practical Exercise

This document provides instructions for a practical exercise on operating system commands. It outlines 23 scripts to practice initializing variables, arrays, hash tables, file input/output, loops, and algorithms. Students are asked to create a folder to store their work, run the examples, and save their files on their system or smartphone. The final exercise asks students to write PowerShell programs implementing shortest job first and round robin CPU scheduling algorithms.

Uploaded by

sadiq ibrahim
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/ 15

OPERATING SYSTEM PRACTICAL (CSC203 ) Mrs Hajara Idris

CSC203 PRACTICAL EXERCISE

(Continuation from the last class)


Recap: You are now familiar with the following commands:
CLS
DIR
CD\
CD..
MD
DEL
REMOVE-ITEM
NEW-ITEM
COPY-ITEM
MOVE-ITEM
START NOTEPAD
START CALC
START WINWORD.EXE
START EXCEL.EXE
START POWERPNT.EXE
LOADING OF MICROSOFT WORD FROM THE ROOT FILE

This is a continuation of our previous practical class. All are examples except the last exercise.
The exercise is to test your understanding of this course so far. You would be required to practice
all the given examples yourself. Your task is to create a folder to store all your work in it, run all
the examples, and save them on your system/smartphone. The examples are to enable you to master
the practical and know what each command function does in the script.
Each student must use his/her laptop or phone file directories (path filename), to avoid having
the same path file name (Ex. My file path is “C:\Users\Hajara”). No allocations of marks will
be awarded to students with the same path file name because this is not a group task.
Use Windows PowerShell ISE & Windows PowerShell to run the following scripts.
For each task, the numbering should be as given below to enable easy access for grading.
Our first task is to initialize variables name. A variable name is a named memory location used
to store values: for example : Name =’Amina’ # string variable name. the variable
name in the ex. is “Name” and it is a string datatype.
String variable name is enclosed with double quotations marks (“ ”) or single quotation (‘ ‘)
as given in (‘Amina’)
$a=34, $b=45 # int variable name. the Ex has given; $a and $b are variable names. But are
int datatype.
The use of ‘#’ symbol above indicates ‘comment’, It was used in the scripts below.
Script 1: initializing int variable name and sum the variables

1
OPERATING SYSTEM PRACTICAL (CSC203 ) Mrs Hajara Idris

Script 2: initializing string variables name $University and output the contents

2
OPERATING SYSTEM PRACTICAL (CSC203 ) Mrs Hajara Idris

Script 3: initializing two string variables name and display

Script 4: Array variables:

Array is a list of variables or more than one variables.

The values in an array can be accessed using index[0] : first value , index[1] : second value etc

3
OPERATING SYSTEM PRACTICAL (CSC203 ) Mrs Hajara Idris
Script 5: Hash Table or Dictionary

syntax for hash table : @{ “Name ”: value ; “Name1 ”: value }

A key-value pairs

Script 6: Hash Table

4
OPERATING SYSTEM PRACTICAL (CSC203 ) Mrs Hajara Idris

Script 7: “write-host” what does “write-host” do? Find out.

Script 8: ‘new-item’ this is familiar, right?

Script 9: test-path what does “test-path” do? Find out. ?

5
OPERATING SYSTEM PRACTICAL (CSC203 ) Mrs Hajara Idris

Script 10: ‘rename-item’ ‘ csc203’ what does rename-item do? What is the current file name?

6
OPERATING SYSTEM PRACTICAL (CSC203 ) Mrs Hajara Idris

Script 11: set-content find out what is the set-content command?

Creat

Script 12: create a new file ‘ CompSc.txt ‘ and check if the file exist

Script 13: After creating the file Compsc.txt, write to the file

7
OPERATING SYSTEM PRACTICAL (CSC203 ) Mrs Hajara Idris

Script 14: After writing to file Compsc.txt, add more content to it. What command will be used?

Script 15: check the date and time on the system. What is the command for it?

8
OPERATING SYSTEM PRACTICAL (CSC203 ) Mrs Hajara Idris

Script 16: change the date and time. What is the command for it? Apart from changing the date, what other
functions there are?

9
OPERATING SYSTEM PRACTICAL (CSC203 ) Mrs Hajara Idris

Script 17: view or read the content of the file CompSc.txt you created earlier.

Script 18: what is the Command for greater than (>)

10
OPERATING SYSTEM PRACTICAL (CSC203 ) Mrs Hajara Idris
Script 19: what is the Command for less than (<), equal (==) , not equal to (!= ) , less than or equal to (<= )

Script 20: for loop

1000, 2000, 3000, divide each one of them by 5

1000, 2000, 3000, multiply each one of them by 600

11
OPERATING SYSTEM PRACTICAL (CSC203 ) Mrs Hajara Idris
Script 21: Calculate area of a cirlce

Script 22: Calculate area of a circle, the user will be required to input a value for radius

What iis the command to enable input from user?

12
OPERATING SYSTEM PRACTICAL (CSC203 ) Mrs Hajara Idris

Script 23: First come first serve algorithm

Take your time to understand the code.

13
OPERATING SYSTEM PRACTICAL (CSC203 ) Mrs Hajara Idris

14
OPERATING SYSTEM PRACTICAL (CSC203 ) Mrs Hajara Idris

Exercise

Using the processes given in Ex. script 23, Write a program using PowerShell to implement a CPU
scheduling algorithm using :

(a) Shortest job first (SJF)


(b) Round Robin

Create a filename ‘Exercise’ and save the program code. You can look into the practical manual
II for more guides.

Best of luck

15

You might also like