Home Subjects Placement Papers

Placement Papers

TCS, Infosys, Wipro, Cognizant actual papers

71 Q 10 Topics Take Test
Advertisement
Difficulty: All Easy Medium Hard 41–50 of 71
Topics in Placement Papers
In thread-safe programming at Infosys, which Java construct provides the most granular level of locking?
A Synchronized method
B Synchronized block
C ReentrantReadWriteLock
D Volatile keyword
Correct Answer:  C. ReentrantReadWriteLock
EXPLANATION

ReentrantReadWriteLock provides separate read and write locks, allowing multiple readers but only one writer, offering finer-grained control than basic synchronized constructs.

Take Test
An Infosys project uses Apache Kafka for real-time data streaming. If a consumer group has 5 consumers and the topic has 8 partitions, how many consumers will remain idle?
A 3 consumers
B 2 consumers
C 1 consumer
D 0 consumers
Correct Answer:  A. 3 consumers
EXPLANATION

In Kafka, the maximum number of active consumers in a group equals the number of partitions. With 8 partitions and 5 consumers, only 3 will remain idle.

Take Test
In a HashMap implementation used at Infosys, what happens when the load factor exceeds the threshold?
A The HashMap is locked and becomes read-only
B The HashMap is rehashed with a larger capacity
C All entries are deleted automatically
D The oldest entries are removed
Correct Answer:  B. The HashMap is rehashed with a larger capacity
EXPLANATION

When the load factor (ratio of entries to capacity) exceeds the threshold, the HashMap is rehashed with approximately double the capacity to maintain performance.

Take Test
In a distributed system at Infosys, what is the primary challenge that CAP theorem addresses?
A Memory management
B The impossibility of simultaneously achieving Consistency, Availability, and Partition Tolerance
C Network bandwidth optimization
D Cache invalidation strategies
Correct Answer:  B. The impossibility of simultaneously achieving Consistency, Availability, and Partition Tolerance
EXPLANATION

CAP theorem states that distributed systems can guarantee only two out of three properties: Consistency, Availability, and Partition Tolerance.

Take Test
What is the expected behavior when a thread calls the wait() method in a synchronized block at Infosys coding standards?
A The thread terminates immediately
B The thread releases the lock and enters a waiting state
C The thread continues execution
D The thread creates a new process
Correct Answer:  B. The thread releases the lock and enters a waiting state
EXPLANATION

When wait() is called in a synchronized block, the thread releases the object lock and enters a waiting state until notify() or notifyAll() is called.

Take Test
In a concurrent system at Infosys, what is a deadlock scenario?
A Process exceeds time limit
B Two or more processes waiting indefinitely for resources held by each other
C System runs out of memory
D Network connection fails
Correct Answer:  B. Two or more processes waiting indefinitely for resources held by each other
EXPLANATION

A deadlock occurs when two or more processes are blocked forever, each holding resources the other needs, causing circular dependency.

Take Test
Which principle of SOLID design is violated if a class depends on multiple unrelated interfaces?
A Single Responsibility Principle
B Interface Segregation Principle
C Liskov Substitution Principle
D Dependency Inversion Principle
Correct Answer:  B. Interface Segregation Principle
EXPLANATION

Interface Segregation Principle states that clients should not depend on interfaces they don't use. Multiple unrelated interfaces violate this.

Take Test
Which data structure is optimal for implementing LRU (Least Recently Used) cache in Infosys systems?
A Simple array
B Hash map with doubly linked list
C Single linked list
D Tree structure
Correct Answer:  B. Hash map with doubly linked list
EXPLANATION

Hash map provides O(1) access while doubly linked list maintains order. Combined they achieve O(1) for all LRU operations.

Take Test
A complex algorithmic problem in Infosys placement requires analyzing a graph with weighted edges. What would be the optimal approach for finding the shortest path?
A Depth-first search (DFS)
B Breadth-first search (BFS)
C Dijkstra's algorithm for weighted graphs
D Linear search
Correct Answer:  C. Dijkstra's algorithm for weighted graphs
EXPLANATION

Dijkstra's algorithm is the optimal choice for finding shortest paths in weighted graphs with non-negative weights, with O(E log V) complexity.

Take Test
A candidate is solving a problem on dynamic programming for the Infosys coding round. The problem involves overlapping subproblems and optimal substructure. What is the minimum number of steps to solve such problems?
A 1 step - direct solution
B 2 steps - define subproblems and find recurrence
C 3 steps - define subproblems, find recurrence, implement with memoization/tabulation
D 4 steps - analyze, define, find recurrence, and optimize further
Correct Answer:  C. 3 steps - define subproblems, find recurrence, implement with memoization/tabulation
EXPLANATION

Dynamic programming requires defining subproblems, establishing recurrence relations, and implementing solutions using memoization or tabulation for optimization.

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