Font size
WorksheetsComputer Science Quiz
Total questions: 20
Worksheet time: 13mins
What is the output of the following C code snippet?
Which of the following algorithms is used to find the shortest path in a weighted graph?
Breadth-First Search (BFS)
Depth-First Search (DFS)
Dijkstra's Algorithm
Kruskal's Algorithm
Which of the following sorting algorithms has the best average-case performance for large datasets?
Quick Sort
Merge Sort
Bubble Sort
Insertion Sort
Which data structure is used in implementing recursion?
Stack
Queue
Linked List
Tree
Which of the following is not a component of a CPU?
Arithmetic Logic Unit (ALU)
Control Unit (CU)
Memory Unit
Register
Which of the following is true about the IP protocol?
It is connection-oriented
It guarantees data delivery
It is reliable
It is a best-effort delivery service
In which of the following scenarios is a hash table most efficient?
When searching for an element
When elements need to be sorted
When inserting elements in a specific order
When elements need to be traversed in order
What is the main advantage of using a linked list over an array?
Constant time access to elements
Dynamic size and ease of insertion/deletion
Better cache performance
Fixed size
What does a foreign key in a relational database do?
Ensures that each value in a column is unique
Establishes a link between the data in two tables
Provides a default value for a column
Ensures that each value in a column is not null
Which SQL clause is used to filter records based on a specified condition?
SELECT
WHERE
FROM
JOIN
Which of the following best describes polymorphism in object-oriented programming?
Encapsulation of data
Ability to inherit methods and properties from a parent class
The ability of different classes to respond to the same function call
None of the above
Which of the following is a disadvantage of the Waterfall model in software development?
Clear milestones
Flexibility to change requirements
Easy to manage
Well-suited for large projects
In computer networks, what is the main function of the transport layer?
Routing of data packets
Error detection and correction
Flow control and reliability
Physical transmission of data
What is the time complexity of inserting an element in a Binary Search Tree (BST) in the worst case?
O(1)
O(log n)
O(n)
O(n log n)
What is the purpose of the 'volatile' keyword in C/C++?
To prevent a variable from being modified
To indicate that a variable can be modified in ways not anticipated by the compiler
To specify a default value for a variable
To ensure that a variable is initialized before use
In operating systems, what is thrashing?
When the CPU is idle
When a process is terminated abruptly
Excessive swapping of pages between main memory and disk
When a system runs out of memory
In relational databases, what does the ACID acronym stand for?
Addition, Consistency, Isolation, Durability
Atomicity, Consistency, Isolation, Durability
Atomicity, Consistency, Information, Durability
Addition, Consistency, Information, Durability
Which of the following is a characteristic of a B-tree?
All leaf nodes are at the same level
It is a binary tree
Nodes have at most two children
All nodes contain the same number of keys
Which of the following statements about machine learning is true?
Supervised learning requires labeled data
Unsupervised learning requires labeled data
Reinforcement learning does not involve a reward system
All of the above
What is a lambda expression in programming?
A function with no parameters
An anonymous function
A function that always returns an integer
A function that never terminates
