0% found this document useful (0 votes)
92 views43 pages

Kickdrum Mcqs

Uploaded by

AMAN AGARWAL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views43 pages

Kickdrum Mcqs

Uploaded by

AMAN AGARWAL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1. OOP – Which of the following is NOT a feature of OOP?

• a) Encapsulation ✅ (Feature: data hiding & wrapping methods with data)

• b) Polymorphism ✅ (Feature: compile-time & runtime polymorphism)

• c) Abstraction ✅ (Feature: showing essential details, hiding implementation)

• d) Compilation ❌ (NOT a feature of OOP; it’s a general program execution step)

Answer: d) Compilation

2. DBMS – Which SQL statement is used to fetch records with a condition?

• a) SELECT ... FROM ... WHERE ✅ (Correct syntax to lter rows)

• b) FETCH ... WHERE ... ❌ (FETCH used with cursors, not ltering)

• c) GET ... FROM ... ❌ (No such SQL keyword)

• d) FIND ... FROM ... ❌ (No such SQL keyword)

Answer: a) SELECT ... FROM ... WHERE

3. Networks – Which layer of the OSI model ensures reliable data transfer (error
recovery)?

• a) Network ❌ (Deals with routing, addressing)

• b) Transport ✅ (Ensures reliability: ACK, retransmission, TCP)

• c) Data Link ❌ (Error detection & correction locally, but not end-to-end reliability)

• d) Session ❌ (Establishes/manage sessions, not error handling)

Answer: b) Transport

4. OS – Context switching happens between:

• a) User and Kernel Mode ❌ (Mode switching, not process context switch)

• b) Two processes ✅ (Context switch = save state of one process, load another)
fi
fi
• c) Main memory and cache ❌ (This is memory hierarchy access, not context)

• d) CPU and I/O device ❌ (That’s I/O switching, not context switching)

Answer: b) Two processes

5. OOP – Runtime Polymorphism in C++ is achieved by:

• a) Function Overloading ❌ (Compile-time polymorphism)

• b) Virtual Functions ✅ (Used for overriding and late binding)

• c) Friend Functions ❌ (Access modi er, no polymorphism)

• d) Inline Functions ❌ (Code expansion, no polymorphism)

Answer: b) Virtual Functions

6. DBMS – What does TRUNCATE do in SQL?

• a) Deletes speci c rows based on condition ❌ (That’s DELETE with WHERE)

• b) Removes all rows but keeps table structure ✅ (TRUNCATE empties table quickly)

• c) Drops the table completely ❌ (That’s DROP)

• d) Removes selected columns ❌ (That’s ALTER TABLE DROP COLUMN)

Answer: b) Removes all rows but keeps table structure

7. Networks – Which IP address range is used for private networks?

• a) 8.8.8.8 ❌ (Public Google DNS)

• b) 192.168.x.x ✅ (Private range per RFC 1918)

• c) 255.255.255.255 ❌ (Broadcast address)

• d) 0.0.0.0 ❌ (Default route / unspeci ed)

Answer: b) 192.168.x.x

(Trick: Remember 3 private ranges: 10.x.x.x, 172.16–31.x.x, 192.168.x.x. The question picked the
most common one)
fi
fi
fi
8. DSA – What is the time complexity of binary search?

• a) O(n) ❌ (That’s linear search)

• b) O(log n) ✅ (Divide & conquer halves search space each time)

• c) O(n log n) ❌ (Sorting complexity, not searching)

• d) O(1) ❌ (Only if array size = 1; generally false)

Answer: b) O(log n)

9. DBMS – Which normal form eliminates partial dependency?

• a) 1NF ❌ (Removes repeating groups, atomicity only)

• b) 2NF ✅ (Eliminates partial dependency: non-prime attribute depends only on part of


composite key)

• c) 3NF ❌ (Removes transitive dependency)

• d) BCNF ❌ (Stricter version of 3NF)

Answer: b) 2NF

10. C++ – What happens if you do not de ne a destructor explicitly?

• a) Compilation error ❌ (Compiler provides one, so no error)

• b) Memory leak always ❌ (Not always; only if class uses dynamic memory without delete)

• c) Compiler provides default destructor ✅ (Correct; does shallow cleanup)

• d) Program crashes ❌ (Not necessarily)

Answer: c) Compiler provides default destructor

11. OS – Which scheduling algorithm may cause starvation?

• a) Round Robin ❌ (Fair; avoids starvation)

• b) FCFS ❌ (No starvation; processes run in order)


fi
• c) Shortest Job Next (SJF) ❌ (Can cause starvation, but mainly for long jobs in non-
preemptive)

• d) Priority (Preemptive) ✅ (Low-priority processes may never get CPU → starvation)

Answer: d) Priority (Preemptive)

12. Networks – ARP is used to:

• a) Map IP address to MAC address ✅ (Correct function of ARP)

• b) Map MAC address to IP address ❌ (That’s RARP)

• c) Resolve domain names ❌ (That’s DNS)

• d) Encrypt packets ❌ (That’s IPSec, SSL, etc.)

Answer: a) Map IP address to MAC address

13. C++ STL – Which container provides constant time insertion/removal at


both ends?

• a) vector ❌ (Fast push_back, but push_front = O(n))

• b) deque ✅ (Double-ended queue; O(1) at both ends)

• c) map ❌ (Balanced BST, O(log n) for insertion/removal)

• d) set ❌ (Also O(log n))

Answer: b) deque

14. OS – Critical section problem is solved by:

• a) Paging ❌ (Memory management)

• b) Mutual Exclusion ✅ (Ensures only one process enters critical section at a time)

• c) Spooling ❌ (Buffering technique, not synchronization)

• d) Fragmentation ❌ (Memory issue, not concurrency)

Answer: b) Mutual Exclusion


15. DBMS – Which is true about a primary key?

• a) Can have NULL values ❌ (NOT allowed)

• b) Can have duplicate values ❌ (Must be unique)

• c) Is unique and NOT NULL ✅ (De nition of primary key)

• d) Is always foreign key ❌ (Foreign key is reference to another table’s PK)

Answer: c) Is unique and NOT NULL

A — Object Oriented Programming (20 Qs)


1. Which of these is NOT an OOP principle?
a) Encapsulation
b) Polymorphism
c) Abstraction
d) Compilation
Answer: d) Compilation

2. Which concept binds data and functions together?


a) Encapsulation
b) Polymorphism
c) Abstraction
d) Inheritance
Answer: a) Encapsulation

3. Runtime Polymorphism in C++ is achieved by:


a) Function Overloading
b) Virtual Functions
c) Inline Functions
d) Friend Functions
Answer: b) Virtual Functions

4. Which feature allows one class to use properties of another class?


a) Inheritance
b) Polymorphism
c) Encapsulation
d) Data Hiding
Answer: a) Inheritance

5. Method Overloading means:


a) Same name, same parameters
b) Same name, different parameters
fi
c) Different name, same parameters
d) Same name, different classes only
Answer: b) Same name, different parameters

6. Which keyword prevents inheritance in Java?


a) private
b) static
c) nal
d) abstract
Answer: c) nal

7. Which OOP concept hides internal details from the user?


a) Encapsulation
b) Polymorphism
c) Abstraction
d) Inheritance
Answer: c) Abstraction

8. Which access speci er allows visibility only within class?


a) public
b) protected
c) private
d) default
Answer: c) private

9. Which relationship is expressed as “has-a”?


a) Inheritance
b) Composition
c) Aggregation
d) Overloading
Answer: b) Composition

10. Which statement is TRUE for constructors?


a) Can return a value
b) Called automatically on object creation
c) Must be static
d) Cannot be overloaded
Answer: b) Called automatically on object creation

11. In C++, destructors:


a) Must be explicitly called
b) Are called automatically when object goes out of scope
c) Cannot be de ned
d) Can have parameters
Answer: b) Are called automatically

12. Which of these do not allows multiple inheritance?


a) Java interfaces
b) Java classes
c) Python classes
d) C++ classes
Answer: d) Java classes
fi
fi
fi
fi
13. Dynamic dispatch happens at:
a) Compile time
b) Runtime
c) Link time
d) Preprocessing
Answer: b) Runtime

14. Default visibility for class members in C++ is:


a) private
b) public
c) protected
d) package
Answer: a) private

15. Which OOP feature helps in code reusability?


a) Encapsulation
b) Polymorphism
c) Inheritance
d) Abstraction
Answer: c) Inheritance

16. Interfaces can have which type of methods (Java 8+)?


a) Abstract only
b) Static only
c) Abstract + Default + Static
d) Only nal
Answer: c) Abstract + Default + Static

17. Which principle is used to avoid exposing internal representation?


a) Abstraction
b) Encapsulation
c) Overloading
d) Inheritance
Answer: b) Encapsulation

18. Function Overriding needs:


a) Same method name and parameters in parent and child
b) Same method name but different parameters
c) Static methods
d) Final methods
Answer: a) Same name and parameters

19. Which keyword in C++ enables run-time polymorphism?


a) override
b) friend
c) virtual
d) static
Answer: c) virtual

20. Which class cannot be instantiated?


a) Abstract class
b) Final class
c) Interface
fi
d) Both a and c
Answer: d) Both a and c

B — Data Structures & Algorithms (20 Qs)


21. Time complexity to push/pop from stack (array based):
a) O(1)
b) O(n)
c) O(log n)
d) O(n log n)
Answer: a) O(1)

22. Which data structure follows FIFO?


a) Stack
b) Queue
c) Heap
d) Graph
Answer: b) Queue

23. Search complexity in a balanced BST:


a) O(n)
b) O(log n)
c) O(n log n)
d) O(1)
Answer: b) O(log n)

24. Worst-case search time in a hash table:


a) O(1)
b) O(log n)
c) O(n)
d) O(n log n)
Answer: c) O(n)

25. Accessing an array element by index is:


a) O(1)
b) O(n)
c) O(log n)
d) O(n²)
Answer: a) O(1)

26. Inserting at head of linked list takes:


a) O(1)
b) O(n)
c) O(log n)
d) O(n²)
Answer: a) O(1)

27. Which data structure is used for BFS traversal?


a) Stack
b) Queue
c) Heap
d) Priority Queue
Answer: b) Queue

28. Which data structure is used for DFS (iterative)?


a) Queue
b) Stack
c) Heap
d) Map
Answer: b) Stack

29. Which of these sorts is stable?


a) Merge Sort
b) Quick Sort
c) Heap Sort
d) Selection Sort
Answer: a) Merge Sort

30. Best case complexity of Insertion Sort:


a) O(n)
b) O(n log n)
c) O(n²)
d) O(1)
Answer: a) O(n)

31. Which algorithm uses Divide & Conquer?


a) Bubble Sort
b) Merge Sort
c) Selection Sort
d) Counting Sort
Answer: b) Merge Sort

32. Heap is typically used to implement:


a) Queue
b) Stack
c) Priority Queue
d) Hash Map
Answer: c) Priority Queue

33. Graph cycle detection (DFS) uses:


a) Queue
b) Recursion stack
c) Min-heap
d) Hash table only
Answer: b) Recursion stack

34. Hash collisions are handled by:


a) Open addressing
b) Chaining
c) Both a & b
d) None
Answer: c) Both a & b
35. Which traversal gives sorted output in BST?
a) Preorder
b) Postorder
c) Inorder
d) Level-order
Answer: c) Inorder

36. Which is not a self-balancing BST?


a) AVL Tree
b) Red-Black Tree
c) B-Tree
d) Binary Heap
Answer: d) Binary Heap

37. Space complexity of DFS on graph (V vertices):


a) O(1)
b) O(V)
c) O(V+E)
d) O(log V)
Answer: b) O(V)

38. Kruskal’s algorithm uses:


a) Greedy approach
b) Dynamic programming
c) Backtracking
d) Divide and conquer
Answer: a) Greedy approach

39. Dijkstra’s algorithm fails with:


a) Undirected graph
b) Directed graph
c) Negative weight edges
d) Positive weight edges
Answer: c) Negative weight edges

40. Which algorithm nds MST?


a) Floyd Warshall
b) Dijkstra
c) Prim’s
d) Bellman Ford
Answer: c) Prim’s

41. Detect cycle in undirected graph uses:


a) DFS b) BFS c) Union-Find d) All
Answer: d

C — DBMS & SQL (20 Qs)


41. Which SQL command removes all rows but keeps structure?
a) DELETE
b) DROP
c) TRUNCATE
fi
d) CLEAR
Answer: c) TRUNCATE

42. Which is a DDL command?


a) SELECT
b) INSERT
c) UPDATE
d) CREATE
Answer: d) CREATE

43. Which normal form removes partial dependency?


a) 1NF
b) 2NF
c) 3NF
d) BCNF
Answer: b) 2NF

44. Primary Key can have:


a) NULL values
b) Duplicate values
c) Unique + NOT NULL
d) Only duplicates
Answer: c) Unique + NOT NULL

45. Foreign key references:


a) Another table’s primary key
b) Same table’s attribute
c) Unique index
d) None
Answer: a) Another table’s primary key

46. Which join returns all rows from both tables?


a) INNER JOIN
b) LEFT JOIN
c) FULL OUTER JOIN
d) CROSS JOIN
Answer: c) FULL OUTER JOIN

47. ACID property 'A' stands for:


a) Association
b) Atomicity
c) Accuracy
d) Aggregation
Answer: b) Atomicity

48. Which SQL clause groups rows?


a) GROUP BY
b) HAVING
c) ORDER BY
d) DISTINCT
Answer: a) GROUP BY
49. Which clause lters after aggregation?
a) WHERE
b) HAVING
c) GROUP BY
d) ORDER BY
Answer: b) HAVING

50. Candidate key is:


a) Primary key only
b) Minimal set of attributes that can uniquely identify tuple
c) Alternate key
d) Super key + foreign key
Answer: b) Minimal set of attributes

51. Which is faster for searching large table?


a) Index
b) View
c) Trigger
d) Cursor
Answer: a) Index

52. Which constraint enforces uniqueness?


a) CHECK
b) UNIQUE
c) DEFAULT
d) FOREIGN
Answer: b) UNIQUE

53. Deadlock occurs in DBMS due to:


a) Transactions requesting resources in circular wait
b) Starvation
c) Rollback
d) Lost update
Answer: a) Circular wait

54. Which level of isolation avoids Dirty Read?


a) Read Uncommitted
b) Read Committed
c) Repeatable Read
d) Serializable
Answer: b) Read Committed

55. SQL command to rename table:


a) RENAME TABLE old TO new
b) ALTER TABLE old RENAME TO new
c) MODIFY TABLE old AS new
d) UPDATE TABLE old=new
Answer: b) ALTER TABLE ... RENAME TO

56. Which is NOT part of ACID?


a) Durability
b) Isolation
c) Deadlock
fi
d) Consistency
Answer: c) Deadlock

57. Natural join joins on:


a) Matching column names & values
b) All rows
c) Only PK-FK
d) Random columns
Answer: a) Matching column names & values

58. View in SQL is:


a) Virtual table
b) Physical table
c) Temporary table only
d) Constraint
Answer: a) Virtual table

59. Which schedule is serializable?


a) Con icting read/write but same result
b) Produces same result as serial schedule
c) No concurrency
d) Rollback schedule
Answer: b) Produces same result as serial schedule

60. Which indexing is used in DBMS?


a) B-tree / B+ tree
b) Hash table only
c) Array only
d) Linked list
Answer: a) B-tree / B+ tree

D — Operating Systems (40 Qs)


61. Which part of OS manages process scheduling?
a) File System
b) Kernel
c) Shell
d) Device Driver
Answer: b) Kernel

62. Context switching happens between:


a) Two processes
b) Memory & CPU
c) User & Kernel mode only
d) File & Device I/O
Answer: a) Two processes
fl
63. Which scheduling algorithm can cause starvation?
a) Round Robin
b) First Come First Serve
c) Priority (Preemptive)
d) Multilevel Queue
Answer: c) Priority (Preemptive)

64. Round Robin scheduling uses:


a) FIFO queue
b) LIFO queue
c) Priority queue
d) Random queue
Answer: a) FIFO queue

65. Page fault occurs when:


a) Page is found in memory
b) Page not found in memory
c) Page replaced by CPU
d) Page locked by OS
Answer: b) Page not found in memory

66. Thrashing occurs when:


a) CPU utilization is very high
b) Too many page faults
c) Cache is full
d) Context switch takes longer
Answer: b) Too many page faults

67. Which is NOT a page replacement algorithm?


a) FIFO
b) LRU
c) Optimal
d) Multilevel Queue
Answer: d) Multilevel Queue

68. Belady’s Anomaly occurs in:


a) Optimal algorithm
b) FIFO algorithm
c) LRU algorithm
d) MRU algorithm
Answer: b) FIFO algorithm

69. Deadlock necessary condition NOT true for:


a) Mutual Exclusion
b) Hold and Wait
c) Preemption Allowed
d) Circular Wait
Answer: c) Preemption Allowed

70. Semaphore used for:


a) Paging
b) Process Synchronization
c) File Allocation
d) Scheduling
Answer: b) Process Synchronization

71. Banker’s algorithm is used for:


a) Deadlock Avoidance
b) Deadlock Detection
c) Context Switching
d) Memory Allocation
Answer: a) Deadlock Avoidance

72. Critical section problem solved by:


a) Mutual Exclusion
b) Paging
c) Fragmentation
d) Spooling
Answer: a) Mutual Exclusion

73. Starvation can be solved by:


a) Priority Inheritance
b) Shortest Job First
c) Random Scheduling
d) Killing process
Answer: a) Priority Inheritance

74. Virtual memory implemented using:


a) Paging
b) Segmentation
c) Either a or b
d) None
Answer: c) Either a or b

75. Which memory allocation suffers from external fragmentation?


a) Paging
b) Segmentation
c) Demand Paging
d) None
Answer: b) Segmentation

76. Which is a non-preemptive scheduling algorithm?


a) Round Robin
b) SJF (Non-Preemptive)
c) Priority Preemptive
d) Multilevel Feedback
Answer: b) SJF (Non-Preemptive)

77. Which disk scheduling gives best average seek time?


a) FCFS
b) SSTF
c) SCAN
d) C-SCAN
Answer: b) SSTF
78. Fragmentation that occurs in paging is:
a) Internal
b) External
c) Both
d) None
Answer: a) Internal

79. Swap space used for:


a) Caching
b) Paging memory to disk
c) File Storage
d) Context Switching
Answer: b) Paging memory to disk

80. Kernel mode allows:


a) All instructions including privileged
b) Only user-level instructions
c) Limited set of I/O
d) No hardware access
Answer: a) All instructions

81. Which memory management uses base and limit registers?


a) Paging
b) Segmentation
c) Swapping
d) Virtual Memory
Answer: b) Segmentation

82. Which system call creates a process?


a) exec()
b) fork()
c) wait()
d) kill()
Answer: b) fork()

83. Zombie process means:


a) Waiting process
b) Process nished but entry not removed from process table
c) Process swapped out
d) Orphan process
Answer: b) Finished but entry not removed

84. Best t allocation:


a) Wastes smallest memory
b) Wastes largest memory
c) Allocates random block
d) Always fails
Answer: a) Wastes smallest memory

85. LRU uses:


a) Stack / Counter
b) FIFO queue
c) Priority Queue
fi
fi
d) Random Replacement
Answer: a) Stack / Counter

86. Page replacement optimal algorithm


a) FIFO b) LRU c) Optimal (Belady’s) d) Clock
Answer: c

E — Computer Networks (30 Qs)

86. Which layer of OSI ensures reliable data transfer?


a) Network
b) Transport
c) Session
d) Data Link
Answer: b) Transport

87. TCP is:


a) Connectionless
b) Connection-oriented
c) Stateless
d) Datagram protocol
Answer: b) Connection-oriented
88. IP address class for multicast:
a) Class A
b) Class B
c) Class C
d) Class D
Answer: d) Class D

89. Default port for HTTP:


a) 20
b) 21
c) 80
d) 443
Answer: c) 80

90. Protocol to translate domain to IP:


a) ARP
b) RARP
c) DNS
d) DHCP
Answer: c) DNS

91. Which protocol assigns IP addresses dynamically?


a) ICMP
b) DHCP
c) ARP
d) SNMP
Answer: b) DHCP

92. CSMA/CD used in:


a) Token Ring
b) Ethernet
c) Wi-Fi
d) Bluetooth
Answer: b) Ethernet

93. IP address range 192.168.x.x belongs to:


a) Public
b) Private
c) Multicast
d) Loopback
Answer: b) Private

94. ARP maps:


a) MAC → IP
b) IP → MAC
c) DNS → IP
d) Port → IP
Answer: b) IP → MAC

95. TCP uses which mechanism for ow control?


a) Acknowledgement
b) Sliding Window
fl
c) Token Passing
d) Hop Count
Answer: b) Sliding Window

96. SMTP works at which layer?


a) Network
b) Transport
c) Application
d) Data Link
Answer: c) Application

97. Ping uses which protocol?


a) TCP
b) UDP
c) ICMP
d) ARP
Answer: c) ICMP

98. Which routing algorithm updates periodically?


a) Link State
b) Distance Vector
c) Hybrid
d) None
Answer: b) Distance Vector

99. Which layer breaks message into packets?


a) Physical
b) Data Link
c) Network
d) Transport
Answer: c) Network

100. IPv6 address length:


a) 32-bit
b) 64-bit
c) 128-bit
d) 256-bit
Answer: c) 128-bit

101. Default port for HTTPS:


a) 80
b) 443
c) 22
d) 8080
Answer: b) 443

102. Which protocol is unreliable but fast?


a) TCP
b) UDP
c) ICMP
d) FTP
Answer: b) UDP
103. Which is a congestion control algorithm in TCP?
a) Slow Start
b) Token Bucket
c) Go Back N
d) CSMA/CA
Answer: a) Slow Start

104. Which is NOT in OSI model?


a) Application
b) Session
c) Transport
d) Internet
Answer: d) Internet

105. Port number range for well-known ports:


a) 0-1023
b) 1024-49151
c) 49152-65535
d) 0-65535
Answer: a) 0-1023

106. Traceroute uses:


a) ICMP Echo
b) ICMP Time Exceeded
c) TCP SYN
d) UDP only
Answer: b) ICMP Time Exceeded

107. Which is connectionless service?


a) TCP
b) UDP
c) SMTP
d) FTP
Answer: b) UDP

108. Hub operates at:


a) Data Link Layer
b) Physical Layer
c) Network Layer
d) Transport Layer
Answer: b) Physical Layer

109. Switch uses:


a) IP Address
b) MAC Address
c) Port Number
d) ARP Table only
Answer: b) MAC Address

110. Router uses:


a) IP Address
b) MAC Address
c) Port Number
d) DNS Name
Answer: a) IP Address

F — Programming & Output (30 Qs)


111. In C++, which keyword allocates memory dynamically?
a) malloc
b) alloc
c) new
d) create
Answer: c) new

112. delete[] in C++ is used for:


a) Single object
b) Array of objects
c) Function pointers
d) Deallocating stack memory
Answer: b) Array of objects

113. In Java, default value for int instance variable is:


a) 0
b) null
c) garbage
d) unde ned
Answer: a) 0

114. Which keyword stops loop execution in C++?


a) exit
b) return
c) continue
d) break
Answer: d) break

115. Python uses which memory management technique?


a) Manual free()
b) Garbage Collector
c) malloc/free
d) Reference Counting only
Answer: b) Garbage Collector

116. In C++, cout is de ned in:


a) stdio.h
b) iostream
c) conio.h
d) streamio.h
Answer: b) iostream

117. Which is NOT a primitive type in Java?


a) int
b) boolean
fi
fi
c) string
d) double
Answer: c) string

118. Sizeof(char) in C is:


a) 1
b) 2
c) 4
d) Depends on compiler
Answer: a) 1

119. Which loop executes at least once?


a) for
b) while
c) do-while
d) None
Answer: c) do-while

120. In Python, list is:


a) Immutable
b) Mutable
c) Fixed-size
d) Tuple-like
Answer: b) Mutable

121. Which operator cannot be overloaded in C++?


a) +
b) =
c) ::
d) []
Answer: c) ::

122. Which is pass-by-reference in Python?


a) Everything (objects are references)
b) Nothing
c) Only integers
d) Only lists
Answer: a) Everything

123. Output of print(232) in Python:


a) 64
b) 512
c) 8
d) Error
Answer: b) 512 (right-associative: 32=9 → 29=512)

124. Which is faster in Python:


a) List comprehension
b) for loop building list
c) while loop
d) map() + lambda
Answer: a) List comprehension
125. Java String is:
a) Mutable
b) Immutable
c) Thread-unsafe
d) Not an object
Answer: b) Immutable

126. Which language supports multiple inheritance directly?


a) Java
b) C++
c) Go
d) C#
Answer: b) C++

127. Default constructor in C++:


a) Must be de ned manually
b) Provided by compiler if none is de ned
c) Cannot exist
d) Requires parameters
Answer: b) Provided by compiler

128. Function main() in C returns:


a) void only
b) int usually
c) char
d) double
Answer: b) int usually

129. Which header needed for memset()?


a) iostream
b) string.h
c) stdio.h
d) memory.h
Answer: b) string.h

130. Which gives random number in C++?


a) rand()
b) random()
c) randint()
d) srand()
Answer: a) rand()

G — Aptitude & Logic (10 Qs)


131. If 10 men build wall in 5 days, 5 men build in:
a) 10 days
b) 5 days
c) 20 days
d) 15 days
Answer: a) 10 days
fi
fi
132. Average of 5 numbers 10,20,30,40,50:
a) 25
b) 30
c) 35
d) 40
Answer: b) 30

133. Sum of rst 100 natural numbers:


a) 5050
b) 5000
c) 10000
d) 505
Answer: a) 5050

134. Speed = 60 km/h, distance = 120 km, time = ?


a) 1 hr
b) 2 hr
c) 2.5 hr
d) 3 hr
Answer: b) 2 hr

135. Simple Interest: P=1000, R=10%, T=2 yrs, SI=?


a) 100
b) 150
c) 200
d) 250
Answer: c) 200

136. Next number in series: 2, 4, 8, 16, ?


a) 20
b) 24
c) 30
d) 32
Answer: d) 32

137. Train 100m, speed 20 m/s, time to cross pole:


a) 2s
b) 5s
c) 10s
d) 20s
Answer: c) 5s

138. Ratio of 2:3 is same as:


a) 4:5
b) 6:9
c) 8:10
d) 10:12
Answer: b) 6:9

139. Pro t % if CP=100, SP=120:


a) 10%
b) 15%
c) 20%
fi
fi
d) 25%
Answer: c) 20%

140. Clock: angle between hour & minute hands at 3:30:


a) 75°
b) 90°
c) 105°
d) 120°
Answer: a) 75°

Data Structures & Algorithms

Q1. Which algorithm is used to find the maximum subarray sum?

• a) Dijkstra’s Algorithm
• b) Kadane’s Algorithm ✅
• c) Bellman-Ford
• d) Kruskal’s Algorithm
Q2. Time complexity of Binary Search?

• a) O(N)
• b) O(log N) ✅
• c) O(N log N)
• d) O(1)
Q3. Which sorting algorithm is stable?

• a) QuickSort
• b) HeapSort
• c) MergeSort ✅
• d) Selection Sort
Q4. Detecting cycle in a linked list is done using:

• a) Kadane’s Algorithm
• b) Floyd’s Cycle Detection ✅
• c) Kruskal’s Algorithm
• d) Topological Sort
Q5. Space complexity of HashMap average case:

• a) O(1)
• b) O(N) ✅
• c) O(log N)
• d) O(N log N)
Q6. Next greater element can be found efficiently using:

• a) Queue
• b) Stack ✅
• c) Priority Queue
• d) Array only
Q7. Height of a Binary Tree can be found using:

• a) BFS or DFS ✅
• b) Hashing
• c) Sorting
• d) Binary Search
Q8. Which algorithm is used for shortest path in weighted graphs without
negative weights?

• a) BFS
• b) Dijkstra’s Algorithm ✅
• c) Bellman-Ford
• d) DFS
Q9. Complexity of QuickSort worst case:

• a) O(N log N)
• b) O(N^2) ✅
• c) O(N)
• d) O(1)
Q10. XOR of a number with itself gives:

• a) Same number
• b) 0 ✅
• c) 1
• d) Random number

Operating Systems

Q11. Which of the following is NOT a CPU scheduling algorithm?

• a) FCFS
• b) SJF
• c) Round Robin
• d) Paging ✅
Q12. Context Switching is:

• a) Switching from user mode to kernel mode


• b) Saving and restoring process state ✅
• c) Compiling code
• d) None of the above
Q13. Deadlock cannot occur if:
• a) Mutual exclusion holds
• b) No preemption allowed
• c) Circular wait is prevented ✅
• d) Hold and wait holds
Q14. Page replacement algorithm with least page fault:

• a) FIFO
• b) Optimal ✅
• c) LRU
• d) Random

DBMS & SQL

Q15. Which key uniquely identifies a record and cannot be NULL?

• a) Foreign Key
• b) Primary Key ✅
• c) Candidate Key
• d) Alternate Key
Q16. ACID property ensuring consistency is:

• a) Isolation
• b) Durability
• c) Consistency ✅
• d) Atomicity
Q17. Which join returns only matching rows from both tables?

• a) Left Join
• b) Right Join
• c) Full Outer Join
• d) Inner Join ✅
Q18. Index that determines physical order of data:

• a) Non-clustered
• b) Clustered ✅
• c) Composite
• d) Unique
Q19. SQL query to fetch employees with no manager uses:

• a) JOIN
• b) GROUP BY
• c) IS NULL ✅
• d) DISTINCT

Networks

Q20. Which layer of OSI handles routing?


• a) Data Link
• b) Network ✅
• c) Transport
• d) Session
Q21. Which protocol translates domain names to IP?

• a) HTTP
• b) FTP
• c) DNS ✅
• d) ARP
Q22. Which is connection-oriented protocol?

• a) UDP
• b) TCP ✅
• c) ICMP
• d) ARP
Q23. Default port for HTTPS:

• a) 21
• b) 80
• c) 443 ✅
• d) 25

OOP & Core CS

Q24. Polymorphism that happens at runtime:

• a) Overloading
• b) Overriding ✅
• c) Encapsulation
• d) Abstraction
Q25. Which is NOT an OOP principle?

• a) Inheritance
• b) Encapsulation
• c) Polymorphism
• d) Modularity ✅
Q26. Interface can have:

• a) Non-abstract methods only


• b) Abstract methods ✅
• c) Constructors
• d) Member variables
Q27. Which design pattern ensures only one instance of class?

• a) Factory
• b) Observer
• c) Singleton ✅
• d) Builder

Aptitude & Logic

Q28. A can finish work in 10 days, B in 15 days. In how many days can they
finish together?

• a) 6 ✅
• b) 8
• c) 12
• d) 7.5
Q29. If probability of rain today is 0.7, what is probability of no rain?

• a) 0.3 ✅
• b) 0.7
• c) 0.5
• d) 1.0

1. OS –

Which algorithm is used for deadlock detection?

a) Banker’s algorithm ❌ (Deadlock avoidance) b) Wait-for graph ✅ c) FIFO


❌ d) Round Robin ❌

Answer: b) Wait-for graph

2. DBMS –

Which anomaly is removed by BCNF?

a) Partial dependency ❌ (2NF removes it) b) Transitive dependency ❌ (3NF removes it)
c) Dependency on non-prime attribute ❌ d) Dependency on superkey ✅

Answer: d) Dependency on superkey

3. Networks –
The maximum number of IP addresses in a /24 subnet is: a) 64 ❌ b) 128 ❌ c)
256 ✅ (2⁸ = 256 addresses, 254 usable) d) 512 ❌ Answer: c) 256

4. OOP –

Which of the following supports multiple inheritance in Java? a) Classes ❌ b)


Interfaces ✅ c) Abstract classes ❌ d) Enums ❌ Answer: b) Interfaces

5. DSA –

Which traversal is used in expression trees to get postfix expression?

a) Preorder ❌ b) Inorder ❌ c) Postorder ✅ d) Level order ❌

Answer: c) Postorder

6. OS –

Thrashing can be reduced by:

a) Increasing cache size ❌ b) Increasing RAM ✅ c) Using FIFO ❌ d)


Reducing time quantum ❌

Answer: b) Increasing RAM

7. DBMS –

Which join returns Cartesian product? a) INNER JOIN ❌ b) OUTER JOIN ❌ c)


CROSS JOIN ✅ d) NATURAL JOIN ❌ Answer: c) CROSS JOIN

8. C++ –

Which of these cannot be overloaded? a) + ✅ b) () ✅ c) ?: ❌ (Correct answer –


Ternary operator cannot be overloaded) d) [] ✅ Answer: c) ?:

9. Networks –

Which protocol is used for secure communication over HTTP? a) SSL/TLS ✅


b) ICMP ❌ c) FTP ❌ d) ARP ❌ Answer: a) SSL/TLS
10. OS –

Which is a preemptive scheduling algorithm? a) FCFS ❌ b) SJF (non-preemptive)


❌ c) Round Robin ✅ d) Priority (non-preemptive) ❌ Answer: c) Round Robin

11. DBMS –

Which index type stores data in sorted order? a) Hash index ❌ b) B+ tree
index ✅ c) Bitmap index ❌ d) Heap ❌ Answer: b) B+ tree index

12. Programming –

Which of these is NOT a feature of Python?

a) Interpreted ✅ b) Compiled ❌ (Python is not purely compiled) c) Dynamic typing ✅


d) Garbage collection ✅

Answer: b) Compiled

13. Networks –

Maximum length of IPv4 address in dotted decimal: a) 16 chars ✅


(xxx.xxx.xxx.xxx → max 15 digits + dots) b) 32 chars ❌ c) 64 chars ❌ d) 128
chars ❌ Answer: a) 16 chars

14. OS –

Optimal page replacement requires knowledge of: a) Past page references ❌


b) Future page references ✅ c) Current page ❌ d) Least recently used ❌
Answer: b) Future page references
15. DSA –

Which sorting algorithm is best for linked lists? a) Quick Sort ❌ (bad for linked
lists) b) Merge Sort ✅ (no random access needed) c) Heap Sort ❌ d) Bubble Sort ❌
Answer: b) Merge Sort

16. DBMS –

Which SQL function counts rows including NULL? a) COUNT() ✅ b)


COUNT(column) ❌ (ignores NULL) c) SUM() ❌ d) AVG() ❌ Answer: a) COUNT()

17. Programming –

In Java, String is: a) Mutable ❌ b) Immutable ✅ c) Primitive ❌ d) Reference but


mutable ❌ Answer: b) Immutable

18. OS –

Which is not a type of fragmentation? a) Internal b) External c) Logical ✅ d) Both


internal & external Answer: c) Logical

19. Networks –

Which protocol is used in email sending? a) SMTP ✅ b) POP3 ❌ c) IMAP ❌


d) SNMP ❌ Answer: a) SMTP

20. OOP –

Which class member is shared across all objects? a) Instance variable ❌ b)


Static variable ✅ c) Constructor ❌ d) Destructor ❌ Answer: b) Static
variable
🔹 More Expected MCQs

Operating System

1. Which scheduling algorithm gives minimum average waiting time? a) FCFS b) SJF ✅ c)
Round Robin d) Priority 👉 Answer: b) SJF (Shortest Job First, but may cause starvation).

2. Which of these is NOT a condition for deadlock? a) Mutual Exclusion b) Hold and Wait
c) Preemption ✅ d) Circular Wait 👉 Answer: c) Preemption (Deadlock requires No
preemption).

3. In paging, which mapping is used between logical and physical addresses?


a) Hashing b) Page Table ✅ c) TLB d) Segment Table 👉 Answer: b) Page
Table.

4. Which algorithm suffers from Belady’s Anomaly? a) LRU b) Optimal c)


FIFO ✅ d) MRU 👉 Answer: c) FIFO.

5. Time taken for a context switch is:

a) Pure CPU utilization b) Pure overhead ✅ c) Counted in CPU burst d)


Counted in I/O burst

👉 Answer: b) Pure overhead.

DBMS

6. A relation in 3NF is always: a) In 1NF only b) In 2NF c) In BCNF d) In 2NF and 1NF ✅
👉 Answer: d) 3NF ⟹ must be in 2NF ⟹ must be in 1NF.

7. Which of these ensures ACID property in DBMS? a) Triggers b) Transactions ✅ c) Joins


d) Views 👉 Answer: b) Transactions.

8. Which SQL clause is used to group records? a) GROUP BY ✅ b) HAVING c) ORDER


BY d) DISTINCT 👉 Answer: a) GROUP BY.
9. Which is true about Foreign Key? a) Must reference a Primary Key ✅ b) Can reference
NULLs c) Must be unique d) Auto-incremented 👉 Answer: a) Must reference PK of
another relation.

10. Which index is fastest for exact match queries?

a) Hash Index ✅ b) B+ Tree c) Clustered Index d) Bitmap Index

👉 Answer: a) Hash Index.

Networks

11. Which layer handles flow control?

a) Data Link & Transport ✅ b) Network c) Application d) Session

👉 Answer: a) Both Datalink (hop-to-hop) & Transport (end-to-end).

12. TCP vs UDP – which is true? a) TCP is connectionless b) UDP is reliable c) TCP is
reliable ✅ d) UDP provides congestion control 👉 Answer: c) TCP is reliable.

13. Which address is used by switches? a) IP b) MAC ✅ c) Port d) Domain 👉 Answer: b)


MAC address.

14. DNS works on which protocol? a) TCP b) UDP ✅ (usually, port 53) c)
ICMP d) ARP 👉 Answer: b) UDP.

15. In IPv6, address size is: a) 32-bit b) 64-bit c) 128-bit ✅ d) 256-bit 👉 Answer: c) 128-
bit.

OOP / C++ / Java

16. Which function is called when an object is created?

a) Destructor b) Constructor ✅ c) Virtual function d) Inline function 👉 Answer: b)


Constructor.
17. Which of these supports operator overloading?

a) Java b) Python ✅ c) C++ ✅ d) Both b & c ✅ 👉 Answer: d) Both Python & C++.

18. Which keyword prevents inheritance in C++? a) static b) final ✅ (Java), in C++ use
final specifier after class. c) const d) protected 👉 Answer: b) final.

19. Which of these executes at runtime? a) Overloading b) Overriding ✅ (runtime


polymorphism) c) Inline d) Templates 👉 Answer: b) Overriding.

20. Friend function violates: a) Encapsulation ✅ b) Abstraction c)


Polymorphism d) Inheritance 👉 Answer: a) Encapsulation.

DSA

21. Worst-case time complexity of Quick Sort? a) O(n log n) b) O(n²) ✅ c) O(log n) d)
O(n) 👉 Answer: b) O(n²) (when pivot selection is bad).

22. In BFS, the data structure used is: a) Stack b) Queue ✅ c) Recursion d) Hashing 👉
Answer: b) Queue.

23. In a binary tree with N nodes, maximum height is: a) log N b) N ✅ c) N/2 d) 2^N 👉
Answer: b) N (skewed tree).

24. Which is NOT a balanced tree? a) AVL b) Red-Black c) Binary Search Tree
✅ d) B-tree 👉 Answer: c) Normal BST (can be skewed).

25. Heap is generally used to implement: a) Stack b) Priority Queue ✅ c) Graph d) Hash
Table 👉 Answer: b) Priority Queue.
Section 1: MCQs (50 Questions)
Q1. Which algorithm is used to nd max subarray sum?

• a) Bellman-Ford

• b) Kadane’s ✅

• c) Kruskal

• d) Prim

Q2. Time complexity of binary search?

• a) O(N)

• b) O(log N) ✅

• c) O(N log N)

• d) O(1)

Q3. In which case QuickSort gives worst performance?

• a) Already sorted array ✅

• b) Random array

• c) Reversed array

• d) Partially sorted array

Q4. Which sorting algorithm is stable?

• a) Selection Sort

• b) Heap Sort

• c) Merge Sort ✅

• d) QuickSort

Q5. Which data structure is best for implementing LRU cache?


fi
• a) Stack + Array

• b) HashMap + Doubly Linked List ✅

• c) Queue only

• d) BST

Q6. Which of the following is NOT a CPU scheduling algorithm?

• a) FCFS

• b) Round Robin

• c) Priority

• d) Paging ✅

Q7. Deadlock prevention is possible by removing:

• a) Mutual Exclusion

• b) Hold & Wait

• c) Circular Wait ✅

• d) No Preemption

Q8. Thrashing occurs when:

• a) CPU is overloaded

• b) Too much paging ✅

• c) Deadlock occurs

• d) Too many I/O operations

Q9. Which join returns only common rows?

• a) Left Join

• b) Right Join

• c) Inner Join ✅

• d) Full Outer Join

Q10. Which index de nes physical order of data?

• a) Non-clustered

• b) Clustered ✅
fi
• c) Unique

• d) Composite

Q11. TCP is:

• a) Connectionless

• b) Connection-oriented ✅

• c) Stateless

• d) UDP-based

Q12. Port number for HTTPS:

• a) 80

• b) 25

• c) 21

• d) 443 ✅

Q13. ARP protocol is used to:

• a) Map IP to MAC ✅

• b) Map MAC to IP

• c) Translate domain to IP

• d) Route packets

Q14. Which pillar of OOP provides hiding implementation details?

• a) Inheritance

• b) Polymorphism

• c) Encapsulation ✅

• d) Abstraction

Q15. Runtime polymorphism is achieved by:

• a) Function Overloading

• b) Function Overriding ✅

• c) Constructor Overloading

• d) Static Methods
Q16. SQL query to nd employees with no manager uses:

• a) GROUP BY

• b) HAVING

• c) IS NULL ✅

• d) EXISTS

Q17. Big-O of HashMap average lookup:

• a) O(1) ✅

• b) O(N)

• c) O(log N)

• d) O(N log N)

Q18. Optimal page replacement algorithm:

• a) FIFO

• b) LRU

• c) Optimal ✅

• d) Random

Q19. Design pattern that ensures single instance:

• a) Observer

• b) Factory

• c) Singleton ✅

• d) Builder

Q20. Which layer handles routing?

• a) Data Link

• b) Network ✅

• c) Transport

• d) Session
fi
Section 1 – MCQs (Core Theory) – 60 Qs
A. OOPs & Programming Concepts

1. Which of these is NOT an OOP principle?


a) Encapsulation b) Polymorphism c) Abstraction d) Compilation
Answer: d

2. Which concept binds data & methods together?


a) Inheritance b) Encapsulation c) Polymorphism d) Overriding
Answer: b

3. Runtime polymorphism is achieved by:


a) Function Overloading b) Virtual Functions c) Inline Functions d) Constructor
Overloading
Answer: b

4. Which access modi er is default in C++?


a) Public b) Private c) Protected d) Package
Answer: b

5. Which of these allows multiple inheritance?


a) Java class b) Python class c) Interface only d) C++ class
Answer: d

6. Constructor properties:
a) Can return type b) Cannot be overloaded c) Called automatically d) Must be static
Answer: c

7. Final class in Java means:


a) Cannot inherit b) Cannot be instantiated c) Cannot override d) None
Answer: a

8. Which is NOT true about abstract class?


a) Can have constructor b) Can have abstract+concrete methods c) Can be instantiated d)
Can be extended
Answer: c

B. Data Structures & Algorithms

9. Time complexity of accessing element in array:


a) O(1) b) O(n) c) O(log n) d) O(n²)
Answer: a
fi
10. Queue follows: a) FIFO b) LIFO c) Random d) Priority
Answer: a

11. Best case of insertion sort: a) O(n) b) O(n²) c) O(log n) d) O(1)


Answer: a

12. Which sort is NOT stable?


a) Merge b) Insertion c) Bubble d) Quick
Answer: d

13. Which traversal gives sorted order in BST?


a) Preorder b) Postorder c) Inorder d) Level-order
Answer: c

14. Graph shortest path with negative edges?


a) Dijkstra b) Bellman-Ford c) Prim’s d) Kruskal
Answer: b

15. Detect cycle in undirected graph uses:


a) DFS b) BFS c) Union-Find d) All
Answer: d

C. DBMS & SQL

16. TRUNCATE does:


a) Remove rows + drop table b) Remove rows keep structure c) Rollback d) None
Answer: b

17. Candidate key means:


a) Super key minimal b) Only PK c) Only FK d) Composite key
Answer: a

18. Which normal form removes partial dependency?


a) 1NF b) 2NF c) 3NF d) BCNF
Answer: b

19. HAVING lters:


a) Before grouping b) After grouping c) Before join d) After order
Answer: b

20. Which isolation level avoids dirty read?


a) Read Uncommitted b) Read Committed c) Repeatable Read d) Serializable
Answer: b

D. Operating Systems

21. Which algorithm may cause starvation?


a) FCFS b) SJF c) Round Robin d) Priority (no aging)
Answer: d
fi
22. Context switch time depends on:
a) CPU speed b) Number of registers c) Both d) None
Answer: c

23. Deadlock necessary condition NOT required:


a) Mutual exclusion b) Circular wait c) No preemption d) Spooling
Answer: d

24. Page replacement optimal algorithm:


a) FIFO b) LRU c) Optimal (Belady’s) d) Clock
Answer: c

E. Computer Networks

25. IP address range for private network (Class A):


a) 10.x.x.x b) 172.0.x.x c) 192.0.x.x d) 169.x.x.x
Answer: a

26. ARP maps:


a) IP→MAC b) MAC→IP c) IP→Port d) Port→MAC
Answer: a

27. TCP is:


a) Connection-oriented b) Connectionless c) Stateless d) None
Answer: a

28. Port for FTP:


a) 21 b) 22 c) 23 d) 25
Answer: a

You might also like