Computer science NABTEB exam past questions and answers
Here they are;
Question: What is the time complexity of the quicksort algorithm?
a) O(n)
b) O(n log n)
c) O(n^2)
d) O(log n)
Answer: b) O(n log n)
Question: In object-oriented programming, what is encapsulation?
a) Inheritance
b) Data hiding
c) Polymorphism
d) Abstraction
Answer: b) Data hiding
Question: Which data structure follows the Last In, First Out (LIFO) principle?
a) Queue
b) Stack
c) Linked List
d) Tree
Answer: b) Stack
Question: What does SQL stand for?
a) Structured Query Language
b) Simple Question Language
c) System Query Language
d) Sequential Question Language
Answer: a) Structured Query Language
Question: Which sorting algorithm has a worst-case time complexity of O(n^2)?
a) Merge Sort
b) Bubble Sort
c) Insertion Sort
d) Radix Sort
Answer: b) Bubble Sort
Question: What is the purpose of an index in a database?
a) Ensure data integrity
b) Improve query performance
c) Define table relationships
d) Enforce primary key constraints
Answer: b) Improve query performance
Question: Which of the following is a dynamically-typed programming language?
a) C++
b) Java
c) Python
d) C#
Answer: c) Python
Question: What is a binary tree?
a) A tree with only one node
b) A tree with two children for each node
c) A tree with no root
d) A tree with no leaves
Answer: b) A tree with two children for each node
Question: What is a DNS (Domain Name System) used for?
a) File storage
b) Network security
c) Web browsing
d) Email communication
Answer: c) Web browsing
Question: Which type of testing is performed to validate that a software system meets its specified requirements?
a) Unit testing
b) Integration testing
c) System testing
d) Acceptance testing
Answer: c) System testing
Question: What is the purpose of the "this" keyword in object-oriented programming?
a) Referencing the current instance of a class
b) Declaring a new variable
c) Accessing static members
d) Implementing interfaces
Answer: a) Referencing the current instance of a class
Question: Which protocol is used for secure communication over a computer network?
a) FTP (File Transfer Protocol)
b) HTTP (Hypertext Transfer Protocol)
c) HTTPS (Hypertext Transfer Protocol Secure)
d) SMTP (Simple Mail Transfer Protocol)
Answer: c) HTTPS (Hypertext Transfer Protocol Secure)
Question: What is the role of a compiler in programming?
a) Execute code line by line
b) Translate high-level code into machine code
c) Debugging source code
d) Manage memory allocation
Answer: b) Translate high-level code into machine code
Question: What is a deadlock in operating systems?
a) A situation where two processes continually swap data
b) A state where a process cannot proceed because it's waiting for a resource held by another process
c) A process that has terminated unexpectedly
d) A security breach in the operating system
Answer: b) A state where a process cannot proceed because it's waiting for a resource held by another process
Question: What is a NoSQL database?
a) Database without tables
b) Database with only numeric data
c) Database without relationships
d) Database without a query language
Answer: c) Database without relationships
Question: Which design pattern is used to ensure a class has only one instance and provides a global point of access to it?
a) Observer pattern
b) Singleton pattern
c) Factory pattern
d) Decorator pattern
Answer: b) Singleton pattern
Question: What is a firewall in the context of computer networks?
a) Hardware device for printing documents
b) Software for creating 3D graphics
c) Security system to monitor and control incoming/outgoing network traffic
d) Data storage device
Answer: c) Security system to monitor and control incoming/outgoing network traffic
Question: In binary, what does the number 101011 represent?
a) 43
b) 53
c) 63
d) 73
Answer: a) 43
Question: Which programming paradigm emphasizes immutability and functional composition?
a) Object-oriented programming
b) Procedural programming
c) Functional programming
d) Declarative programming
Answer: c) Functional programming
Question: What is the purpose of a foreign key in a relational database?
a) Ensure data consistency
b) Create a copy of a table
c) Establish a link between two tables
d) Define a primary key constraint
Answer: c) Establish a link between two tables
Post a Comment