WorksheetsComputer Science Quiz
Total questions: 87
Worksheet time: 46mins
What is the time complexity of binary search?
O(n)
O(log n)
O(n log n)
O(n²)
Which of the following is NOT a high-level programming language?
C
Python
Assembly
Java
What does OOP stand for?
Object-Oriented Processing
Object-Oriented Programming
Ordered Object Programming
Operator-Oriented Processing
What is the primary function of an operating system?
Perform arithmetic operations
Manage hardware resources
Design software applications
Control the internet
What is the full form of HTTP?
Hyper Transfer Text Protocol
Hyper Text Markup Language
Hyper Text Transfer Protocol
High Transfer Text Processing
What type of memory is volatile?
SSD
HDD
RAM
ROM
What is the extension of a Java bytecode file?
.java
.class
.jar
.exe
Which data structure uses LIFO (Last In, First Out)?
Queue
Stack
Linked List
Heap
Which of the following is not a valid data type in C?
int
float
boolean
char
What is the default return type of main() in C?
void
int
char
float
Which operator is used for dynamic memory allocation in C++?
malloc
new
alloc
allocate
What is the correct syntax for linking an external CSS file in HTML?
In JavaScript, what is the correct way to declare a variable?
var x = 5;
let x = 5;
const x = 5;
All of the above
What is the correct syntax for a for loop in C++?
for (i = 0; i < 10; i++)
for (int i = 0; i < 10; i++)
for (i = 0; i < 10; i++);
loop (i = 0; i < 10; i++)
What is Big-O notation used for?
Measuring the execution time of an algorithm
Sorting elements in an array
Defining variable names
None of the above
Which algorithm is used in Merge Sort?
Divide and Conquer
Dynamic Programming
Greedy Algorithm
Backtracking
In an operating system, what is a process?
A running program
A memory block
A CPU register
A file stored in RAM
Which of the following is an example of a preemptive scheduling algorithm in OS?
First Come First Serve (FCFS)
Shortest Job Next (SJN)
Round Robin (RR)
None of the above
Which of the following is an example of a cyber attack?
Firewall installation
DDoS attack
Data encryption
Software update
What will be the output of 5 / 2 in C (assuming int a = 5, b = 2; and printf("%d", a/b);)?
2.5
2
3
Error
What is the correct way to start an HTML document?
What is the main function of an operating system's kernel?
Provide an interface for users
Manage hardware resources
Run application programs
Display graphical elements
Which data structure is used in BFS (Breadth-First Search)?
Stack
Queue
Linked List
Heap
In SQL, what is the purpose of the GROUP BY clause?
To filter records based on a condition
To group records with the same values
To delete duplicate rows
To define relationships between tables
What is the full form of URL in computer networks?
Uniform Resource Link
Uniform Resource Locator
Universal Reference Link
Uniform Reference Locator
What will be the output of the following C code? int main() { int a = 10; printf("%d %d", a++, ++a); return 0; }
10 12
11 12
Undefined behavior
10 11
Which of the following is NOT a valid storage class in C?
auto
volatile
static
register
In C++, which operator cannot be overloaded?
+
-
::
*
What does the virtual keyword in C++ indicate?
The function can be overridden in derived classes
The function is executed at compile time
The function is only accessible in base class
The function cannot be inherited
What is the correct HTML structure for creating a form?
Which CSS property is used to create a flexible box layout?
display: flex
box-flex: 1
float: left
flex-container
What will be the output of typeof NaN in JavaScript?
number
undefined
NaN
null
What is closure in JavaScript?
A function that runs only once
A function inside another function with access to its outer variables
A function that executes asynchronously
A built-in method for objects
Which data structure is used in recursion?
Stack
Queue
Linked List
Heap
The time complexity of inserting an element in a binary heap is:
O(1)
O(n)
O(log n)
O(n log n)
Which sorting algorithm has the best average-case complexity?
Bubble Sort
Selection Sort
Merge Sort
Insertion Sort
Which of the following is NOT a page replacement algorithm?
FIFO
LRU
SSTF
Optimal
What is thrashing in an operating system?
Excessive swapping of processes in and out of memory
A condition where CPU utilization is 100%
A state where a process never gets executed
A memory leak in the system
The TCP/IP model has how many layers?
4
5
6
7
Which SQL query is used to remove all records from a table but keep the structure?
DELETE
DROP
TRUNCATE
REMOVE
In a relational database, a foreign key is used to:
Enforce referential integrity
Ensure data security
Create indexes
Speed up queries
Which normal form eliminates transitive dependencies?
1NF
2NF
3NF
BCNF
Which algorithm is used in TCP for congestion control?
Dijkstra's Algorithm
Sliding Window Protocol
Exponential Backoff Algorithm
Leaky Bucket Algorithm
Which data structure is used in level-order traversal of a tree?
Stack
Queue
Linked List
Heap
The worst-case time complexity of DFS (Depth First Search) is:
O(1)
O(log n)
O(n)
O(V + E)
What is the output of 10 << 2 in C?
40
20
2
80
In Deadlock Prevention, which of the following is a correct approach?
What is the output of 10 << 2 in C?
40
20
2
80
In Deadlock Prevention, which of the following is a correct approach?
Avoid circular wait
Increase CPU speed
Reduce memory size
Increase the number of processes
What is the main use of hashing in databases?
Storing sorted data
Quick data retrieval
Ensuring data integrity
Reducing data redundancy
The Bellman-Ford Algorithm is used for:
Finding a minimum spanning tree
Shortest path in graphs with negative weights
Sorting data
Page replacement in OS
In public-key cryptography, the private key is used for:
Encrypting messages
Decrypting messages
Both encryption and decryption
Generating hash functions
Which of the following is NOT an essential property of a transaction in DBMS?
Atomicity
Durability
Fragmentation
Isolation
Which of the following is an example of a NoSQL database?
MySQL
PostgreSQL
MongoDB
Oracle
The function of a firewall in computer networks is to:
Block unauthorized access
Encrypt network traffic
Speed up internet browsing
Store network logs
What is the main advantage of using a doubly linked list over a singly linked list?
Faster memory allocation
Allows traversal in both directions
Requires less memory
Easier to implement
Which of the following is a characteristic of Big-O notation?
Describes the worst-case time complexity
Always provides the exact runtime
Measures the number of variables in an algorithm
Only applies to recursive algorithms
What is the time complexity of Heap Sort in the worst case?
O(n)
O(n log n)
O(log n)
O(n²)
Which of the following algorithms is NOT used for deadlock avoidance?
Banker's Algorithm
Resource Allocation Graph
Peterson's Algorithm
Wait-Die Scheme
Which of the following is an NP-complete problem?
Matrix Multiplication
Travelling Salesman Problem
Binary Search
Merge Sort
Which of the following is used in Open Addressing for collision resolution?
Separate Chaining
Quadratic Probing
AVL Trees
B-Trees
Which data structure is used in the implementation of a recursive function?
Queue
Stack
Heap
Linked List
In subnetting, the CIDR notation 192.168.1.0/26 means:
62 usable IP addresses
64 usable IP addresses
126 usable IP addresses
30 usable IP addresses
Which scheduling algorithm can lead to starvation?
FCFS
Round Robin
Shortest Job Next
Multilevel Queue
In database indexing, what is a B+ tree used for?
Sorting records
Reducing redundancy
Faster search and retrieval
Normalization
What is the default scope of a variable declared inside a function in C?
Global
Local
Static
Register
Which page replacement algorithm gives the lowest page fault rate?
FIFO
Optimal Page Replacement
LRU
Second Chance
Which protocol is used for secure online transactions?
HTTP
FTP
SSL/TLS
SMTP
Which type of SQL join returns only matching rows from both tables?
INNER JOIN
LEFT JOIN
RIGHT JOIN
FULL JOIN
Which layer of the OSI model is responsible for routing?
Data Link Layer
Transport Layer
Network Layer
Application Layer
What is the worst-case time complexity of inserting a node in an AVL tree?
O(1)
O(log n)
O(n)
O(n log n)
Which type of attack involves injecting malicious SQL statements?
Phishing
SQL Injection
Cross-Site Scripting
Denial of Service
Which of the following has the highest precedence in C?
Multiplication (*)
Logical AND (&&)
Bitwise OR (|)
Assignment (=)
What is the main disadvantage of using an array over a linked list?
More memory consumption
Difficult random access
Complex insertion/deletion
Slower traversal
Which of the following is true for Turing Machines?
They can only solve problems in polynomial time
They define the limits of what is computable
They are slower than finite automata
They can execute only linear-time algorithms
In TCP, what is the initial congestion window size typically set to?
1 MSS
2 MSS
4 MSS
10 MSS
Which of the following can cause a memory leak in C++?
Using malloc instead of new
Forgetting to free dynamically allocated memory
Declaring a variable inside a function
Using pointers correctly
Which sorting algorithm is best suited for linked lists?
Merge Sort
QuickSort
Heap Sort
Bubble Sort
Which of the following is NOT a valid form of polymorphism in C++?
Function Overloading
Operator Overloading
Method Overriding
Destructor Overloading
What is the minimum number of states required in a DFA to accept the language of binary strings ending with "101"?
2
3
4
5
Which of the following is an undecidable problem?
Sorting an array
Finding the shortest path in a graph
The Halting Problem
Multiplication of matrices
Which is the best data structure for implementing a priority queue?
Stack
Queue
Heap
Linked List
What is the major disadvantage of the Waterfall Model in software engineering?
Requires too much documentation
High flexibility
No clear project structure
Difficult to manage large projects
Which technique is used for handling collisions in hashing?
Open Addressing
Binary Search
Depth-First Search
Breadth-First Search
What does the Big-O notation measure?
Execution time of an algorithm in the best case
Execution time of an algorithm in the worst case
Number of inputs an algorithm can handle
Average execution time
Which property does Prim's algorithm satisfy in finding a Minimum Spanning Tree?
Greedy property
Dynamic programming
Divide and conquer
Backtracking
Which of the following is used in Unix/Linux for inter-process communication?
Sockets
Threads
Signals
File descriptors
