Computer Science JAMB Past Questions And Answers (Objectives and Theory)
Section A: Multiple Choice Questions
What does HTML stand for?
a) Hyper Text Markup Language
b) High Tech Markup Language
c) Hyperlink and Text Markup Language
d) Home Tool Markup Language
Answer: a) Hyper Text Markup Language
Which programming language is commonly used for building Android applications?
a) Java
b) Python
c) C++
d) Ruby
Answer: a) Java
What is the purpose of CSS in web development?
a) To define the structure of a web page
b) To add interactivity to a web page
c) To style the appearance of a web page
d) To manage databases on a web server
Answer: c) To style the appearance of a web page
Which data structure follows the Last In, First Out (LIFO) principle?
a) Queue
b) Stack
c) Linked List
d) Tree
Answer: b) Stack
What is the output of the following Python code snippet?
python
Copy code
print(3 * 4 + 5)
a) 17
b) 27
c) 32
d) 60
Answer: a) 17
Which of the following is NOT a type of sorting algorithm?
a) Bubble Sort
b) Merge Sort
c) Switch Sort
d) Quick Sort
Answer: c) Switch Sort
What does SQL stand for?
a) Structured Query Language
b) Simple Query Language
c) Script Query Language
d) Sequential Query Language
Answer: a) Structured Query Language
What is the purpose of the “if” statement in programming?
a) To repeat a block of code multiple times
b) To define a function
c) To make decisions based on conditions
d) To declare variables
Answer: c) To make decisions based on conditions
Which of the following is NOT a valid data type in Python?
a) Integer
b) Float
c) String
d) Boolean
Answer: d) Boolean
What is the purpose of a constructor in object-oriented programming?
a) To destroy objects
b) To initialize objects
c) To hide data within objects
d) To define methods for objects
Answer: b) To initialize objects
Section B: Theory Questions
Explain the concept of object-oriented programming (OOP) and discuss its advantages.
Answer: Object-oriented programming (OOP) is a programming paradigm based on the concept of “objects,” which can contain data and code. Objects interact with each other by sending messages. OOP promotes code reusability, modularity, and scalability. It also allows for easier maintenance and debugging of code.
Define the term “algorithm” and provide an example of a simple algorithm.
Answer: An algorithm is a step-by-step procedure or set of rules for solving a problem or accomplishing a task. An example of a simple algorithm is the “bubble sort” algorithm, which repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order.
What is the difference between a compiler and an interpreter?
Answer: A compiler translates the entire source code into machine code before execution, generating an executable file. An interpreter, on the other hand, translates the source code line by line into machine code and executes it immediately.
Explain the concept of data abstraction in programming and discuss its importance.
Answer: Data abstraction is the process of hiding the implementation details of a class and only showing the necessary features of an object. It allows programmers to focus on the essential characteristics of an object and ignore irrelevant details. Data abstraction promotes code reusability, modularity, and maintenance.
Describe the difference between static and dynamic memory allocation in programming.
Answer: Static memory allocation refers to the allocation of memory at compile time, where the size of memory required is known beforehand. Dynamic memory allocation, on the other hand, occurs at runtime and allows for the allocation and deallocation of memory as needed during program execution. Dynamic memory allocation provides flexibility but requires manual memory management.