FEDERAL PUBLIC SERVICE COMMISSION
COMPETITIVE EXAMINATION-2026 FOR RECRUITMENT TO
POSTS IN BS-17 UNDER THE FEDERAL GOVERNMENT
COMPUTER SCIENCE, PAPER-I
TIME ALLOWED: THREE HOURS
(PART-I MCQs) MAXIMUM MARKS: 20
PART-I (MCQs): MAXIMUM 30 MINUTES
(PART-II) MAXIMUM MARKS: 80
NOTE: (i) First attempt PART-I (MCQs) on separate OMR Answer Sheet which shall be taken back after 30 minutes.
(ii) Overwriting/cutting of the options/answers will not be given credit.
(iii) There is no negative marking. All MCQs must be attempted.
PART-I (MCQs)(COMPULSORY)
Q1 (i) Select the best option/answer and fill in the appropriate Box [ ] on the OMR Answer Sheet. (20×1=20)
(ii) Answers given anywhere else, other than OMR Answer Sheet, will not be considered.
1 A company wants to upgrade its storage media for fastest possible data access. Which one is the best option?
(A) Hard Disk Drive (HDD) (B) Optical Drive (C) Solid State Drive (SSD) (D) None of these
2 A programmer is developing software and needs to consider ethical challenges. What is a major concern?
(A) Data encryption (B) Plagiarism (C) User interface (D) None of these
3 A programmer wants to group different data types. What should he/she use?
(A) Structures (B) Arrays (C) Unions (D) None of these
4 A class needs to allow different implementations of a method. What concept to use?
(A) Inheritance (B) Polymorphism (C) Encapsulation (D) None of these
5 What is the purpose of using virtual functions in inheritance?
(A) To prevent overriding (B) To hide members (C) To enable polymorphism (D) None of these
6 How does the history of computing influence modern computer architecture?
(A) By dictating hardware design (B) By shaping software development (C) By influencing both hardware and software (D) None of these
7 A function needs to modify an input variable. How should the parameter be passed?
(A) By value (B) By reference (C) By pointer (D) None of these
8 A developer wants to define a class with methods that can be used with different data types. What to use?
(A) Templates (B) Inheritance (C) Polymorphism (D) None of these
9 Which operator is typically overloaded for stream insertion?
(A) << (B) >> (C) + (D) None of these
10 What does the Standard Template Library (STL) provide in C++?
(A) Pre-defined classes for GUI (B) Pre-defined functions for math operations (C) Pre-defined containers and algorithms (D) None of these
11 You are analyzing an algorithm’s efficiency. What do you consider?
(A) Code length (B) Time and space complexity (C) Programmer’s experience (D) None of these
12 In Hash Tables, what is a collision resolution technique?
(A) Linear Search (B) Binary Search (C) Chaining (D) None of these
13 In Recursion, what is crucial to prevent infinite loops?
(A) Base case (B) Recursive call (C) Loop usage (D) None of these
14 You are leading an Agile team developing a mobile app. What’s the primary focus?
(A) Detailed upfront planning (B) Strict adherence to initial requirements (C) Iterative development and customer feedback (D) Both (A) & (B)
15 A compiler needs to recognize tokens. Which phase does this?
(A) Syntax Analysis (B) Lexical Analysis (C) Code Generation (D) None of these
16 What is the advantage of using LL(1) grammars in the Syntax Analysis?
(A) More complex parsing (B) Predictive parsing with less complexity (C) No need for grammar rules (D) None of these
17 What is the difference between Top-down and Bottom-up parsers?
(A) Top-down is always faster (B) Bottom-up handles more grammars (C) Top-down starts from start symbol (D) None of these
18 What do compilers use for recognizing tokens?
(A) Regular expressions (B) Context-free grammars (C) Machine code (D) None of these
19 A project is behind schedule. What is a likely Agile response?
(A) Add more developers (B) Work longer hours (C) Both (A) & (B) (D) Review scope and priorities with team
20 A project is using open-source components with security vulnerabilities. What is the risk?
(A) Security breaches or compliance issues (B) Non-technical issues (C) Open-source issues (D) None of these
PART-II
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 the parts (if any) of each Question must be attempted at one place instead of at different places.
(iv) Write Q No. in the Answer Book in accordance with Q No. in the Q.Paper.
(v) No Page/Space be left blank between the answers. All the blank pages of Answer Book must be crossed.
(vi) Extra attempt of any question or any part of the question will not be considered.
SECTION-A
Q No. 2 (a) Your team needs to share large files quickly but email limits attachments. What computing method should they use and how will it solve the issue? (6)
(b) You receive an email asking for your banking details. What kind of risk or security issue this might be? How to respond? (6)
(c) Your office plans to upgrade hardware but employees don’t know what components matter. Which computer hardware components would you explain to help them choose better systems? (8)
Q No. 3 (a) What is bit manipulation in programming and why is it used? Give two examples of its use. (6)
(b) What are arrays? Describe one advantage and one limitation. (6)
(c) Write pseudocode to reverse an array using pointers. (8)
Q No. 4 (a) Why cannot we instantiate an abstract class directly, even though it may contain complete functions? (6)
(b) A class library contains many book objects. Should this be modeled using inheritance or composition? Why? (6)
(c) Demonstrate method overriding using a base class Account and derived class Current Account. Make balance a protected data member. (8)
SECTION-B
Q No. 5 (a) Why is Binary Search not suitable for an unsorted list? (6)
(b) What is the difference between Time Complexity and Space Complexity? Explain with examples. (6)
(c) Write an algorithm with an example showing how Stack can be used to evaluate a postfix expression. (8)
Q No. 6 (a) Why is Maintenance the most expensive phase of the software lifecycle? (6)
(b) What is the purpose of Use Case Diagrams? (6)
(c) Why do Agile projects need frequent customer interaction? (8)
Q No. 7 (a) Construct a Deterministic Finite Automaton (DFA) for the regular expression (ab)*abb. (6)
(b) Explain the difference among lexeme, token, and pattern with examples. (6)
(c) Consider the three-address code:
t1 = a + b
t2 = t1 + c
t3 = d * e
If the machine has only two registers, how should the compiler allocate registers to minimize memory spills? (8)
Q No. 8 (a) Suppose a lexical analyzer is scanning code and encounters the following input string:
9var = x + 12abc; (6)
Describe step-by-step how the lexical analyzer processes this input, identifies errors, and generates tokens. Explain which specific rules of lexical analysis it uses.
(b) A software team is building an online examination system. During requirements gathering, the client says they want “very strong security,” but teachers want “fast login without multiple checks.” The development team becomes confused because the requirements conflict. Explain how the team should resolve this conflict using proper Software Engineering techniques. Also describe the impact of wrong requirement handling on the SDLC. (6)
(c) A company maintains millions of product IDs and frequently performs searching, insertion, and deletion. The data volume is extremely large, and performance is critical. Which data structure would be most suitable—Binary Search Tree, AVL Tree, Hash Table, or Array? Justify your answer logically using time complexity and memory considerations. (8)
ANSWER KEY
1 (C) Solid State Drive (SSD)
2 (B) Plagiarism
3 (A) Structures
4 (B) Polymorphism
5 (C) To enable polymorphism
6 (C) By influencing both hardware and software
7 (B) By reference
8 (A) Templates
9 (A) <<
10 (C) Pre-defined containers and algorithms
11 (B) Time and space complexity
12 (C) Chaining
13 (A) Base case
14 (C) Iterative development and customer feedback
15 (B) Lexical Analysis
16 (B) Predictive parsing with less complexity
17 (C) Top-down starts from start symbol
18 (A) Regular expressions
19 (D) Review scope and priorities with team
20 (A) Security breaches or compliance issues
*************