Tcs Coding Questions 2021 File

vector<int> rotate(int nums[], int n, int k) if (k > n) k = k % n; vector<int> ans(n); for (int i = 0; i < k; i++) ans[i] = nums[n - k + i];

Display the trainee with the highest average. If multiple trainees share the highest average, display all of them.

Input: [-2,1,-3,4,-1,2,1,-5,4] Output: 6 (subarray [4,-1,2,1])

Medium Marks: 15

: Usually based on a strict online assessment platform (like TCS iON) where code must pass both public and hidden test cases. High-Frequency Coding Topics

Rotated array.

roles—often feels like a high-stakes puzzle. In 2021, the coding questions shifted toward story-based problems that test logic just as much as syntax.

vector<int> rotate(int nums[], int n, int k) if (k > n) k = k % n; vector<int> ans(n); for (int i = 0; i < k; i++) ans[i] = nums[n - k + i];

Display the trainee with the highest average. If multiple trainees share the highest average, display all of them.

Input: [-2,1,-3,4,-1,2,1,-5,4] Output: 6 (subarray [4,-1,2,1])

Medium Marks: 15

: Usually based on a strict online assessment platform (like TCS iON) where code must pass both public and hidden test cases. High-Frequency Coding Topics

Rotated array.

roles—often feels like a high-stakes puzzle. In 2021, the coding questions shifted toward story-based problems that test logic just as much as syntax.