SDE Intern
60+ SDE Intern Interview Questions and Answers

Asked in Microsoft Corporation

Q. Given a string of containing lower case letters and upper case characters. Find the number of occurrences of each character. The question was further modified to include the special characters as well. I was as...
read moreCount the occurrences of each character in a given string including special characters.
Create test cases for empty string
Test for string with only one character
Test for string with all characters being the same
Test for string with all characters being different
Test for string with special characters

Asked in Amazon

Q. Find the square root of a number using only 4 basic arithmetic operations (+,-,*,/) without using a power operator and inbuilt libraries. For numbers that are not perfect squares, print the integer part of the...
read moreFind square root of a number using basic arithmetic operations without power operator and inbuilt libraries.
Use binary search to find the integer part of the square root
Use long division method to find the decimal part of the square root
Repeat the above steps until desired accuracy is achieved
Handle edge cases like negative numbers and numbers less than 1
SDE Intern Interview Questions and Answers for Freshers

Asked in Carwale

Q. How would you design an e-commerce web application?
Designing an e-commerce web app involves user interface, product management, payment processing, and scalability considerations.
User Interface: Create a responsive design for easy navigation and product discovery.
Product Management: Implement a database to manage product listings, including categories, descriptions, and images.
User Authentication: Allow users to create accounts, log in, and manage their profiles.
Shopping Cart: Enable users to add products to a cart and manage...read more

Asked in Microsoft Corporation

Q. Remove duplicate characters from a given string, keeping only the first occurrences (i.e., order should not change). For example, if the input is ‘bananas,’ the output will be ‘bans.’
Remove duplicate characters from a string while preserving order.
Create an empty string to hold the result.
Iterate through each character in the input string.
If the character is not already in the result string, add it.
Return the result string.

Asked in Carwale

Q. What is caching, and why is it necessary?
Caching is the process of storing frequently accessed data in a temporary storage to improve performance.
Caching reduces the need to fetch data from the original source, improving response time.
It helps in reducing network traffic and server load.
Caching can be done at various levels like browser caching, CDN caching, and server-side caching.
Examples of caching include browser caching of website assets, CDN caching of static content, and database query result caching.

Asked in Microsoft Corporation

Q. Given two singly linked lists that intersect to form a Y shape, find the node at the intersection point.
Given a Y-linked list, find the node at the intersection point.
Traverse both branches of the Y-linked list and compare nodes.
Use a hash table to store visited nodes and check for intersection.
If one branch is longer, traverse it until it matches the length of the other branch.
SDE Intern Jobs



Asked in Microsoft Corporation

Q. How do you change permissions for a particular file?
To change permissions for a file, you can use the chmod command in the terminal.
Use the chmod command followed by the permission code and the file name
Permission codes include 'u' for user, 'g' for group, and 'o' for others, along with 'r' for read, 'w' for write, and 'x' for execute
For example, to give read and write permissions to the user for a file named 'example.txt', you can use 'chmod u+rw example.txt'

Asked in Microsoft Corporation

Q. Explain the logic and code to traverse a binary tree level by level in spiral form.
Traverse a binary tree in spiral order, alternating between left-to-right and right-to-left at each level.
Use two stacks: one for the current level and one for the next level.
Start with the root node in the first stack.
While there are nodes in the current stack, pop nodes and add their children to the next stack in the opposite order.
Switch stacks after each level to alternate the traversal direction.
Example: For a tree with root 1, left child 2, right child 3, the spiral ord...read more
Share interview questions and help millions of jobseekers 🌟

Asked in HashedIn by Deloitte

Q. 1. Describe your projects in depth. 2. Database schema design of Codechef. 3. SQL queries related to that. 4. Questions on CN
Answering questions on projects, database schema design of Codechef, SQL queries, and CN.
Projects involved developing a web application for managing employee data and a mobile app for tracking expenses.
Database schema design of Codechef involved creating tables for users, problems, submissions, and contests.
SQL queries related to Codechef included retrieving user details, problem submissions, and contest rankings.
Questions on CN covered topics such as network protocols, OSI m...read more

Asked in Techweirdo

Q. Describe a situation where you had to list data on a page from an API using React.js.
Using React.js to fetch and display data from an API involves state management and lifecycle methods.
Use the useEffect hook to fetch data when the component mounts.
Utilize the useState hook to manage the fetched data.
Handle loading and error states to improve user experience.
Example: Fetching user data from an API and displaying it in a list.
Consider using async/await for cleaner asynchronous code.

Asked in ServiceNow

Q. What is a load balancer?
A load balancer distributes network traffic across multiple servers to ensure reliability and optimize resource use.
Improves application availability by distributing requests to multiple servers.
Can be hardware-based (like F5) or software-based (like Nginx).
Helps in scaling applications by adding more servers as demand increases.
Supports various algorithms like Round Robin, Least Connections, and IP Hash.
Example: A website using a load balancer can handle more users by spread...read more

Asked in Amazon

Q. Given a sorted linked list, how can you remove duplicates from it?
Remove duplicates from a sorted linked list
Use two pointers - one to iterate through the list and another to keep track of unique elements
Compare current node with next node, if they are equal, skip the next node
Repeat until end of list is reached

Asked in Techweirdo

Q. How does DOM manipulation work in React.js?
React.js uses a virtual DOM to optimize updates and improve performance during DOM manipulation.
React creates a virtual DOM, a lightweight copy of the actual DOM.
When state changes, React updates the virtual DOM first, not the real DOM.
React uses a diffing algorithm to compare the virtual DOM with the real DOM.
Only the changed elements are updated in the real DOM, minimizing performance costs.
Example: If a list item is added, React updates only that item instead of re-renderi...read more

Asked in Microsoft Corporation

Q. Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. The LCA is defined between two nodes p and q as the lowest node in T that has both p and q as descendants (...
read moreFind the lowest common ancestor (LCA) of two nodes in a binary search tree (BST) efficiently.
In a BST, for any node, left children are smaller and right children are larger.
To find LCA of nodes p and q, start from the root.
If both p and q are smaller than the root, LCA lies in the left subtree.
If both p and q are larger than the root, LCA lies in the right subtree.
If one is on the left and the other is on the right, the root is the LCA.
Example: For nodes 2 and 8 in a BST, if ...read more

Asked in Brane Enterprises

Q. You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum a...
read moreAddition of two linked lists and return the result as a linked list.
Traverse both linked lists simultaneously
Add corresponding nodes and carry over the sum
Create a new linked list with the sum

Asked in Springworks

Q. Projects and tech stack used
I have worked on various projects using different tech stacks including Java, Python, and JavaScript.
Developed a web application using Java Spring Boot framework
Created a data analysis tool using Python libraries such as Pandas and NumPy
Built a real-time chat application using JavaScript and Node.js
Implemented machine learning algorithms using Python's scikit-learn library
Worked on a mobile application using React Native framework

Asked in INDMoney

Q. Write an SQL query for a bus transport system that handles passenger pick-up and drop-off.
SQL query to manage pick and drop of passengers in a transport system
Create a table for passengers with columns like passenger_id, name, pick_up_location, drop_off_location, etc.
Create a table for transport vehicles with columns like vehicle_id, driver_name, capacity, etc.
Use JOIN to link the two tables based on pick_up_location and drop_off_location.
Consider adding a table for routes and scheduling for better organization.
Example: SELECT * FROM passengers p JOIN vehicles v O...read more

Asked in Connectwise India

Q. What are the key concepts in React, such as Props, State, and Hooks?
React key concepts include Props, State, and Hooks, essential for building dynamic user interfaces.
Props: Short for properties, used to pass data from parent to child components. Example: <ChildComponent name='John' />.
State: A component's internal data storage that can change over time. Example: const [count, setCount] = useState(0);.
Hooks: Functions that let you use state and other React features in functional components. Example: useEffect(() => { /* side effects */ }, [])...read more

Asked in Amazon

Q. Given a timestamp, find the next permutation of the digits in the timestamp.
Find the next permutation of a given timestamp in HH:MM AM/PM format.
Convert the timestamp to a 24-hour format for easier manipulation.
Identify the rightmost pair where the earlier digit is smaller than the later one.
Swap this digit with the smallest larger digit to its right.
Reverse the digits to the right of the swapped position to get the next permutation.
Example: For '11:55 PM', the next permutation is '12:00 AM'.

Asked in Techweirdo

Q. What is multithreading in Javascript?
Multithreading is not natively supported in JavaScript, but can be achieved through Web Workers.
JavaScript is a single-threaded language, meaning it can only execute one task at a time.
Web Workers allow for multithreading in JavaScript by running scripts in the background.
Web Workers can communicate with the main thread using message passing.
Examples of tasks that can benefit from multithreading include heavy computations and long-running processes.

Asked in Meta

Q. Why Meta? What do you know about Meta in AI space?
Meta is a leading company in AI space with a focus on developing innovative technologies and solutions.
Meta (formerly Facebook) is known for its advanced AI research and development.
Meta uses AI for various applications such as content moderation, personalized recommendations, and virtual assistants.
Meta's AI technologies power products like facial recognition, language translation, and image recognition.

Asked in EarlySalary Services

Q. Given an array containing numbers from 1 to n, with one number missing, find the missing number.
Find the missing number in an array containing numbers from 1 to n.
Iterate through the array and calculate the sum of all numbers from 1 to n.
Calculate the sum of all numbers in the given array.
Subtract the sum of array from the sum of all numbers to find the missing number.

Asked in Techweirdo

Q. What are some basic concepts of the Node.js event loop?
The Node.js event loop manages asynchronous operations, allowing non-blocking execution of code in a single-threaded environment.
The event loop is a core part of Node.js that handles asynchronous callbacks.
It operates in phases: timers, I/O callbacks, idle, poll, check, and close callbacks.
Example: setTimeout() schedules a callback to run after a specified delay.
I/O operations (like reading files) are offloaded to the system, allowing the event loop to continue processing oth...read more

Asked in Amazon

Q. Given a binary tree, find all leaf nodes and print the path from the root to each leaf node.
Find leaf nodes in a binary tree and print path to each leaf node.
Traverse the binary tree using depth-first search (DFS)
When reaching a leaf node, store the path from root to that leaf node
Repeat the process for all leaf nodes in the tree

Asked in INDMoney

Q. Create functions to insert, delete, and print elements in a linked list.
Function to insert, delete, and print a linked list
Create a Node class with data and next pointer
Implement insert function to add a new node at the end of the linked list
Implement delete function to remove a node by value
Implement print function to display all elements in the linked list

Asked in Amazon

Q. Given a binary tree, return the leftmost node at the deepest level.
Find the deepest left node in a binary tree.
Traverse the tree recursively and keep track of the depth and whether the current node is a left node.
If the current node is a leaf node and its depth is greater than the deepest left node found so far, update the deepest left node.
Return the deepest left node found.
Example: For the binary tree with root node 1, left child 2, and left child of 2 being 4, the deepest left node is 4.
Example: For the binary tree with root node 1, left ...read more

Asked in TurboHire

Q. How do you optimize written code and estimate time complexity?
Optimizing code and estimating time complexity
Identify bottlenecks in the code and optimize them
Use efficient data structures and algorithms
Analyze the code to determine its time complexity
Consider worst-case, best-case, and average-case scenarios
Use Big O notation to express the time complexity

Asked in GoComet

Q. Given a sorted matrix (sorted row-wise and column-wise), how would you search for an element in it?
Use binary search to efficiently search for an element in a sorted matrix.
Start from the top right corner of the matrix
If the target is greater than the current element, move down
If the target is less than the current element, move left
Repeat until the target is found or all elements are checked

Asked in SNS iHub

Q. What is virtual DOM?
Virtual DOM is a lightweight copy of the actual DOM used for efficient updates.
Virtual DOM is a concept used in modern web development frameworks like React.
It is a lightweight copy of the actual DOM that is used to track changes and update the actual DOM efficiently.
When a change is made to the virtual DOM, it is compared with the previous version to identify the minimum number of changes required to update the actual DOM.
This approach reduces the number of updates required ...read more

Asked in Applexus Technologies

Q. What is the difference between one-way and two-way data binding?
Single way binding updates the view when the model changes, while two way binding updates both the view and the model.
Single way binding updates the view when the model changes, but not vice versa.
Two way binding updates both the view and the model when either changes.
Single way binding is commonly used in frameworks like AngularJS, while two way binding is used in frameworks like Vue.js.
Interview Experiences of Popular Companies





Top Interview Questions for SDE Intern Related Skills



Reviews
Interviews
Salaries
Users

