Placement Papers
TCS, Infosys, Wipro, Cognizant actual papers
654 Questions 12 Topics Take Test
Advertisement
Showing 11–20 of 654 questions
Q.11 Medium Google Questions Google
What is the correct output of: print(2 ** 3 ** 2) in Python?
A 64
B 512
C 8
D 256
Correct Answer:  B. 512
EXPLANATION

Exponentiation is right-associative in Python. 32 = 9, then 29 = 512

Take Test
Q.12 Hard Google Questions Google
What is the space complexity of DFS using recursion?
A O(1)
B O(n)
C O(log n)
D O(h) where h is height
Correct Answer:  D. O(h) where h is height
EXPLANATION

Recursive DFS uses call stack space proportional to the height of the tree/graph. For balanced tree, it's O(log n); worst case O(n).

Take Test
Q.13 Easy Google Questions Google
What is the time complexity of finding the median in a sorted array?
A O(1)
B O(log n)
C O(n)
D O(n log n)
Correct Answer:  A. O(1)
EXPLANATION

In a sorted array, median is at index n/2, which is accessed in constant time O(1).

Take Test
Q.14 Medium Google Questions Google
In dynamic programming, what is memoization?
A Breaking problem into subproblems
B Storing results of subproblems to avoid recomputation
C Creating a memo
D Sorting results
Correct Answer:  B. Storing results of subproblems to avoid recomputation
EXPLANATION

Memoization is an optimization technique where results of expensive function calls are cached and returned when same inputs occur again.

Take Test
Q.15 Easy Google Questions Google
What is the result of 1 XOR 1?
A 0
B 1
C 2
D undefined
Correct Answer:  A. 0
EXPLANATION

XOR (exclusive OR) returns 1 only when bits are different. 1 XOR 1 = 0 because both bits are the same.

Take Test
Advertisement
Q.16 Medium Google Questions Google
Which sorting algorithm is stable and has O(n log n) worst-case complexity?
A QuickSort
B MergeSort
C HeapSort
D Selection Sort
Correct Answer:  B. MergeSort
EXPLANATION

MergeSort has O(n log n) worst-case and is stable. QuickSort is O(n²) worst-case, HeapSort is not stable.

Take Test
Q.17 Hard Google Questions Google
What is the correct way to check if a number is a power of 2?
A n & (n-1) == 0
B n % 2 == 0
C n / 2 == 1
D sqrt(n) is integer
Correct Answer:  A. n & (n-1) == 0
EXPLANATION

A power of 2 has only one bit set. n & (n-1) removes the rightmost set bit, so if result is 0, n is a power of 2.

Take Test
Q.18 Easy Google Questions Google
In a BFS (Breadth-First Search), what data structure is used?
A Stack
B Queue
C Priority Queue
D Deque
Correct Answer:  B. Queue
EXPLANATION

BFS uses a Queue (FIFO) to explore nodes level by level. DFS uses a Stack (LIFO).

Take Test
Q.19 Medium Google Questions Google
What is the space complexity of QuickSort?
A O(1)
B O(log n)
C O(n)
D O(n log n)
Correct Answer:  B. O(log n)
EXPLANATION

QuickSort uses O(log n) space for the recursion call stack in the average case.

Take Test
Q.20 Medium Google Questions Google
In a hash table with 10 slots, if 15 elements are inserted with a good hash function, what is the expected average chain length?
A 1.5
B 1.0
C 2.5
D 1.8
Correct Answer:  A. 1.5
EXPLANATION

Load factor = n/m = 15/10 = 1.5. Average chain length in hash table = load factor = 1.5

Take Test
IGET
iget AI
Online · Ask anything about exams
Hi! 👋 I'm your iget AI assistant.

Ask me anything about exam prep, MCQ solutions, study tips, or strategies! 🎯
UPSC strategy SSC CGL syllabus Improve aptitude NEET Biology tips