Download AQA A-LEVEL COMPUTER SCIENCE PAPER 1 and more Exams Computer Science in PDF only on Docsity!
AQA A-LEVEL COMPUTER SCIENCE PAPER 1
COMPREHENSIVE PRACTICE EXAMINATION
Topics: Fundamentals, Data Structures, Algorithms, Theory,
Systems
Total Questions: 150
Time: 2 hours 30 minutes
SECTION 1: PROGRAMMING FUNDAMENTALS &
PARADIGMS (25 Questions)
- What is the output of the following Python code? x = 10 y = 3 print(x // y) A) 3. B) 3 C) 4 D) 3.
Answer: B Explanation: The // operator performs integer division (floor division), returning the largest integer less than or equal to the result.
- Which programming paradigm emphasizes procedures and functions? A) Object-Oriented B) Declarative C) Procedural D) Functional
Answer: C Explanation: Procedural programming organizes code into procedures or functions that perform operations on data.
- What is encapsulation in OOP? A) Hiding implementation details B) Creating multiple instances C) Inheriting properties D) Overloading methods
Answer: A
Explanation: Encapsulation bundles data and methods together while restricting access to some components.
- Which data type is immutable in Python? A) List B) Dictionary C) Tuple D) Set
Answer: C Explanation: Tuples are immutable - once created, their elements cannot be changed.
- What does this algorithm calculate? function calculate(n): if n <= 1: return n else: return calculate(n-1) + calculate(n-2) A) Factorial B) Fibonacci C) Power of 2 D) Sum of digits
Answer: B Explanation: This is the recursive Fibonacci sequence: F(n) = F(n-1) + F(n-2).
- Which is NOT a primitive data type? A) Integer B) String C) Boolean D) Array
Answer: D Explanation: Array is a composite data structure, not a primitive type.
- What will this code output? for i in range(5, 0, -1): print(i, end=" ") A) 5 4 3 2 1 B) 0 1 2 3 4 5 C) 5 4 3 2 1 0 D) 1 2 3 4 5
Answer: A
Answer: A Explanation: Array indexing is constant time due to direct memory addressing.
- Which is a dynamically typed language? A) Java B) C++ C) Python D) C#
Answer: C Explanation: Python determines variable types at runtime, making it dynamically typed.
- What does the 'break' statement do? A) Skips current iteration B) Exits the loop entirely C) Continues to next iteration D) Restarts the loop
Answer: B Explanation: 'break' immediately terminates the innermost loop.
- What is method overriding? A) Same method name, different parameters B) Child class redefining parent method C) Multiple methods with same name D) Static method definition
Answer: B Explanation: Overriding allows a subclass to provide a specific implementation of a method already defined in its parent class.
- Which is NOT a valid variable name in Python? A) _variable B) 2nd_value C) variable_name D) VariableName
Answer: B Explanation: Variable names cannot start with a digit.
- What will this return? def func(x=5): return x * 2
print(func()) A) 10 B) 5 C) Error D) None
Answer: A Explanation: Default parameter x=5 is used when no argument is provided, so 5*2=10.
- What is recursion? A) Function calling another function B) Function calling itself C) Infinite loop D) Parallel execution
Answer: B Explanation: Recursion occurs when a function calls itself to solve smaller instances.
- Which data structure is LIFO? A) Queue B) Stack C) Array D) Linked List
Answer: B Explanation: Stack is Last-In-First-Out (LIFO).
- What is an abstract class? A) Class that can't be instantiated B) Class with only methods C) Class without attributes D) Imported class
Answer: A Explanation: Abstract classes cannot be instantiated and often contain abstract methods.
- What does 'pass' do in Python? A) Skips code B) Placeholder for empty block C) Passes parameters D) Ends program
Answer: B Explanation: 'pass' is a null operation used as a placeholder.
D) Less memory usage
Answer: B Explanation: Linked lists can grow/shrink dynamically without reallocation.
- In a binary tree, what is a leaf node? A) Root node B) Node with no children C) Node with one child D) Largest node
Answer: B Explanation: Leaf nodes have no children.
- Which is FIFO? A) Stack B) Queue C) Tree D) Graph
Answer: B Explanation: Queue is First-In-First-Out (FIFO).
- What is a hash collision? A) Two keys map to same index B) Hash table is full C) Hash function error D) Key not found
Answer: A Explanation: Collision occurs when different keys produce the same hash value.
- What does this graph representation show? A = [[0,1,0],[1,0,1],[0,1,0]] A) Adjacency matrix B) Adjacency list C) Edge list D) Incidence matrix
Answer: A Explanation: This is an adjacency matrix for 3 nodes.
- Which tree traversal is root-left-right? A) In-order
B) Pre-order C) Post-order D) Level-order
Answer: B Explanation: Pre-order visits root, then left subtree, then right subtree.
- What is the height of a tree with one node? A) 0 B) 1 C) 2 D) Undefined
Answer: A Explanation: Height is number of edges from root to deepest leaf. Single node has height 0.
- Which is NOT a graph type? A) Directed B) Weighted C) Circular D) Connected
Answer: C Explanation: Circular is not a standard graph classification.
- What is a circular queue? A) Fixed-size, wraps around B) Unlimited size C) Stack-like queue D) Priority queue
Answer: A Explanation: Circular queues reuse empty slots when head advances.
- What is a binary search tree property? A) Left child < Parent < Right child B) All nodes have 2 children C) Complete tree D) Balanced tree
Answer: A Explanation: BST maintains ordering: left < parent < right.
- Which has O(1) average insert at end?
- What is an adjacency list? A) Array of linked lists B) 2D matrix C) Edge count array D) Vertex array
Answer: A Explanation: Each vertex has a list of adjacent vertices.
- Red-Black trees ensure: A) Perfect balance B) Approximate balance C) No duplicates D) Sorted order
Answer: B Explanation: They maintain approximate balance for efficient operations.
- Graph with no cycles is: A) Tree B) Complete graph C) Dense graph D) Directed graph
Answer: A Explanation: Tree is a connected acyclic graph.
- Which has worst-case O(n) search? A) Balanced BST B) Hash table C) Sorted array (binary search) D) Unsorted array (linear)
Answer: D Explanation: Linear search on unsorted array is O(n).
- What is a priority queue? A) FIFO with priorities B) LIFO with priorities C) Sorted by priority D) Random access
Answer: C Explanation: Elements are processed by priority, not insertion order.
- AVL trees differ from BST by: A) Self-balancing B) No ordering C) More children D) No root
Answer: A Explanation: AVL trees are self-balancing BSTs.
- Minimum spanning tree connects: A) All vertices, minimum weight B) Some vertices C) Maximum weight D) No cycles allowed
Answer: A Explanation: MST connects all vertices with minimum total edge weight.
- Which is a linear data structure? A) Tree B) Graph C) Array D) Network
Answer: C Explanation: Array stores elements in linear sequence.
- B-tree is optimized for: A) Disk storage B) Memory storage C) CPU cache D) Network transfer
Answer: A Explanation: B-trees minimize disk I/O operations.
- What is topological sorting for? A) Directed Acyclic Graphs B) Undirected graphs C) Weighted graphs D) Complete graphs
Answer: A
Answer: A Explanation: Trie stores strings with common prefixes.
SECTION 3: ALGORITHMS & COMPLEXITY (30 Questions)
- What is Big-O notation? A) Exact runtime B) Worst-case growth rate C) Best-case performance D) Average memory usage
Answer: B Explanation: Big-O describes upper bound of growth as input size increases.
- Binary search time complexity? A) O(1) B) O(log n) C) O(n) D) O(n²)
Answer: B Explanation: Each step halves the search space.
- Which sort has O(n log n) worst-case? A) Quick sort B) Merge sort C) Bubble sort D) Insertion sort
Answer: B Explanation: Merge sort is always O(n log n).
- What does Dijkstra's algorithm find? A) Shortest paths B) Minimum spanning tree C) Maximum flow D) Connected components
Answer: A Explanation: Dijkstra finds shortest paths from source to all vertices.
- Greedy algorithm characteristic? A) Always optimal B) Local optimal choices
C) Exhaustive search D) Backtracking
Answer: B Explanation: Makes locally optimal choice at each step.
- What is dynamic programming? A) Breaking into overlapping subproblems B) Random guessing C) Brute force D) Divide and conquer
Answer: A Explanation: Solves problems by combining solutions to overlapping subproblems.
- Traveling Salesman Problem complexity? A) O(n!) B) O(2^n) C) O(n²) D) O(n log n)
Answer: A Explanation: TSP has factorial complexity for exact solution.
- Which is NOT a sorting algorithm? A) Bubble sort B) Quick sort C) Depth-first sort D) Heap sort
Answer: C Explanation: Depth-first is graph traversal, not sorting.
- What is memoization? A) Storing computed results B) Memory allocation C) Garbage collection D) Cache clearing
Answer: A Explanation: Memoization caches function results to avoid recomputation.
- Best-case for comparison sorts? A) O(n log n)
A) Decidable B) Undecidable C) P problem D) NP problem
Answer: B Explanation: Turing proved halting problem is undecidable.
- Which algorithm uses "partition"? A) Quick sort B) Merge sort C) Bubble sort D) Selection sort
Answer: A Explanation: Quick sort partitions array around pivot.
- Backtracking is used for: A) Constraint satisfaction B) Sorting C) Searching D) Hashing
Answer: A Explanation: Backtracking solves CSPs by trying possibilities.
- What is heuristic? A) Rule of thumb B) Exact solution C) Random guess D) Proof method
Answer: A Explanation: Heuristic is a practical, not guaranteed optimal, approach.
- A* search uses: A) Heuristic + cost B) Random selection C) Exhaustive search D) Greedy only
Answer: A Explanation: f(n) = g(n) + h(n) where g is cost, h is heuristic.
- Which is stable sort? A) Merge sort B) Quick sort C) Heap sort D) Selection sort
Answer: A Explanation: Merge sort preserves relative order of equal elements.
- Time complexity of matrix multiplication? A) O(n³) B) O(n²) C) O(n log n) D) O(2^n)
Answer: A Explanation: Standard matrix multiplication is O(n³).
- What does BFS use? A) Queue B) Stack C) Heap D) Array
Answer: A Explanation: Breadth-First Search uses queue for traversal.
- Minimum comparisons to find max in array? A) n- B) n C) n/ D) log n
Answer: A Explanation: Need to compare each element (except first).
- Which is NOT a search algorithm? A) Linear B) Binary C) Exponential D) Fibonacci
Answer: D Explanation: Fibonacci is a sequence, not a search algorithm (though Fibonacci search exists).
Explanation: NP = problems where solutions can be verified quickly.
- What is approximation algorithm? A) Near-optimal solution B) Exact solution C) Random solution D) No solution
Answer: A Explanation: Provides solution close to optimal for hard problems.
SECTION 4: COMPUTER SYSTEMS & ARCHITECTURE (25 Questions)
- What does ALU do? A) Arithmetic/logic operations B) Memory access C) Control flow D) Input/output
Answer: A Explanation: Arithmetic Logic Unit performs calculations.
- Which is fastest memory? A) Registers B) Cache C) RAM D) SSD
Answer: A Explanation: Registers are in CPU, fastest but smallest.
- Von Neumann architecture has: A) Separate instruction/data memory B) Shared memory C) No memory D) Parallel processing
Answer: B Explanation: Single memory for both instructions and data.
- What is pipelining? A) Overlap instruction stages B) Multiple CPUs C) Faster clock
D) More cache
Answer: A Explanation: Multiple instructions in different stages simultaneously.
- Two's complement represents: A) Signed integers B) Floating point C) Characters D) Instructions
Answer: A Explanation: Standard method for signed binary integers.
- What is virtual memory? A) Disk as RAM extension B) Extra RAM C) CPU cache D) ROM
Answer: A Explanation: Uses disk space to extend apparent RAM.
- Which is volatile? A) RAM B) ROM C) SSD D) HDD
Answer: A Explanation: RAM loses data when powered off.
- What is cache hit? A) Data found in cache B) Cache miss C) Cache flush D) Cache write
Answer: A Explanation: Requested data is in cache.
- RISC vs CISC? A) RISC: simpler instructions B) CISC: simpler instructions