# Bca Cs-63

Topics: Windows XP, Windows Vista, Windows 2000 Pages: 9 (1608 words) Published: September 9, 2013
ca cs-63-------------------------------------------------
CS-63 Solved Assignment 2012
-------------------------------------------------
Presented by http://www.myignou.in
-------------------------------------------------

Course Code:CS-63
Course Title: Introduction to System Software
Assignment Number:BCA (3)-63/Assignment/2012
Maximum Marks:25
Last Date of Submission:30th April, 2012/30th October, 2012

There are seven questions in this Assignment. Answer all the questions. You may use illustrations and diagrams to enhance explanation.

1) Consider the following set of processes that arrive in the ready queue at the same time:

Process CPU time
P1 2
P2 5
P3 2
P4 1
P5 4

Consider the following scheduling algorithms:

First Come First Serve (FCFS), Shortest job first (SJF) and Round Robin (quantum = 1) What is the turnaround time of each process for each of the above scheduling algorithms? What is the waiting time of each process for each of the above scheduling algorithms? (3 Marks)

ANS:-FCFS (first come first serve)
Process| CPU time| Waiting time| Turn around time=CPU time+w.t| P1| 2| 0| 2|
P2| 5| 2| 7|
P3| 2| 7| 9|
P4| 1| 9| 10|
P5| 4| 10| 14|
TOTAL| 14| 28| 42|

Average waiting time=28/5=5.6
Average turn@time=42/5=8.4

SJS(Shrtage job first)

Process| CPU time| Waiting time| Turn around time=CPU time+w.t| P1| 1| 0| 1|
P2| 2| 1| 3|
P3| 2| 3| 5|
P4| 4| 7| 11|
P5| 5| 13| 18|
TOTAL| 14| 24| 38|
Average waiting time=24/5=4.8
Average turn@time=38/5=7.6

Round robin scheduling, quantum=1
Process| CPU time| Waiting time| Turn around time=CPU time+w.t| P1| 2| 4| 6 |
P2| 5| 9| 14 |
P3| 2| 6| 8 |
P4| 1| 3| 4|
P5| 4| 9| 13 |
TOTAL| 14| 31| 45 |
Average waiting time=31/5=6.2
-------------------------------------------------
Average turn@time=45/5=9
-------------------------------------------------

2)Write a shell program to convert a decimal number to its hexadecimal equivalent. -------------------------------------------------
(4 Marks)

ANS:- clear
echo “ enter the binary number which you want to convert” read bin
binary=\$bin;
while[\$bin –gt 0]
do
result=`expr \$bin % 10000`
bin=`expr \$bin / 10000`
dec=0
i=1
while[\$result –gt 0]
do
b=`expr \$result % 10`
dec=`expr \$dec + \$b \* \$i`
result=`expr \$result / 10`
i=`expr \$i \* 2`
done
if[\$dec –ge 0 –a \$dec –le 9]
then
dec1=\$dec
slif[\$dec –eq 10]
then
char=”A”
elif[\$dec –eq 11]
then
char=”B”
elif[\$dec –eq 12]
then
char=”C”
elif[\$dec –eq 13]
then
char=”D”
elif[\$dec –eq 14]
then
char=”E”
elif[\$dec –eq 15]
then
char=”F”
fi
hex=\$char\$hex
done
echo “the binary \$binary number after convert into hexa \$hex”

-------------------------------------------------
3) Construct Context Free Grammar for the “While” and “Switch” Statement of C Language. (4 Marks)

Ans:-WHILE loop: -
The general form of which is as shown below:
While control command
do
Command 1
Command 1
done

Example
\$vi
count=1
while[\$count -le 5]
do
echo”\$count”
count=`expr \$i + 1`
done
press esc+:wq (save and quit from vi editor) after that we have to run the programe \$sh count

Switch:-
Switch ? option? String pattern body pattern? Pattern body…? The switch command is the direct analog of the unixshell case satatement and the c switch. The general form of the case control instruction is given belw:- Case value in

Choice1)
do this a
and this

Choice2)...