All Subjects
Bahria University50 Questions

PhD Computer Science MCQs

Practice PhD Computer Science multiple-choice questions for Bahria University competitive exams. Each question includes the correct answer and a short explanation, and past-paper questions are marked so you can revise both repeated and fresh material in one place.

O(1)
O(log n)
O(n)
O(n log n)
ExplanationIn a Fibonacci heap, the delete-min operation involves consolidating the root list, which takes amortized O(log n) time.
Dijkstra's Algorithm
Bellman-Ford Algorithm
Prim's Algorithm
Kruskal's Algorithm
ExplanationDijkstra fails with negative edges, while Bellman-Ford can handle them correctly by relaxing edges V-1 times.
m/2
ceil(m/2)
floor(m/2)
m-1
ExplanationTo maintain the balance of a B-tree, non-root internal nodes must be at least half full, defined as ceil(m/2) children.
Binary Max-Heap
Pairing Heap
Van Emde Boas Tree
Sorted Linked List
ExplanationVan Emde Boas trees provide O(log log U) time complexity for priority queue operations, where U is the universe size, outperforming standard heaps for certain integer ranges.
O(n log n)
O(n)
O(n^2)
O(log n)
ExplanationWhen the pivot is consistently extreme, the partition becomes highly unbalanced, resulting in a depth of n, leading to O(n^2) complexity.
Dijkstra's Algorithm
Kruskal's Algorithm
Bellman-Ford Algorithm
Floyd-Warshall Algorithm
ExplanationKruskal's algorithm sorts all edges by weight and adds them sequentially if they do not form a cycle, which is a greedy strategy for MST.
Guaranteed O(1) search time
Lower space complexity
Easier implementation for concurrent operations
Smaller constant factors
ExplanationSkip lists are highly preferred in concurrent programming because they allow localized updates, avoiding the global rebalancing locks required by trees like AVL or Red-Black trees.
Greedy Algorithm
Dynamic Programming
Backtracking
Divide and Conquer
ExplanationDynamic programming is used to solve the Knapsack problem by breaking it down into overlapping subproblems and storing results to build the optimal solution.
The recurrence must be in the form T(n) = aT(n/b) + f(n)
The subproblems must be solved sequentially
The function f(n) must be logarithmic
The problem must be non-recursive
ExplanationThe Master Theorem provides a cookbook solution for recurrences of the specific form T(n) = aT(n/b) + f(n).
log2(n+1)
2 log2(n+1)
n
log2(n)
ExplanationDue to the balancing properties (red nodes cannot have red children, paths have equal black nodes), the height is guaranteed to be at most 2 log2(n+1).
Preventing race conditions
Resource allocation and deadlock detection
Managing process priority
Interrupt handling
ExplanationA Wait-For graph is a directed graph used to detect circular wait conditions, which signify a deadlock.
To indicate the sequence number of the next packet
To provide flow control by specifying the amount of data the receiver can accept
To define the header length
To detect packet corruption
ExplanationThe Window Size field enables the receiver to inform the sender about the available buffer space, preventing buffer overflow.
LRU (Least Recently Used)
FIFO (First-In-First-Out)
Optimal Page Replacement
Clock Algorithm
ExplanationBelady's Anomaly occurs when increasing the number of page frames results in an increase in the number of page faults, which is characteristic of FIFO.
Data Link Layer
Transport Layer
Network Layer
Physical Layer
ExplanationThe Network Layer is responsible for logical addressing and routing packets across different networks.
Memory allocation
Process synchronization
Interrupt handling
File system indexing
ExplanationSemaphores are integer variables used as a mechanism for process synchronization to manage access to shared resources and prevent race conditions.
The congestion window increases linearly
The congestion window increases exponentially
The connection stays at a fixed rate
The throughput is capped at the maximum bandwidth
ExplanationIn slow start, for every ACK received, the congestion window (cwnd) increases by one MSS, effectively doubling the window size every RTT.
Round Robin
Shortest Job First (SJF)
Priority Scheduling
Multilevel Queue Scheduling
ExplanationSJF is a non-preemptive algorithm that minimizes average waiting time by executing the process with the shortest execution time next.
Compaction
Segmentation
Paging
Demand Paging
ExplanationPaging eliminates external fragmentation by allocating fixed-size blocks, though it can still suffer from internal fragmentation in the last page.
Encryption of payload
Preventing replay attacks
Authentication of identity
Packet header compression
ExplanationA nonce (number used once) ensures that old communication data cannot be captured and retransmitted by an attacker.
Round Robin
First-Come First-Served
Shortest Job First
Multilevel Feedback Queue
ExplanationShortest Job First (SJF) is mathematically proven to result in the minimum average waiting time for a set of jobs.
Singleton
Bridge
Observer
Factory Method
ExplanationThe Bridge pattern is specifically designed to separate an abstraction from its implementation, allowing them to be modified independently.
Low Coupling
Liskov Substitution Principle
Layered Architecture
Logical Consistency
ExplanationThe Liskov Substitution Principle states that objects of a superclass should be replaceable with objects of its subclasses without breaking the application.
Coupling
Cohesion
Complexity
Stability
ExplanationCohesion refers to the strength of the functional relationship between elements within a single module; high cohesion is a desired software quality.
To simplify complex interfaces
To allow incompatible interfaces to work together
To restrict object creation to a single instance
To dynamically add behavior to objects
ExplanationThe Adapter pattern converts the interface of a class into another interface that clients expect, effectively bridging incompatible components.
To track bugs found during testing
To visualize the amount of work remaining versus time
To document architectural decisions
To measure developer satisfaction
ExplanationA burndown chart is a graphical representation of work left to do versus time, commonly used to track progress in Scrum sprints.
Dynamic Testing
Black-box Testing
Static Testing
Regression Testing
ExplanationStatic testing involves reviewing, walking through, or analyzing code without actually executing the program.
Adding new features
Improving internal code structure without changing external behavior
Fixing security vulnerabilities
Optimizing hardware utilization
ExplanationRefactoring is the process of restructuring existing computer code—changing the internal structure—without changing its external behavior.
Monolithic
Microservices
Layered Architecture
Pipe and Filter
ExplanationMicroservices allow components to be developed, deployed, and scaled independently, which is ideal for large-scale distributed systems.
Hardcoding modules together
Depend on abstractions, not concretions
Removing all classes
Encapsulating data
ExplanationThe principle states that high-level modules should not depend on low-level modules; both should depend on abstractions.
Unit testing
Integration testing
Acceptance testing
System testing
ExplanationIntegration testing focuses on the interfaces and communication between different modules or components.
To increase the sample size
To eliminate researcher and participant bias
To reduce costs
To improve computational speed
ExplanationDouble-blind studies ensure that neither the researchers nor the participants know which subjects are in the experimental or control groups, preventing bias.
Introduction
Methodology
Conclusion
Literature Review
ExplanationThe conclusion section synthesizes the findings and typically includes a discussion on the study's limitations and directions for future research.
Introduction
Literature Review
Abstract
Conclusion
ExplanationThe abstract is a concise summary of the entire research work, allowing readers to quickly understand the core contributions.
Independent variable
Dependent variable
Confounding variable
Control variable
ExplanationA confounding variable obscures the true relationship between variables because it influences both, leading to spurious correlations.
Case study
Experimental research
Ethnography
Survey research
ExplanationExperimental research is the gold standard for establishing cause-and-effect relationships through the controlled manipulation of an independent variable.
To summarize all existing research on a topic using a transparent, replicable process
To prove the researcher's own hypothesis
To write a short summary for a conference
To generate new primary data
ExplanationA systematic review uses a rigorous, pre-defined methodology to identify, appraise, and synthesize all empirical evidence to answer a specific research question.
The consistency of the results
The ability of the test to measure what it is intended to measure
The number of citations the paper receives
The ease of replicating the experiment
ExplanationValidity relates to the accuracy and truthfulness of a measurement—whether it correctly reflects the concept being studied.
Reliability is accuracy, Validity is consistency
Reliability is consistency, Validity is accuracy
They mean the same thing
Validity is only for qualitative studies
ExplanationReliability refers to the consistency of a measure, while validity refers to the accuracy or truthfulness of the measure.
The null hypothesis is true
The result is statistically significant
The sample size was too small
The experiment was flawed
ExplanationIn standard research, p < 0.05 is the threshold used to reject the null hypothesis in favor of the alternative hypothesis.
Abstract
Introduction
Methodology
Conclusion
ExplanationThe methodology section provides a clear roadmap of how the research was conducted, ensuring reproducibility.
O(n)
O(n log n)
O(n^2)
O(n^3)
ExplanationBig-O notation considers the highest order term, which in this case is n^2.
E
V + E
2E
V^2
ExplanationAccording to the Handshaking Lemma, the sum of the degrees of all vertices in a graph is equal to twice the number of edges.
1/8
3/8
1/2
2/3
ExplanationUsing the binomial distribution: (3 choose 2) * (0.5)^2 * (0.5)^1 = 3 * 0.125 = 0.375 or 3/8.
A is invertible
A is singular (non-invertible)
A must be a zero matrix
The trace of A is 0
ExplanationA square matrix is singular if and only if its determinant is 0, which is equivalent to at least one of its eigenvalues being 0.
NAND
XOR
Implication
Inhibit
ExplanationThe inhibit gate or operation performs a conjunction of one variable and the negation of another (P ∧ ¬Q).
3 elements
6 elements
8 elements
9 elements
ExplanationThe number of elements in the power set of a set with n elements is 2^n. For n=3, 2^3 = 8.
n(n+1)/2
n^2
n(n-1)
n(n+1)(2n+1)/6
ExplanationThis is the standard formula for the sum of the first n positive integers (the triangular number formula).
5
10
25
32
ExplanationThe cardinality of the power set of a set with n elements is 2^n. For n=5, 2^5 = 32.
f'(x) = 0
f'(x) > 0
f'(x) < 0
f'(x) is undefined
ExplanationA strictly increasing function must have a positive slope (derivative) across its domain.
0010
0110
1110
1000
ExplanationXOR returns 1 if bits are different and 0 if they are the same: 1^1=0, 0^1=1, 1^0=1, 0^0=0. So 1010^1100 = 0110.

Frequently Asked Questions

Are these PhD Computer Science MCQs free?

Yes. Every PhD Computer Science MCQ on this page is free to practice, including the correct answer and explanation.

Do these include past-paper questions?

Yes — questions sourced from past papers are clearly marked with a "Past Paper" badge, alongside fresh practice questions.

Which exams do these PhD Computer Science MCQs help with?

They are aimed at Bahria University and related Pakistani competitive exams that test PhD Computer Science.

How should I practice subject-wise MCQs?

Attempt each question first, then reveal the answer and read the explanation. Short, focused sessions on one subject work better than long unstructured reading.

We use cookies

We use essential cookies to keep the platform running and analytics cookies to understand usage. You can accept or reject analytics and advertising cookies.