Computer Scientist

Computer Scientist Interview Questions and Answers

Updated 26 Jun 2024

Q1. If a subarray exist whose sum = k | leetcode(560)

Ans.

Given an array of integers, find if a subarray exists whose sum equals to k.

  • Use a hashmap to store the prefix sum and its frequency.

  • Iterate through the array and check if the difference between current prefix sum and k exists in the hashmap.

  • If it exists, then a subarray with sum k exists.

  • Time complexity: O(n), Space complexity: O(n).

Q2. Break linkedlist into two lists(positive and negative)

Ans.

To break a linked list into two lists, we can traverse the list and add nodes to respective lists based on their value.

  • Traverse the linked list and add nodes to positive or negative list based on their value

  • Create two empty lists for positive and negative nodes

  • Iterate through the linked list and add nodes to respective lists

  • Join the two lists at the end to get the final result

Q3. Merge K-Sorted Linked List

Ans.

Merge K-Sorted Linked List

  • Create a min heap of size k

  • Insert the first element of each linked list into the heap

  • Pop the minimum element from the heap and add it to the result list

  • Insert the next element from the linked list of the popped element into the heap

  • Repeat until all elements are processed

Q4. implement bfs in graph

Ans.

BFS (Breadth-First Search) is a graph traversal algorithm that explores all the vertices of a graph in breadth-first order.

  • Create a queue to store the visited vertices

  • Start with the initial vertex and enqueue it

  • While the queue is not empty, dequeue a vertex and mark it as visited

  • Enqueue all the adjacent vertices of the dequeued vertex that are not yet visited

  • Repeat until the queue is empty

Are these interview questions helpful?

Q5. Finish the react application with the given functionalities

Ans.

The react application needs to be completed with given functionalities.

  • Implement state management using Redux or Context API

  • Create components for different sections of the application

  • Fetch data from an API and display it in the application

  • Add routing using React Router for navigation

  • Implement form handling for user input

Q6. Find left view of binary tree. Two sum problem

Ans.

Left view of a binary tree is the set of nodes visible when the tree is viewed from the left side.

  • Traverse the binary tree level by level using BFS or DFS.

  • Keep track of the first node encountered at each level (leftmost node).

  • Store the leftmost nodes in an array to get the left view of the binary tree.

Share interview questions and help millions of jobseekers 🌟

man-with-laptop

Q7. explain four pillars of oops

Ans.

The four pillars of OOP are encapsulation, inheritance, polymorphism, and abstraction.

  • Encapsulation: Bundling of data and methods into a single unit (class) to hide implementation details.

  • Inheritance: Ability of a class to inherit properties and behaviors from another class.

  • Polymorphism: Ability of objects of different classes to be treated as objects of a common superclass.

  • Abstraction: Simplifying complex systems by breaking them down into smaller, more manageable units.

Computer Scientist Jobs

Computer Scientist-I (Frontend) 7-11 years
Adobe Systems India Pvt. Ltd.
3.9
Noida
Computer Scientist - 2 (Python) 7-13 years
Adobe Systems India Pvt. Ltd.
3.9
Noida
Computer Scientist - I 4-9 years
Adobe Systems India Pvt. Ltd.
3.9
Noida
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

3.9
 • 233 Interviews
View all

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

Computer Scientist Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter