Showing 51–60 of 654 questions
Which programming language is most preferred by TCS for their 2024-25 placements?
A
Python and Java
B
C and COBOL only
C
JavaScript exclusively
D
Assembly language
Correct Answer:
A. Python and Java
Explanation:
TCS 2024-25 placement drive prioritizes Java and Python as primary programming languages, reflecting current industry trends
A number is 5 more than another number. If their sum is 25, find the larger number.
Explanation:
Let smaller number = x. Larger = x+5. Sum: x + (x+5) = 25 → 2x = 20 → x = 10. Larger = 15
Solve: 2x + 3 = 11
A
x = 3
B
x = 4
C
x = 5
D
x = 6
Explanation:
2x + 3 = 11 → 2x = 8 → x = 4
TCS follows which software development methodology as its primary approach?
A
Agile and DevOps
B
Waterfall only
C
Spiral model
D
Prototype model
Correct Answer:
A. Agile and DevOps
Explanation:
TCS extensively uses Agile methodologies combined with DevOps practices for faster delivery and continuous integration.
In a coding problem, you need to find the longest palindromic substring. What would be the optimal time complexity?
A
O(n²)
B
O(n)
C
O(n log n)
D
O(n³)
Explanation:
Using expand-around-center approach or dynamic programming with memoization, the optimal solution achieves O(n) time complexity.
What is the output of the following pseudocode?
count = 0
for i = 1 to 5
for j = 1 to i
count++
print count
Explanation:
The nested loop runs: 1+2+3+4+5 = 15 times. This is the sum of first 5 natural numbers.
A company has 120 employees. 45% work in development, 30% in testing, and remaining in support. How many work in support?
Explanation:
Support = 100% - 45% - 30% = 25% of 120 = 30 employees.
Which data structure is most efficient for implementing a priority queue in competitive programming?
A
Array
B
Linked List
C
Heap
D
Binary Search Tree
Explanation:
Heaps provide O(log n) insertion and deletion, making them optimal for priority queues compared to other structures.
If the binary representation of a number is 10110, what is its decimal equivalent?
Explanation:
10110₂ = 1×16 + 0×8 + 1×4 + 1×2 + 0×1 = 16 + 4 + 2 = 22
What is the space complexity of the merge sort algorithm?
A
O(1)
B
O(n)
C
O(log n)
D
O(n log n)
Explanation:
Merge sort requires O(n) extra space for creating temporary arrays during the merge process.