CSC203 Practical Exercise
CSC203 Practical Exercise
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
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
A key-value pairs
4
OPERATING SYSTEM PRACTICAL (CSC203 ) Mrs Hajara Idris
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
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.
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 (<= )
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
12
OPERATING SYSTEM PRACTICAL (CSC203 ) Mrs Hajara Idris
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 :
Create a filename ‘Exercise’ and save the program code. You can look into the practical manual
II for more guides.
Best of luck
15