Notifications
Clear all

CSS Computer Science Paper 2022

(@zarnishayat)
Member Moderator

FEDERAL PUBLIC SERVICE COMMISSION
COMPETITIVE EXAMINATION FOR RECRUITMENT TO POSTS
IN BPS-17 UNDER THE FEDERAL GOVERNMENT, 2022

COMPUTER SCIENCE, PAPER-I

TIME ALLOWED: THREE HOURS

PART-I (MCQS): MAXIMUM 30 MINUTES
PART-I (MCQS) MAXIMUM MARKS = 20
PART-II MAXIMUM MARKS = 80

NOTE

(i) Part-II is to be attempted on the separate Answer Book.

(ii) Attempt ONLY FOUR questions from PART-II by selecting TWO questions from EACH SECTION. All questions carry equal marks.

(iii) All parts of each question must be attempted at one place.

(iv) Write the question number in the Answer Book according to the question paper.

(v) No page or space should be left blank between answers. All blank pages must be crossed.

(vi) Extra attempts of any question or any part of an attempted question will not be considered.

PART-II
SECTION-A

Q. 2

(a) Using C++, write a function pattern(int n) that produces the specified pattern. Pay particular attention to spacing and clearly state the function's return type. The solution should work for any input value of n. (8)

(b) Differentiate between the following fields:

  • Computer Science
  • Software Engineering
  • Information Technology
  • Information Systems
  • Computer Engineering
  • Bioinformatics

(6)

(c) Determine the output of the given C++ code involving an integer array and pointer arithmetic:

 
 
int ary[4] = {1,2,3,4};
int *p1 = ary + 3;
cout << p1[-2] << endl;
int *p2 = &p1[-2];
*p2 = 10;
cout << ary[1] << endl;
 

(6)

Q. 3

(a) Complete the given C++ function to find the number of distinct elements in an array in O(n) time. The array elements are within the range [1, 100], and n is significantly greater than 100. For example, the array {3,1,3,8,2,1,8,2} contains four distinct elements: {1,2,3,8}. (8)

(b) Write a detailed note on the principles of Information Security and Privacy. (6)

(c) Determine the output of the following C++ code:

 
 
int v1 = 55;
int* p1 = &v1;
int* p2;
p2 = p1;
*p1 = 20;
cout << *p2 << endl;
cout << v1 << endl;
 

(6)

Q. 4

(a) Write a C++ program to determine whether a string is a palindrome or not. The string must be taken from the user using cin.getline(). The program must be general and should not use any string-related library function. (12)

(b) Determine the output of the following C++ program:

 
 
#include <iostream.h>
 
int main() {
int a = 12, b = 25;
cout << "a = " << a << endl;
cout << "b = " << b << endl;
cout << "a | b = " << (a | b) << endl;
return 0;
}
 

(8)

SECTION-B

Q. 5

(a) Define a C++ class named Circle. Implement all five methods of object creation:

  1. Default radius of 1 inch with centre at (0,0).
  2. Given radius with centre at (0,0).
  3. Given centre coordinates with radius assumed to be 1.
  4. Given radius and centre coordinates.
  5. Initialization using another Circle object.

In the driver program, create five different Circle objects, each using a different method. (10)

(b) What is a virtual function in C++? Explain its working with a suitable example. (10)

Q. 6

(a) Complete the following recursive C++ function to calculate k raised to the power n:

 
 
int power(int k, int n)
{
// write your code here
}
 

No built-in/library function may be used. (8)

(b) Compare and contrast the following encryption algorithms:

  • DES
  • AES
  • RSA

(8)

(c) Determine the Big-O time complexity of the given isPrime() C++ function. (4)

Q. 7

(a) For the given binary-search function, draw its control-flow graph and calculate its cyclomatic complexity. (8)

(b) Differentiate between white-box (glass-box) testing and black-box testing. Explain which technique is more useful for identifying errors in a system under evaluation and why. (6)

(c) Requirements can be written using natural-language specifications. For the function “Automatically highlight incorrect spelling mistakes in an MS Word document,” write:

  • One user requirement.
  • One system requirement.

(6)

Q. 8

(a) Draw a finite automaton over the alphabet {0,1} that accepts all binary strings beginning and ending with 0. A single 0 is also accepted. (8)

(b) Write a regular expression over {0,1} representing strings that begin with 101 and end with 110. (6)

(c) Write a Context-Free Grammar (CFG) over {0,1} for the language of binary strings of the form:

0ᵃ1ᵇ0ᶜ

where:

a + c = b

(6)

COMPUTER SCIENCE, PAPER-II — CSS 2022
COMPUTER SCIENCE, PAPER-II

TIME ALLOWED: THREE HOURS

PART-I (MCQS): MAXIMUM 30 MINUTES
PART-I (MCQS) MAXIMUM MARKS = 20
PART-II MAXIMUM MARKS = 80

PART-II

SECTION-A

Q. 2

(a) Several processes are scheduled using a preemptive Round-Robin scheduling algorithm with priorities. A higher numerical value represents a higher priority. An idle process P_idle has priority 0 and runs whenever no other process is available. The time quantum is 10 units. When a process is preempted by a higher-priority process, it is placed at the end of the queue.

Process Priority Burst Arrival
P1 40 20 0
P2 30 25 25
P3 30 25 30
P4 35 15 60
P5 5 10 100
P6 10 10 105

Draw the Gantt chart showing the scheduling order. Calculate the turnaround time and waiting time for every process. (10)

(b) A disk head initially starts at track 20 and moves in the direction of increasing tracks. The disk has 100 tracks and the request queue is:

18, 25, 73, 46, 9, 92

Using the C-SCAN algorithm, calculate the performance in terms of average seek time. (6)

(c) Discuss the design and management issues caused by the existence of concurrency. (4)

Q. 3

(a) Given a snapshot of a system, use Banker's Algorithm to determine whether the state is safe or unsafe. If safe, show the order in which processes can complete. If unsafe, explain why. (12)

(b) Describe the different functions of a Logical File System. (4)

(c) Explain what resources are required when creating a thread, and how these differ from the resources required when creating a process. (4)

Q. 4

(a) A pipeline consists of four stages:

  • Fetch Instruction (FI)
  • Decode Instruction and Calculate Addresses (DA)
  • Fetch Operand (FO)
  • Execute (EX)

Draw the pipeline diagram for seven instructions where the third instruction is a taken branch and there are no data dependencies. (8)

(b) A set-associative cache has 64 lines divided into sets of four lines. Main memory contains 4K blocks, with each block containing 128 words. Show the format of main-memory addresses. (6)

(c) Explain why DMA access to main memory is given higher priority than CPU access to main memory. (6)

Q. 5

(a) Describe in detail any one routing algorithm used to resolve conflicts between path selections. (8)

(b) A company has four buildings on a campus. Each building has a 100Base-T network running to all floors. The buildings form a square, 100 meters on each side, and the network must support a data-transfer rate of 100 Mbps. Propose an appropriate network design solution. (6)

(c) Explain the main weakness in the TCP three-way handshake that makes it exploitable by attackers. Discuss whether the backlog parameter associated with a listening socket solves this problem. (6)

SECTION-B

Q. 6

(a) Find the reflection of each given structuring element (SE) in mathematical morphology. The dot in each SE represents its origin. (8)

(b) Given the horizontal intensity profiles of the R, G and B component images of an RGB image, determine the colour that a person would see in the middle column and show the necessary working. (8)

(c) Explain the relationship between Digital Image Processing and Computer Vision. (4)

Q. 7

(a) Explain the three-tier web application architecture. (8)

(b) Write jQuery code to slide elements up and down and to fade elements in and out of visibility. Use HTML, CSS and jQuery. (6)

(c) What is web application promotion? Discuss some common web advertising (webvertising) methods. (6)

Q. 8

(a) Explain the process of Web Application Testing. (8)

(b) Explain the Document Object Model (DOM) in detail. Also discuss XML and RSS. (6)

(c) Explain how a database can be accessed from a JSP page. Discuss database-connectivity issues in detail.


DOWNLOAD NOW


Quote
Topic starter Posted : August 15, 2026 11:59 am
Share: