KHYBER PUKHTOON KHWA PUBLIC SERVICE COMMISSION,PESHAWAR
SUBJECT:- COMPETITIVE EXAMINATION FOR THE POST OF PROVINCIAL MANAGEMENT SERVICE (BPS-17)-2008
Computer Science
Time allowed: 3 hours
Max marks:100
Attempt total five questions. Attempt atleast one question from each question. Each question carries 20 marks.
Section A
Question No. 1
(A) Suppose we have the following jobs:
Job .. Arrival .. Time Burst Time (milliseconds)
-1
........0
................8
-2
........2
................ 4
-3
........2
................9
-4
........3
................ 5
Find out the average wait time using SJF (Shortest Job First) and RR (Round Robin, with time quantum of 7 millisecond) policies.
(B) What are the necessary conditions for deadlock to occur? Explain briefly.
Question No. 2
(A) What is a process? How it is different from a thread?
(B) What is the difference between uni-programming and multiprogramming?
Question No. 3
(A) Describe OSI seven layers model and brief functions of each layer
(B) What is the difference between LAN, WAN, and Internet? What is the function of Hub, Switch and a Router and at what layer each hardware operates?
Section B
Question No. 4
(A) Write program in C++ to read 10 values in an array (assume that you read all valued positive). Then change each even value in the array with its half value and each value with its double value. After change, count how many are even and how many values are odd. Display this counting.
(B) Write a program to generate the following series
50 40 30 20 10
60 47 34 21 8
70 54 38 22 6
Question No. 5
(A) Write INSERTION Sort algorithm for an array of n elements.
(B) Apply Kruskal's Algorithm to find the Minimum Spanning Tree of the following graph.
Section C
Question No. 6
(A) Normalize the following data up to 3rd Normal Form (3NF)
(B) Define the following keys.
Primary Key
Unique Key
Composite Key
Question No. 7
(A) The window has (Wl, Wr, Wb, Wt) = (10, 20, 15, 40). Viewport has (Vl, Vr, Vb, Vt) = (40, 300, 80, 400). If p(12, 25) lies on window, find the corresponding point p' (x' , y') on viewport.
(8) Given a point P (10, 10), rotate this point around Q (5, 5) at 90 degree. What will be the new point?