Technical Trainee
90+ Technical Trainee Interview Questions and Answers
Q1. Minimum Cost to Destination
You are given an NxM matrix consisting of '0's and '1's. A '1' signifies that the cell is accessible, whereas a '0' indicates that the cell is blocked. Your task is to compute the mi...read more
Find the minimum cost to reach a destination in a matrix with specified rules.
Use Breadth First Search (BFS) algorithm to explore all possible paths from the starting point to the destination.
Keep track of the cost incurred at each cell and update it as you move through the matrix.
Return the minimum cost to reach the destination or -1 if it is unreachable.
Consider edge cases such as when the starting point is the destination or when the destination is blocked.
Q2. Find Two Non-Repeating Elements Problem Statement
Given an array of integers ARR
with size N
, where exactly two elements appear only once and all others appear exactly twice, identify and return the two unique ...read more
Given an array where all elements appear twice except two, find and return the two unique elements.
Use XOR operation to find the XOR of all elements in the array, which will give the XOR of the two unique elements.
Find the rightmost set bit in the XOR result to divide the array into two groups based on that bit.
XOR each group separately to find the two unique elements.
Example: For input [2, 4, 6, 8, 4, 2], XOR result is 6^8=14. Rightmost set bit is at position 1. Group 1: [6,...read more
Technical Trainee Interview Questions and Answers for Freshers
Q3. Maximum of All Subarrays of Size k
Given an array of 'N' non-negative integers and an integer 'K', your task is to find the maximum elements for each subarray of size 'K'.
Input:
The first line contains an inte...read more
Find the maximum elements for each subarray of size 'K' in a given array of non-negative integers.
Iterate through the array and maintain a deque to store the indices of elements in decreasing order.
Pop elements from the deque if they are out of the current window of size 'K'.
The front of the deque will always have the index of the maximum element for the current window.
Q4. Sum Between Zeroes Problem Statement
Given a singly linked list containing a series of integers separated by the integer '0', modify the list by merging nodes between two '0's into a single node. This merged no...read more
Given a singly linked list with integers separated by '0', merge nodes between '0's into a single node with sum of included nodes.
Traverse the linked list and keep track of sum between zeroes
Merge nodes between zeroes by updating the sum in the merged node
Update the linked list by removing the nodes between zeroes
Handle edge cases like list starting and ending with '0'
Q5. Nth Prime Number Problem Statement
Find the Nth prime number given a number N.
Explanation:
A prime number is greater than 1 and is not the product of two smaller natural numbers. A prime number has exactly two...read more
Find the Nth prime number given a number N.
A prime number is greater than 1 and is not the product of two smaller natural numbers
A prime number has exactly two distinct positive divisors: 1 and itself
Implement a function to find the Nth prime number based on the given input
Q6. Counting Derangements Problem
A derangement is a permutation of 'N' elements, where no element appears in its original position. For instance, a derangement of {0, 1, 2, 3} is {2, 3, 1, 0} because each element ...read more
Count the total number of derangements possible for a set of 'N' elements.
A derangement is a permutation where no element appears in its original position.
Use the formula for derangements: !n = n! * (1 - 1/1! + 1/2! - 1/3! + ... + (-1)^n/n!)
Return the answer modulo (10^9 + 7) to handle large results.
Share interview questions and help millions of jobseekers 🌟
Q7. Convert Min Heap to Max Heap Problem Statement
Given an array representation of a min-heap of size 'n', your task is to convert this array into a max-heap.
Input:
The first line of input contains an integer ‘T’...read more
Convert a given array representing a min-heap into a max-heap.
Iterate through the array and swap parent nodes with their children to convert min-heap to max-heap.
Maintain the heap property by comparing parent with its children and swapping if necessary.
Ensure the final array satisfies the max-heap property where parent nodes are greater than their children.
Q8. Closest Distance Pair Problem Statement
Given an array containing 'N' points in a 2D plane, determine the minimum distance between the closest pair of points.
Note:
Distance between two points (x1, y1) and (x2,...read more
The task is to find the distance of the closest points among an array of N points in the plane.
Calculate the distance between each pair of points using the given formula
Keep track of the minimum distance found so far
Return the minimum distance
Technical Trainee Jobs
Q9. Count Palindrome Words in a String
Given a string 'S' consisting of words, your task is to determine the number of palindrome words within 'S'. A word is considered a palindrome if it reads the same backward as...read more
Count the number of palindrome words in a given string.
Split the string into words using whitespace as delimiter.
Check each word if it is a palindrome by comparing it with its reverse.
Increment a counter for each palindrome word found.
Output the total count of palindrome words for each test case.
Q10. Sort 0 1 2 Problem Statement
Given an integer array arr
of size 'N' containing only 0s, 1s, and 2s, write an algorithm to sort the array.
Input:
The first line contains an integer 'T' representing the number of...read more
Sort an integer array containing only 0s, 1s, and 2s in-place using a single scan.
Iterate through the array and maintain three pointers for 0s, 1s, and 2s.
Swap elements based on the current element's value and the pointers.
Example: If current element is 0, swap with the 0s pointer and increment both pointers.
Q11. Build Max Heap Problem Statement
Given an integer array with N elements, the task is to transform this array into a max binary heap structure.
Explanation:
A max-heap is a complete binary tree where each intern...read more
The task is to transform an integer array into a max binary heap structure.
Create a max heap from the given array by rearranging elements.
Check if each internal node has a value greater than or equal to its children.
Output '1' if the transformed array represents a max-heap, else output '0'.
Q12. Swap Two Numbers Problem Statement
Given two integers a
and b
, your task is to swap these numbers and output the swapped values.
Input:
The first line contains a single integer 't', representing the number of t...read more
Swap two integers 'a' and 'b' and output the swapped values.
Create a temporary variable to store one of the integers before swapping
Assign the value of 'a' to 'b' and the temporary variable to 'a'
Output the swapped values as 'b' followed by 'a'
Q13. Merge Sort Problem Statement
You are given a sequence of numbers, ARR
. Your task is to return a sorted sequence of ARR
in non-descending order using the Merge Sort algorithm.
Explanation:
The Merge Sort algorit...read more
Implement Merge Sort algorithm to sort a sequence of numbers in non-descending order.
Divide the input array into two halves recursively until each array has only one element.
Merge the sorted halves to produce a completely sorted array.
Ensure the implementation handles the constraints specified in the problem statement.
Example: For input [3, 1, 4, 1, 5], the output should be [1, 1, 3, 4, 5].
Q14. Reverse Doubly Linked List Nodes in Groups
You are given a doubly linked list of integers along with a positive integer K
that represents the group size. Your task is to modify the linked list by reversing ever...read more
Reverse groups of K nodes in a doubly linked list.
Iterate through the linked list in groups of K nodes
Reverse each group of K nodes
Handle cases where the number of nodes is less than K
Update the pointers accordingly
Q15. Character Formation Check
Determine if the second string STR2
can be constructed using characters from the first string STR1
. Both strings may include any characters.
Input:
The first line contains an integer T...read more
Check if second string can be formed using characters from the first string.
Iterate through each character in STR2 and check if it exists in STR1.
Use a hashmap to store the frequency of characters in STR1 for efficient lookup.
Return 'YES' if all characters in STR2 are found in STR1, otherwise return 'NO'.
Q16. Detect and Remove Loop in Linked List
For a given singly linked list, identify if a loop exists and remove it, adjusting the linked list in place. Return the modified linked list.
Expected Complexity:
Aim for a...read more
Detect and remove loop in a singly linked list in place with O(n) time complexity and O(1) space complexity.
Use Floyd's Cycle Detection Algorithm to identify the loop in the linked list.
Once the loop is detected, use two pointers to find the start of the loop.
Adjust the pointers to remove the loop and return the modified linked list.
Q17. Trapping Rainwater Problem Statement
You are given an array ARR
of long type, which represents an elevation map where ARR[i]
denotes the elevation of the ith
bar. Calculate the total amount of rainwater that ca...read more
Calculate the total amount of rainwater that can be trapped within given elevation map.
Iterate through the array to find the maximum height on the left and right of each bar.
Calculate the amount of water that can be trapped above each bar by taking the minimum of the maximum heights on the left and right.
Sum up the trapped water above each bar to get the total trapped water for the elevation map.
Q18. Count Ways to Reach the N-th Stair Problem Statement
You are provided with a number of stairs, and initially, you are located at the 0th stair. You need to reach the Nth stair, and you can climb one or two step...read more
The problem involves determining the number of distinct ways to climb from the 0th to the Nth stair by climbing one or two steps at a time.
Use dynamic programming to solve this problem efficiently.
The number of ways to reach the Nth stair can be calculated by adding the number of ways to reach the (N-1)th stair and the (N-2)th stair.
Consider base cases where N=0 and N=1 separately.
Handle large values of N by using modulo arithmetic.
Example: For N=3, the number of distinct way...read more
Q19. Sorted Linked List to Balanced BST Problem Statement
Given a singly linked list where nodes contain values in increasing order, your task is to convert it into a Balanced Binary Search Tree (BST) using the same...read more
Convert a sorted linked list into a Balanced Binary Search Tree (BST) using the same data values.
Create a function to convert the linked list to a BST by recursively dividing the list into halves
Maintain a pointer to the middle element of the list as the root of the BST
Recursively set the left and right children of the root using the left and right halves of the list
Perform level order traversal to output the values of the BST nodes in the required format
Q20. Snake and Ladder Problem Statement
Given a 'Snake and Ladder' board with N rows and N columns, where positions are numbered from 1 to (N*N) starting from the bottom left, alternating direction each row, find th...read more
Find the minimum number of dice throws required to reach the last cell on a 'Snake and Ladder' board.
Create a graph representation of the board with snakes and ladders as edges.
Use Breadth First Search (BFS) to find the shortest path from the starting cell to the last cell.
Keep track of visited cells and the number of dice throws at each cell.
Handle cases where the last cell is unreachable by returning -1.
Consider the special cases where the last cell is reached through a lad...read more
Q21. Spiral Order Traversal of a Binary Tree
Given a binary tree with N
nodes, your task is to output the Spiral Order traversal of the binary tree.
Input:
The input consists of a single line containing elements of ...read more
The task is to output the Spiral Order traversal of a binary tree given in level order.
Implement a function that returns the spiral order traversal as a list
Traverse the binary tree in a spiral order alternating between left to right and right to left
Use a queue to keep track of nodes at each level
Handle null nodes represented by -1 in the input
Q22. Distribute N Candies Among K People
Explanation: Sanyam wishes to distribute 'N' candies among 'K' friends. The friends are arranged based on Sanyam's order of likeness. He initially distributes candies such th...read more
Distribute N candies among K people in Sanyam's order of likeness, incrementing distribution by K each round until all candies are distributed.
Distribute candies starting from 1st friend, incrementing by K each round
If remaining candies are fewer than what a friend is supposed to receive, stop distribution
Output the number of candies each friend ends up with at the end of distribution
Q23. Find All Pairs Adding Up to Target
Given an array of integers ARR
of length N
and an integer Target
, your task is to return all pairs of elements such that they add up to the Target
.
Input:
The first line conta...read more
The task is to find all pairs of elements in an array that add up to a given target.
Iterate through the array and for each element, check if the target minus the element exists in a hash set.
If it exists, add the pair to the result. If not, add the element to the hash set.
Print the pairs found or (-1, -1) if no pair is found.
Q24. Jumping Game Problem Statement
In this problem, you have ‘n’ carrots lined up and denoted by numbers 1 through ‘n’. There are ‘k’ rabbits, and each rabbit can jump to carrots that are multiples of its unique ju...read more
Calculate uneaten carrots after rabbits jump based on their unique factors.
Iterate through each rabbit's jumping factor and mark the carrots they land on as eaten
Calculate the remaining uneaten carrots by counting the ones not marked as eaten
Consider using a data structure like an array to keep track of eaten carrots efficiently
Q25. Reverse Linked List Problem Statement
Given a Singly Linked List of integers, your task is to reverse the Linked List by altering the links between the nodes.
Input:
The first line of input is an integer T, rep...read more
Reverse a singly linked list by altering the links between nodes.
Iterate through the linked list and reverse the links between nodes
Use three pointers to keep track of the current, previous, and next nodes
Update the links between nodes to reverse the list
Return the head of the reversed linked list
Q26. Reverse Stack with Recursion
Reverse a given stack of integers using recursion. You must accomplish this without utilizing extra space beyond the internal stack space used by recursion. Additionally, you must r...read more
Reverse a given stack of integers using recursion without extra space or loop constructs.
Use recursion to pop all elements from the original stack and store them in function call stack.
Once the stack is empty, push the elements back in reverse order using recursion.
Ensure to handle base cases for empty stack or single element stack.
Example: If the input stack is [1, 2, 3], after reversal it should be [3, 2, 1].
Q27. String Compression Problem Statement
Ninja needs to perform basic string compression. For any character that repeats consecutively more than once, replace the repeated sequence with the character followed by th...read more
Implement a function to compress a string by replacing consecutive characters with the character followed by the count of repetitions.
Iterate through the input string and keep track of consecutive characters and their counts.
Replace consecutive characters with the character followed by the count of repetitions if count is greater than 1.
Return the compressed string for each test case.
Q28. Trapping Rain Water Problem Statement
You are given a long type array/list ARR
of size N
, representing an elevation map. The value ARR[i]
denotes the elevation of the ith
bar. Your task is to determine the tota...read more
Calculate the total amount of rainwater that can be trapped between given elevations in an array.
Iterate through the array and calculate the maximum height on the left and right of each bar.
Calculate the amount of water that can be trapped at each bar by taking the minimum of the maximum heights on the left and right.
Sum up the trapped water at each bar to get the total trapped water for the entire array.
Q29. Maximum Sum Path in a Binary Tree
Your task is to determine the maximum possible sum of a simple path between any two nodes (possibly the same) in a given binary tree of 'N' nodes with integer values.
Explanati...read more
Find the maximum sum of a simple path between any two nodes in a binary tree.
Use a recursive approach to traverse the binary tree and calculate the maximum sum path.
Keep track of the maximum sum path found so far while traversing the tree.
Consider negative values in the path sum calculation to handle cases where the path can start and end at different nodes.
Handle cases where the path can go through the root node or not.
Q30. Word Occurrence Counting
Given a string 'S' of words, the goal is to determine the frequency of each word in the string. Consider a word as a sequence of one or more non-space characters. The string can have mu...read more
The goal is to determine the frequency of each word in a given string.
Split the input string into individual words
Create a dictionary to store word frequencies
Iterate through the words and update the frequency count in the dictionary
Print each unique word and its frequency
Q31. Properties of MST in an Undirected Graph
You have a simple undirected graph G = (V, E)
where each edge has a distinct weight. Consider an edge e
as part of this graph. Determine which of the given statements re...read more
In an undirected graph with distinct edge weights, the lightest edge in a cycle is included in every MST, while the heaviest edge is excluded.
The lightest edge in a cycle is always included in every MST of the graph.
The heaviest edge in a cycle is always excluded from every MST of the graph.
This property holds true for all simple undirected graphs with distinct edge weights.
Q32. String Palindrome Verification
Given a string, your task is to determine if it is a palindrome considering only alphanumeric characters.
Input:
The input is a single string without any leading or trailing space...read more
Check if a given string is a palindrome considering only alphanumeric characters.
Remove non-alphanumeric characters from the input string.
Compare characters from start and end of the string to check for palindrome.
Return true if the string is a palindrome, false otherwise.
Q33. Find The Closest Perfect Square Problem Statement
You are given a positive integer N
. Your task is to find the perfect square number that is closest to N
and determine the number of steps required to reach that...read more
Find the closest perfect square to a given positive integer and determine the number of steps required to reach that number.
Iterate through perfect squares starting from 1 until the square is greater than the given number
Calculate the distance between the perfect square and the given number
Return the closest perfect square and the distance as output
Q34. Number of Steps required to reach top of stairs of length n where person can make either 1 or 2 steps at a time.
The number of steps required to reach the top of a staircase of length n can be calculated using dynamic programming.
Use dynamic programming to solve the problem
Create an array to store the number of steps required for each position
Initialize the first two positions with 1 and 2
Iterate through the remaining positions and calculate the number of steps based on the previous two positions
Return the number of steps required for the last position
Q35. What is the difference between WFH(Work from Home) and WFO(Work from Office)?
WFH allows employees to work remotely from their homes, while WFO requires employees to work from a physical office location.
WFH provides flexibility in work location and schedule, while WFO requires employees to be present in the office during specified hours.
WFH may lead to increased productivity and work-life balance for some employees, while WFO allows for better collaboration and communication among team members.
Examples: WFH - working from home on a laptop; WFO - workin...read more
Q36. Which technology were used? Pick any topic and describe?
The technology used was artificial intelligence in healthcare.
AI algorithms for medical image analysis
Machine learning for predicting patient outcomes
Natural language processing for analyzing medical records
Q37. What is diod , zener diod , clamp meter, transistor, how to check these ,resistor colour code
Explanation of diode, zener diode, clamp meter, transistor, and resistor color code.
A diode is an electronic component that allows current to flow in only one direction.
A zener diode is a type of diode that allows current to flow in reverse direction when a certain voltage is reached.
A clamp meter is a tool used to measure electrical current without disconnecting the circuit.
A transistor is a semiconductor device used to amplify or switch electronic signals.
Resistor color cod...read more
Q38. How would you take feedbacks and structure a lecture plan accordingly?
I would actively listen to feedback, analyze it, and make necessary adjustments to the lecture plan.
Actively listen to feedback from students, colleagues, and supervisors.
Analyze the feedback to identify common themes or areas for improvement.
Make necessary adjustments to the lecture plan based on the feedback received.
Seek clarification or additional feedback if needed to ensure understanding.
Implement changes in a timely manner to improve the effectiveness of the lecture.
Q39. Colour coding of transistor and what is soldering how it works.
Transistor colour coding helps identify the type and polarity of the transistor. Soldering is a process of joining two metal surfaces using a filler metal.
Transistor colour coding typically involves using colored bands to indicate the type and polarity of the transistor. For example, a common NPN transistor might have a black body with a white band to indicate the base, a red band for the collector, and a green band for the emitter.
Soldering is the process of joining two meta...read more
Q40. Type of mixes done in field? Types of cement manufactured? Volumetric mix design ratios?
Different types of mixes in the field include concrete, mortar, and grout. Types of cement manufactured include Portland cement, white cement, and blended cement. Volumetric mix design ratios vary depending on the specific application.
Types of mixes in the field: concrete, mortar, grout
Types of cement manufactured: Portland cement, white cement, blended cement
Volumetric mix design ratios depend on the specific application
Q41. How to protect the network and data?
Protecting network and data involves implementing security measures to prevent unauthorized access and data breaches.
Implement strong passwords and two-factor authentication
Use firewalls and antivirus software
Regularly update software and security patches
Encrypt sensitive data
Train employees on safe browsing and email practices
Limit access to sensitive data on a need-to-know basis
Regularly backup data
Q42. What os parenteral and enlist few parenteral routes of administration.
Parenteral refers to the administration of drugs or fluids through routes other than the digestive tract.
Parenteral administration bypasses the gastrointestinal tract.
Common parenteral routes include intravenous (IV), intramuscular (IM), and subcutaneous (SC) injections.
Other parenteral routes include intradermal (ID), intrathecal, and intra-articular injections.
Parenteral administration can also be achieved through intravenous infusion or intravenous bolus.
Parenteral routes ...read more
Q43. NMR values of aromatic ring and affects on them from electron withdrawing abd donating groups
NMR values of aromatic rings are affected by electron withdrawing and donating groups.
Electron withdrawing groups shift NMR values downfield (to higher ppm)
Electron donating groups shift NMR values upfield (to lower ppm)
Examples: Nitro group (downfield shift), Methoxy group (upfield shift)
Q44. Print left most node of each level by doing BFs
Print the leftmost node of each level using BFS.
Implement BFS algorithm to traverse the tree level by level.
Keep track of the leftmost node of each level.
Print the leftmost node of each level after traversal is complete.
Q45. What is cnc machine ,gcode and mcode difference
CNC machine is a computer-controlled machine tool used for cutting and shaping materials. G-code is a programming language used to control CNC machines. M-code is used to activate specific machine functions.
CNC machine is a computer-controlled machine tool used for cutting and shaping materials.
G-code is a programming language used to control CNC machines by providing instructions for movement, speed, and other parameters.
M-code is used to activate specific machine functions ...read more
Q46. What is dns how it will use?
DNS stands for Domain Name System. It is a decentralized system that translates domain names into IP addresses.
DNS is used to resolve domain names to their corresponding IP addresses.
It helps in the efficient routing of internet traffic.
DNS also provides other services like email routing and load balancing.
Example: When you type a website URL in your browser, DNS translates it to the IP address of the server hosting that website.
Q47. Find all the pairs present in an array
The question asks to find all the pairs present in an array of strings.
Iterate through the array and compare each element with all other elements to find pairs.
Store the pairs in a separate array or data structure.
Consider the order of elements in pairs, i.e., (A, B) is different from (B, A).
Q48. Implement linked list
A linked list is a data structure where each element points to the next one.
Create a Node class with a value and a next pointer
Create a LinkedList class with a head pointer and methods to add, remove, and traverse nodes
Example: LinkedList ll = new LinkedList(); ll.add(5); ll.add(10); ll.remove(5);
Q49. Can you draw a simple electrical circuit?
Yes, I can draw a simple electrical circuit.
Start with a power source (battery or outlet)
Connect the power source to a load (light bulb, resistor, etc.)
Include wires to complete the circuit
Label components with symbols (battery symbol, resistor symbol, etc.)
Q50. 1. What are the importance of security
Security is important to protect data, assets, and individuals from unauthorized access, theft, and harm.
Prevent unauthorized access to sensitive information
Protect assets from theft or damage
Ensure the safety and well-being of individuals
Maintain confidentiality and integrity of data
Comply with regulations and standards
Examples: Using strong passwords, encryption, access control measures
Interview Questions of Similar Designations
Top Interview Questions for Technical Trainee Related Skills
Interview experiences of popular companies
Calculate your in-hand salary
Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary
Reviews
Interviews
Salaries
Users/Month