CSS Computer Science Past Paper 2025 PDF
Federal Public Service Commission (FPSC)
Competitive Examination for Recruitment to BPS-17 Posts under the Federal Government
PAPER: COMPUTER SCIENCE
Time Allowed: 3 Hours
PAPER-I (Objective) 20 Marks
-
What is the degree of a leaf node in a tree?
-
✓ (A) 0
-
(B) 1
-
(C) 2
-
(D) None of these
-
What is the main goal of Capability Maturity Model Integration (CMMI)?
-
✓ (A) To enhance maturity of software process
-
(B) To increase the quality of software
-
(C) To provide user friendly experience
-
(D) None of these
-
Which type of software testing is used to confirm whether the software is according to the customer’s requirements?
-
(A) Performance testing
-
✓ (B) Acceptance testing
-
(C) Regression testing
-
(D) None of these
-
Which of the following is commonly used for measuring the performance of supercomputers?
-
(A) Gigahertz (GHz)
-
✓ (B) Teraflops (TFLOPS)
-
(C) Petabyte (PB)
-
(D) None of these
-
Which software development model uses iterative cycles and continuous development?
-
✓ (A) Agile Model
-
(B) Spiral Model
-
(C) V-Model
-
(D) None of these
-
Which of the following is the false statement in C language?
-
(A) static a = 10;
-
(B) static int func(int);
-
✓ (C) static static int a;
-
(D) None of these
-
Which programming language uses the concept of friend function?
-
(A) Python
-
(B) Java
-
(C) C#
-
✓ (D) None of these (C++)
-
What is meant by refactoring code in SDLC?
-
(A) To modify the functionality of software
-
✓ (B) To improve the code quality
-
(C) To find out bugs in a software
-
(D) None of these
-
What is the main purpose of using Trojans?
-
✓ (A) To get passwords
-
(B) To delete data
-
(C) To corrupt files
-
(D) None of these
-
What is the correct data structure for implementing Huffman algorithm?
-
✓ (A) Priority Queue
-
(B) Linked List
-
(C) Binary Tree
-
(D) None of these
-
Which asymptotic notation gives the strict upper bound for a function?
-
(A) Omega notation
-
✓ (B) Big O notation
-
(C) Theta notation
-
(D) None of these
-
Which one of the following is the fastest way of searching for a given key?
-
(A) Sorted Array
-
(B) Linked List
-
✓ (C) Binary Search Tree
-
(D) None of these
-
What is the role of parser?
-
(A) To check logical errors
-
✓ (B) To find syntax errors
-
(C) To identify run-time errors
-
(D) None of these
-
Which optimization method involves minimizing the memory access count in a program?
-
(A) Constant Folding
-
✓ (B) Register Allocation
-
(C) Instruction Scheduling
-
(D) None of these
-
What is the output of the following code?
int main() {
int a = 40;
int* ptr = &a;
int& ref = *ptr;
ref = 60;
cout << a;
}
-
(A) 40
-
✓ (B) 60
-
(C) Error
-
(D) None of these
-
The process of deleting an element from an empty stack is called:
-
(A) Overflow
-
(B) Deletion
-
✓ (C) Underflow
-
(D) None of these
-
How is the head node deleted in a doubly circular linked list?
-
(A) By adjusting the prev pointer of the new head node to null.
-
✓ (B) By setting the next pointer of previous node to point to the new head.
-
(C) By pointing the next pointer of last node to null.
-
(D) None of these
-
Which technique works by selecting the local optimal choice at each step?
-
(A) Dynamic Programming
-
(B) Divide and Conquer
-
✓ (C) Greedy Algorithm
-
(D) None of these
-
What is the time complexity of searching for an element in a hash table?
-
✓ (A) O(1)
-
(B) O(n)
-
(C) O(n log n)
-
(D) None of these
-
Which phase of compiler is responsible for Abstract Syntax Tree (AST) generation?
-
✓ (A) Syntax Analysis
-
(B) Semantic Analysis
-
(C) Lexical Analysis
-
(D) None of these
PAPER (Subjective) 80 Marks
Attempt ONLY FOUR questions from PART-II. (20×4)
PART-II
SECTION-A
Q. No. 2
(a) How is Generative AI creating an impact on society? Discuss the benefits and challenges associated with its use. Support your answer with examples. (6)
(b) Compare different data storage devices in terms of:
-
Speed
-
Storage Capacity
-
Access Time
-
Cost
(6)
(c) What are Two’s Complement numbers? Explain how they work with suitable examples. Also discuss the practical applications where Two’s Complement numbers are used. (8)
Q. No. 3
(a) Differentiate between shallow copy and deep copy in C++. Discuss when each type of copy should be used, with examples. (6)
(b) Explain the difference between the const keyword and the static keyword in C++. Illustrate each with suitable examples. (6)
(c) Explain the role of pure virtual functions in implementing abstract classes in C++. How do they differ from virtual functions? Give an example where both types of functions are used. (8)
Q. No. 4
(a) Write a C++ program to display the arithmetic series of n terms and calculate its sum using the formula:
Sn=n2[2a+(n−1)d]S_n=\frac{n}{2}[2a+(n-1)d]
where:
-
a = 5 (first term)
-
d = 3 (common difference)
-
n = 6 (number of terms)
(6)
(b) Write a C++ program to calculate and display the product of two 2 × 2 matrices. The program should take both matrices as input from the user. (6)
(c) Write a C++ program using a structure to represent two complex numbers. Use a function to calculate their sum and display the result in the form:
a + bi
where a and b are the real and imaginary parts respectively. (8)
SECTION-B
Q. No. 5
(a) Demonstrate the use of stream insertion (<<) and stream extraction (>>) operators for custom objects. Provide a suitable C++ example to explain their functionality. (10)
(b) Implement a Book Management System consisting of the following classes:
-
Book
-
Book Name
-
ISBN Number
-
Publication Year
-
-
Author
-
Author Name
-
Author Email
-
-
Publisher
-
Publisher Name
-
Publisher Email
-
Publisher Address
-
Each Book has one Author and one Publisher. The Author and Publisher objects are created and destroyed along with the Book object.
Write the C++ program and explain how composition is implemented in this system. (10)
Q. No. 6
(a) What are Self-Balancing Binary Search Trees? Under what circumstances are they preferred over a normal Binary Search Tree? (6)
(b) Write the recursive pseudocode for generating the Fibonacci sequence. Determine its time complexity and explain how it is derived. (6)
(c) A manufacturing company needs to sort parcel weights using the Quick Sort algorithm.
Parcel Weights:
[30, 45, 10, 20, 75, 15, 85, 40, 05, 65]
Required:
-
Sort the weights in ascending order using Quick Sort.
-
Clearly state the pivot selection and justify your choice.
-
Show the sorting process graphically with explanation at each step.
(8)
Q. No. 7
(a) Project management involves several planning stages during software development. Discuss the different planning phases and the specific tasks performed in each phase. (6)
(b) Differentiate between Software Verification and Software Validation. Support your answer with examples and explain when each technique should be used. (6)
(c) What is the Software Process Improvement (SPI) framework? Explain:
-
Steps of the SPI framework
-
Key elements involved
-
Common SPI models
-
How to determine which projects should use the SPI framework
(8)
Q. No. 8
(a) Create a regular expression for a language in which every string starts with "baa". Also draw the corresponding Deterministic Finite Automaton (DFA) and explain each step. (6)
(b) What is Instruction Scheduling? Explain its role during the code generation phase of a compiler. (6)
(c) What is a Parse Tree? Explain how a parse tree is used to determine whether a string belongs to a language. Illustrate your answer with an example. (8)
PAPER-II (Objective) 20 Marks
-
A stack is:
(A) An 8-bit register in microprocessor
(B) A 16-bit register in microprocessor
(✓ C) A set of memory locations in RAM reserved for storing information temporarily during program execution
(D) A 16-bit memory address stored in the program counter
-
Data hazards occur when:
(A) Greater performance loss
(✓ B) Pipeline changes the order of read/write access to operands
(C) Some functional unit is not fully pipelined
(D) Machine size is limited
-
If Computer A executes a program in 10 seconds and Computer B in 15 seconds, how much faster is Computer A?
(A) 5.1 times
(✓ B) 1.5 times
(C) 1 time
(D) 1.4 times
-
A processor having a clock cycle of 0.25 ns will have a clock rate of:
(A) 2 GHz
(B) 3 GHz
(✓ C) 4 GHz
(D) 8 GHz
-
Which of the following is an application of image blurring?
(A) Object detection
(✓ B) Gross representation
(C) Object motion
(D) Image segmentation
-
For a continuous image f(x, y), quantization is defined as:
(A) Digitizing the coordinate values
(✓ B) Digitizing the amplitude values
(C) Both (A) & (B)
(D) None of these
-
Which method is used to generate a processed image with a specified histogram?
(A) Histogram linearization
(B) Histogram equalization
(✓ C) Histogram matching
(D) Histogram processing
-
A ________ in a table represents a relationship among a set of values.
(A) Column
(B) Key
(✓ C) Row
(D) Entry
-
Which normal form is based on the concept of functional dependency?
(A) 1NF
(B) 2NF
(✓ C) 3NF
(D) 4NF
-
In case of shutdown before a transaction is committed, which action is performed automatically?
(A) View
(B) Commit
(✓ C) Rollback
(D) Flashback
-
Process synchronization can be done on:
(A) Hardware level
(B) Software level
(✓ C) Both (A) & (B)
(D) None of these
-
Which module gives control of the CPU to the process selected by the short-term scheduler?
(✓ A) Dispatcher
(B) Interrupt
(C) Scheduler
(D) None of these
-
If the semaphore value is negative:
(✓ A) Its magnitude is the number of processes waiting on that semaphore
(B) It is invalid
(C) No operation can be performed until a signal operation occurs
(D) None of these
-
For the given reference string with 3 page frames, the LRU page replacement algorithm produces:
(A) 10
(B) 15
(C) 11
(✓ D) 12
-
What is DOM?
(A) Hierarchy of objects in ASP.NET
(B) Application Programming Interface
(✓ C) Convention for representing and interacting with objects in HTML documents
(D) Language-dependent application program
-
Which error is invoked when SQLTransaction callback does not execute?
(A) INVALID_ACCESS_ERR
(B) UNKNOWN_ERR
(C) TIMEOUT_ERR
(✓ D) INVALID_STATE_ERR
-
Which CSS property defines labels for a list of items?
(A) List-shape
(B) List-style
(C) List-type
(✓ D) List-style-type
-
ICMP is primarily used for:
(✓ A) Error and diagnostic functions
(B) Addressing
(C) Forwarding
(D) Routing
-
Which multiplexing technique is used to transmit digital signals?
(A) FDM
(✓ B) TDM
(C) WDM
(D) FDM & WDM
-
DHCP (Dynamic Host Configuration Protocol) provides ________ to the client.
(✓ A) IP address
(B) MAC address
(C) URL
(D) None of these
PAPER (Subjective) 80 Marks
Attempt ONLY FOUR questions from PART-II. (20×4)
PART-II
SECTION-A
Q. No. 2
(a) An instruction requires five stages to execute:
-
Stage-1 (instruction fetch) requires = 30 ns
-
Stage-2 (instruction decode) = 9 ns
-
Stage-3 (instruction execute) = 20 ns
-
Stage-4 (Memory access) = 35 ns
-
Stage-5 (Store results) = 10 ns
An instruction must proceed through the stages in sequence. What is the minimum asynchronous time for any single instruction to complete? (3)
(b) Consider a single-level cache with an access time of 2.5 ns, a line size of 64 bytes, and a hit ratio of H = 0.95. Main memory uses a block transfer capability that has a first word (4 bytes) access time of 50 ns and an access time of 5 ns for each word thereafter.
(i) What is the access time when there is a cache miss? Assume that the cache waits until the line has been fetched from main memory and then re-executes for a hit. (3)
(ii) Suppose that increasing the line size to 128 bytes increases the H to 0.97. Does this reduce the average memory access time? (4)
(c)
(i) Compare the set of addressing modes of RISC and CISC machines. Give one example of addressing modes used in RISC and CISC respectively. (5)
(ii) Explain Parallel Processing, and also draw pipeline processing for instruction:
Ai × Bi + Ci (5)
Q. No. 3
(a) Answer the Following Questions:
(i) Is it possible for an organization’s Web server and mail server to have exactly the same alias for a hostname (for example, foo.com)? What would be the type for the RR that contains the hostname of the mail server? (2)
(ii) Draw the structure of Internet in terms of ISPs, also show the concept in terms of Edge and Core networks. (3)
(iii) A packet switch receives a packet to be forwarded. When the packet arrives, one other packet is halfway done being transmitted on this outbound link and four other packets are waiting to be transmitted in FIFO manner. Suppose all packets are 1,500 bytes and the link rate is 2 Mbps. What is the queuing delay for the packet? (3)
(iv) Why do HTTP, FTP, SMTP, and POP3 run on top of TCP rather than on UDP? (2)
(b)
(i) Why do we need conditional GET when we have regular GET with respect to HTTP? What is its difference in comparison to GET? (4)
(ii) With respect to web caching, if an average object size is 100K bits and the average request rate from browsers to origin servers is 15/sec. Suppose RTT from an institutional router to any origin server is 2 sec. If LAN speed is 100 Mbps and access link speed is 1.54 Mbps then with a cache hit of 50%, how much total delay will be there? (6)
Q. No. 4
(a) A benchmark program is run on a 40 MHz processor. The executed program consists of 100,000 instruction executions, with the following instruction mix and clock cycle count:
| Instruction Type | Instruction Count | Cycles per Instruction |
|---|---|---|
| Integer arithmetic | 45,000 | 1 |
| Data transfer | 32,000 | 2 |
| Floating point | 15,000 | 2 |
| Control transfer | 8,000 | 2 |
Determine the effective CPI, MIPS rate, and execution time for this program. (10)
(b) What are the differences among sequential access, direct access, and random access? Also, write and explain the general relationship among access time, memory cost, and capacity. (10)
Q. No. 5
(a) Consider the following pseudo code for producer and consumer:
// producer
do{
// produce an item
// place in buffer
}while(true);
// consumer
do{
// remove item from buffer
// consumes item
}while(true);
(i) What is race condition? (2)
(ii) Is there any possibility of the race condition if two threads named producer and consumer simultaneously execute the above functions? Provide the reasoning in two-three sentences. (2)
(iii) Add the necessary synchronization in the above functions, you may use semaphores or mutex. You may provide just pseudo code or exact C/C++ code. (3)
(iv) Consider a process that uses a user level threading library to spawn 10 user level threads. The library maps these 10 threads on to 2 kernel threads. The process is executing on an 8-core system. What is the maximum number of threads of a process that can be executing in parallel? (3)
(b) Consider a multi-level memory management scheme with the following format for virtual addresses:
-
Virtual Page # (10 bits)
-
Virtual Page # (10 bits)
-
Offset (12 bits)
