NECO Computer Science Past Questions And Answers (Objective and Theory)
Section A: Multiple Choice Questions
What is the primary purpose of an index in a database?
A) Sort data alphabetically
B) Improve query performance
C) Encrypt sensitive information
D) Define data types
Answer: B
Which data structure uses First In, First Out (FIFO) order?
A) Stack
B) Linked list
C) Queue
D) Heap
Answer: C
In object-oriented programming, what does the term “encapsulation” refer to?
A) Hiding the implementation details of an object
B) Inheriting properties from multiple classes
C) Using interfaces to define behavior
D) Accessing data outside the class
Answer: A
What is the purpose of a firewall in computer networks?
A) Block unauthorized access
B) Accelerate data transfer
C) Increase network bandwidth
D) Encrypt data packets
Answer: A
Which of the following is a non-relational database management system?
A) MySQL
B) Oracle
C) MongoDB
D) PostgreSQL
Answer: C
What is the role of the “else” statement in programming?
A) Define a loop
B) Handle exceptions
C) Provide an alternative condition
D) Declare variables
Answer: C
Which algorithm is commonly used for finding the shortest path in a graph?
A) Depth-First Search (DFS)
B) Breadth-First Search (BFS)
C) Dijkstra’s algorithm
D) QuickSort
Answer: C
What is the purpose of garbage collection in programming languages like Java?
A) Optimize code execution
B) Manage memory automatically
C) Enable multi-threading
D) Implement error handling
Answer: B
Which programming paradigm promotes the use of mathematical functions and avoids changing state and mutable data?
A) Imperative
B) Object-Oriented
C) Functional
D) Procedural
Answer: C
What is a key characteristic of a RESTful API (Representational State Transfer)?
A) Stateless communication
B) Encapsulation of data
C) Strong data typing
D) Asynchronous messaging
Answer: A
Section B: Theory Questions
Explain the concept of recursion in computer science with an example.
Answer: Recursion is a programming technique where a function calls itself to solve a smaller instance of the same problem. Example: calculating factorial.
Define Big O notation and its significance in algorithm analysis.
Answer: Big O notation describes the upper bound of an algorithm’s time complexity in terms of its input size. It helps analyze and compare the efficiency of algorithms.
What is the difference between a stack and a queue in data structures?
Answer: A stack follows Last In, First Out (LIFO) order, while a queue follows First In, First Out (FIFO) order. Stacks are used for backtracking, and queues are used for breadth-first search.
Explain the concept of inheritance in object-oriented programming.
Answer: Inheritance allows a class to inherit properties and behaviors from another class, promoting code reusability and the creation of a hierarchy of classes.
What is the role of an interpreter in programming languages?
Answer: An interpreter translates high-level code into machine code and executes it line by line, allowing for immediate feedback and easier debugging compared to compilation.