40 MCQs
40 MCQs
Internship
Practice Questions covering DBMS, Computer Networking, Data Structures, Operating Systems, and
Programming Fundamentals
2. What is the purpose of a Primary Key in a database table? a) To create indexes automatically
b) To uniquely identify each row in a table
c) To establish relationships between tables
d) To improve query performance
4. In SQL, which command is used to remove a table from the database? a) DELETE TABLE
b) REMOVE TABLE
c) DROP TABLE
d) TRUNCATE TABLE
5. What type of join returns all rows from both tables, filling with NULL where no match
exists? a) INNER JOIN
b) LEFT JOIN
c) RIGHT JOIN
d) FULL OUTER JOIN
12. Which layer of the OSI model is responsible for routing? a) Physical Layer
b) Data Link Layer
c) Network Layer
d) Transport Layer
18. Which data structure follows the LIFO (Last In First Out) principle? a) Queue
b) Stack
c) Array
d) Linked List
19. What is the worst-case time complexity of Quick Sort? a) O(n log n)
b) O(n²)
c) O(n)
d) O(log n)
20. In which traversal of a Binary Search Tree do we get elements in sorted order? a) Preorder
b) Inorder
c) Postorder
d) Level order
23. What is the time complexity of inserting an element at the end of a dynamic array? a)
O(1) amortized
b) O(n)
c) O(log n)
d) O(n log n)
24. In a min-heap, the parent node is: a) Greater than its children
b) Smaller than its children
c) Equal to its children
d) No specific relationship
26. Which scheduling algorithm gives the shortest average waiting time? a) FCFS (First Come
First Serve)
b) SJF (Shortest Job First)
c) Round Robin
d) Priority Scheduling
28. Which of the following is NOT a type of system call? a) Process control
b) File management
c) Memory allocation
d) Communication
30. Which algorithm is used for page replacement in virtual memory? a) FIFO
b) LRU
c) Optimal
d) All of the above
31. What is a race condition? a) Competition between processes for CPU time
b) Multiple processes accessing shared data simultaneously
c) Processes running faster than expected
d) Memory access conflicts
32. Which of the following is a synchronization primitive? a) Semaphore
b) Mutex
c) Monitor
d) All of the above
int x = 5;
printf("%d", ++x + x++);
a) 11
b) 12
c) 13
d) Undefined behavior
35. What is the difference between '==' and '===' in JavaScript? a) No difference
b) == checks type and value, === checks only value
c) == checks only value, === checks type and value
d) === is used for strings only
36. What is method overloading? a) Multiple methods with the same name but different
parameters
b) Redefining a method in a subclass
c) Creating multiple classes with the same name
d) Using the same method in multiple files
2. Answer: b) To uniquely identify each row in a table Explanation: Primary key ensures each
row has a unique identifier, preventing duplicate records and enabling efficient data retrieval.
3. Answer: b) 2NF Explanation: Second Normal Form (2NF) eliminates partial dependency by
ensuring non-key attributes depend on the entire primary key, not just part of it.
4. Answer: c) DROP TABLE Explanation: DROP TABLE permanently removes the entire table
structure and data. DELETE removes rows, TRUNCATE removes all rows but keeps structure.
5. Answer: d) FULL OUTER JOIN Explanation: FULL OUTER JOIN returns all rows from both
tables, using NULL values where no matching data exists in either table.
6. Answer: d) All of the above Explanation: Triggers, constraints, and stored procedures all help
maintain data integrity by enforcing rules and validating data.
7. Answer: b) A key that references the primary key of another table Explanation: Foreign key
creates relationships between tables by referencing the primary key of another table, ensuring
referential integrity.
8. Answer: c) HAVING Explanation: HAVING filters groups created by GROUP BY clause, while
WHERE filters individual rows before grouping.
11. Answer: c) 80 Explanation: HTTP uses port 80 by default. HTTPS uses port 443, FTP uses port
21, Telnet uses port 23.
12. Answer: c) Network Layer Explanation: Network Layer (Layer 3) handles routing between
different networks using IP addresses.
13. Answer: a) Transmission Control Protocol Explanation: TCP stands for Transmission Control
Protocol, providing reliable, connection-oriented communication.
14. Answer: b) UDP Explanation: UDP (User Datagram Protocol) is connectionless - it sends data
without establishing a connection first.
15. Answer: a) 32 bits Explanation: IPv4 addresses are 32 bits long, written as four 8-bit numbers
(e.g., 192.168.1.1). IPv6 uses 128 bits.
16. Answer: c) Router Explanation: Routers operate at Network Layer, making routing decisions
based on IP addresses. Hubs/repeaters work at Physical Layer, switches at Data Link Layer.
18. Answer: b) Stack Explanation: Stack follows LIFO - the last element added is the first one
removed. Queue follows FIFO.
19. Answer: b) O(n²) Explanation: Quick Sort's worst case occurs when pivot is always the
smallest/largest element, leading to quadratic time.
20. Answer: b) Inorder Explanation: Inorder traversal of BST visits nodes in ascending order: left
subtree → root → right subtree.
21. Answer: c) O(n) Explanation: Merge Sort needs extra space to store the divided arrays during
merging, requiring linear space.
22. Answer: d) Tree Explanation: Trees are hierarchical (non-linear) structures. Arrays, stacks, and
queues are linear data structures.
23. Answer: a) O(1) amortized Explanation: Most insertions at end are O(1), but occasionally
array needs resizing (O(n)). Averaged over many operations, it's O(1).
24. Answer: b) Smaller than its children Explanation: In min-heap, parent is always smaller than
its children. In max-heap, parent is larger than children.
Operating Systems Questions (25-32)
25. Answer: a) A situation where processes are waiting indefinitely for resources Explanation:
Deadlock occurs when processes form a circular wait for resources, causing all to wait forever.
26. Answer: b) SJF (Shortest Job First) Explanation: SJF minimizes average waiting time by
executing shorter jobs first, proven mathematically optimal.
27. Answer: b) To provide more physical memory than actually available Explanation: Virtual
memory uses disk space to simulate more RAM, allowing larger programs to run on systems with
limited physical memory.
28. Answer: c) Memory allocation Explanation: Memory allocation is handled by system calls like
malloc(), but it's not a separate category. The main categories are process control, file management,
and communication.
29. Answer: b) Excessive paging activity Explanation: Thrashing occurs when system spends
more time swapping pages than executing processes, severely degrading performance.
30. Answer: d) All of the above Explanation: FIFO, LRU (Least Recently Used), and Optimal are all
valid page replacement algorithms used in virtual memory management.
31. Answer: b) Multiple processes accessing shared data simultaneously Explanation: Race
condition occurs when multiple processes access shared resources concurrently, leading to
unpredictable results.
32. Answer: d) All of the above Explanation: Semaphores, mutexes, and monitors are all
synchronization primitives used to coordinate access to shared resources.
34. Answer: d) Compilation Explanation: The main OOP principles are Encapsulation, Inheritance,
Polymorphism, and Abstraction. Compilation is a process, not a principle.
35. Answer: c) == checks only value, === checks type and value Explanation: In JavaScript, ==
performs type coercion (converts types), while === checks both type and value without conversion.
36. Answer: a) Multiple methods with the same name but different parameters Explanation:
Method overloading allows same method name with different parameter types/counts. Overriding
is redefining in subclass.
37. Answer: b) O(log n) Explanation: Binary search divides search space in half at each step,
resulting in logarithmic time complexity.
38. Answer: c) Missing semicolon Explanation: Missing semicolon is detected during
compilation. Others (division by zero, array bounds, null pointer) occur during runtime.
39. Answer: b) A function calling itself Explanation: Recursion is when a function calls itself with
modified parameters, often used to solve problems that can be broken into smaller similar
problems.
40. Answer: b) Stack Explanation: Local variables are stored in stack memory, which is
automatically managed and cleaned up when function ends. Heap stores dynamically allocated
memory.
Note: These questions are designed to simulate the difficulty level and topics covered in Odessa
Company's online assessment for Associate Software Engineer Internship positions. Practice these
concepts thoroughly and understand the reasoning behind each answer.