Add office photos
Engaged Employer

Sigmoid

3.3
based on 121 Reviews
Filter interviews by

50+ UB Engineering Interview Questions and Answers

Updated 13 Jan 2025
Popular Designations

Q1. Next Greater Element Problem Statement

You are given an array arr of length N. For each element in the array, find the next greater element (NGE) that appears to the right. If there is no such greater element, ...read more

Ans.

The task is to find the next greater element for each element in the given array.

  • Iterate through the array from right to left.

  • Use a stack to keep track of the next greater element.

  • Pop elements from the stack until a greater element is found or the stack is empty.

  • If the stack is empty, there is no greater element, so assign -1.

  • If a greater element is found, assign it as the next greater element.

  • Push the current element onto the stack.

  • Return the list of next greater elements.

View 2 more answers

Q2. Problem: Search In Rotated Sorted Array

Given a sorted array that has been rotated clockwise by an unknown amount, you need to answer Q queries. Each query is represented by an integer Q[i], and you must determ...read more

Ans.

This is a problem where a sorted array is rotated and we need to search for given numbers in the array.

  • The array is rotated clockwise by an unknown amount.

  • We need to search for Q numbers in the rotated array.

  • If a number is found, we need to return its index, otherwise -1.

  • The search needs to be done in O(logN) time complexity.

  • The input consists of the size of the array, the array itself, the number of queries, and the queries.

Add your answer

Q3. K-th Element of Two Sorted Arrays

You are provided with two sorted arrays, arr1 and arr2, along with an integer k. By merging all elements from arr1 and arr2 into a new sorted array, your task is to identify th...read more

Ans.

The task is to find the kth smallest element of a merged array created by merging two sorted arrays.

  • Merge the two sorted arrays into a single sorted array

  • Return the kth element of the merged array

Add your answer

Q4. Zigzag Binary Tree Traversal Problem Statement

Determine the zigzag level order traversal of a given binary tree's nodes. Zigzag traversal alternates the direction at each level, starting from left to right, th...read more

Ans.

The zigzag level order traversal of a binary tree is the traversal of its nodes' values in an alternate left to right and right to left manner.

  • Perform a level order traversal of the binary tree

  • Use a queue to store the nodes at each level

  • For each level, alternate the direction of traversal

  • Store the values of the nodes in each level in separate arrays

  • Combine the arrays in alternate order to get the zigzag level order traversal

Add your answer
Discover UB Engineering interview dos and don'ts from real experiences

Q5. Given a non-decreasing array, how can I determine the indices of an element X within it? If the element is not present, the output should be [-1, -1]. For example, for the array [1,2,3,3,5,5,7,8] and X=5, the e...

read more
Ans.

Find indices of an element in a non-decreasing array

  • Iterate through the array and keep track of the indices where the element X is found

  • Return the list of indices or [-1, -1] if element X is not found

  • Handle edge cases like empty array or X not present in the array

Add your answer

Q6. How you will figure out how many WhatsApp user are there in world

Ans.

Estimating the number of WhatsApp users worldwide requires a combination of data sources and statistical methods.

  • Collect data from WhatsApp's official reports and announcements

  • Use third-party analytics tools to estimate user numbers

  • Analyze demographic and geographic trends to extrapolate global user numbers

  • Consider factors such as population growth and smartphone adoption rates

  • Compare with similar messaging apps to validate estimates

Add your answer
Are these interview questions helpful?

Q7. Tell me about the how you will tackle a crude data for data analysis

Ans.

I will start by understanding the data source and its quality, then clean and preprocess the data before performing exploratory data analysis.

  • Understand the data source and its quality

  • Clean and preprocess the data

  • Perform exploratory data analysis

  • Identify patterns and trends in the data

  • Use statistical methods to analyze the data

  • Visualize the data using graphs and charts

  • Iterate and refine the analysis as needed

Add your answer

Q8. in an integer array where element represent stock price and index represent days how to detect the best day to buy and best day to sell in O(N)

Ans.

To detect the best day to buy and sell stock in an integer array representing stock prices and days in O(N).

  • Iterate through the array and keep track of the minimum price seen so far.

  • Calculate the profit by subtracting the current price from the minimum price.

  • Update the maximum profit and best buy/sell days accordingly.

  • Return the best buy and sell days to maximize profit.

Add your answer
Share interview questions and help millions of jobseekers 🌟

Q9. 1 - where is bean annotation used in springboot ?... In class or method

Ans.

Bean annotation is used in Spring Boot on class or method to indicate that a method produces a bean to be managed by the Spring container.

  • Bean annotation is used on methods within a class to indicate that the method produces a bean to be managed by the Spring container.

  • It can also be used at the class level to indicate that the class itself is a Spring bean.

  • For example, @Bean annotation can be used on a method that creates and returns a DataSource bean in a configuration clas...read more

Add your answer

Q10. Find sum elements which will appear from left view of Binary tree

Ans.

Calculate the sum of elements visible from the left view of a binary tree.

  • Traverse the binary tree from left to right and keep track of the first element seen at each level.

  • Add up the values of the first elements seen at each level to get the sum.

Add your answer

Q11. which access modifier to restrict interface method access to only derived or implemented classes

Ans.

Protected access modifier restricts interface method access to only derived or implemented classes.

  • Use 'protected' access modifier to restrict access to only derived or implemented classes

  • Protected members are accessible within the same package or by subclasses

  • Example: 'protected void methodName() {}' in an interface

Add your answer

Q12. What do you understand about sigmoid

Ans.

Sigmoid is a mathematical function that maps any real-valued number to a value between 0 and 1.

  • Sigmoid function is commonly used in machine learning and artificial neural networks.

  • It is an S-shaped curve that starts at 0 and approaches 1 as the input value increases.

  • The function is defined as f(x) = 1 / (1 + e^(-x)), where e is the base of the natural logarithm.

  • Sigmoid function is used for binary classification problems, where the output is either 0 or 1.

  • It is also used as an...read more

Add your answer

Q13. How would you deal with datasets having lots of categories

Ans.

Utilize feature engineering techniques like one-hot encoding or target encoding to handle datasets with many categories.

  • Use feature engineering techniques like one-hot encoding to convert categorical variables into numerical values

  • Consider using target encoding to encode categorical variables based on the target variable

  • Apply dimensionality reduction techniques like PCA or LDA to reduce the number of features

  • Use tree-based models like Random Forest or XGBoost which can handle...read more

Add your answer

Q14. Given a binary string,find out the max length of substring having equal number of 1 and 0

Ans.

Find max length of substring with equal 1s and 0s in a binary string.

  • Use a hash table to store the difference between the count of 1s and 0s seen so far.

  • If the difference is 0, update the max length seen so far.

  • If the difference is already in the hash table, update the max length using the current index and the index where the difference was first seen.

  • Return the max length.

  • Example: '1100010110' -> 8

Add your answer

Q15. How does dropout help in neural networks?

Ans.

Dropout helps prevent overfitting in neural networks by randomly setting a fraction of input units to zero during training.

  • Dropout helps in preventing overfitting by reducing the interdependence between neurons

  • It acts as a regularization technique by randomly setting a fraction of input units to zero during training

  • Dropout forces the network to learn redundant representations, making it more robust and generalizable

  • It can be applied to different layers of the neural network t...read more

Add your answer

Q16. how does one services interact with other in microservice

Ans.

Microservices interact with each other through APIs, messaging, or events.

  • Microservices communicate with each other through APIs, which can be synchronous or asynchronous.

  • Messaging systems like RabbitMQ or Kafka can be used for communication between microservices.

  • Events can be used for loosely coupled communication between microservices.

  • Service discovery mechanisms like Eureka or Consul help microservices locate and communicate with each other.

  • API gateways can be used to mana...read more

Add your answer

Q17. inferschema in pyspark when reading file

Ans.

inferschema in pyspark is used to automatically infer the schema of a file when reading it.

  • inferschema is a parameter in pyspark that can be set to true when reading a file to automatically infer the schema based on the data

  • It is useful when the schema of the file is not known beforehand

  • Example: df = spark.read.csv('file.csv', header=True, inferSchema=True)

Add your answer

Q18. in an integer array find the next greatest number for all and display in O(N)

Ans.

Find the next greatest number for each integer in an array in O(N) time complexity.

  • Iterate through the array from right to left

  • Use a stack to keep track of potential next greatest numbers

  • Pop elements from the stack that are less than the current element and update their next greatest number to the current element

  • Push the current element onto the stack

  • Repeat until all elements have a next greatest number

Add your answer

Q19. NextGreater element in array using Stack(can find on leetcode)

Ans.

Using a stack to find the next greater element in an array of strings.

  • Iterate through the array from right to left.

  • Push elements onto the stack and compare with the top element to find the next greater element.

  • Pop elements from the stack until a greater element is found or stack is empty.

Add your answer

Q20. How does xgboost deal with nan values?

Ans.

XGBoost can handle missing values (NaN) by assigning them to a default direction during tree construction.

  • XGBoost treats NaN values as missing values and learns the best direction to go at each node to handle them

  • During tree construction, XGBoost assigns NaN values to the default direction based on the training data statistics

  • XGBoost can handle missing values in both input features and target variables

Add your answer

Q21. what is data engineering

Ans.

Data engineering is the process of designing, building, and managing the infrastructure and systems that enable the collection, storage, processing, and analysis of large volumes of data.

  • Data engineering involves creating and maintaining data pipelines

  • It focuses on data integration, transformation, and storage

  • Data engineers work with tools like Hadoop, Spark, and SQL

  • They ensure data quality, scalability, and reliability

  • Examples include building a data warehouse, designing ETL...read more

Add your answer

Q22. Find peak element in rotated sorted array

Ans.

Peak element in rotated sorted array is found using binary search.

  • Use binary search to find the peak element in rotated sorted array.

  • Compare mid element with its neighbors to determine if it is a peak.

  • Adjust the search space based on comparison results.

Add your answer

Q23. Find k min elements in given array.

Ans.

Find k min elements in given array.

  • Sort the array and return the first k elements.

  • Use a min heap of size k to find the k min elements.

  • Use quickselect algorithm to find the kth smallest element and return first k elements smaller than it.

Add your answer

Q24. check if there is a loop in linked list

Ans.

Check for a loop in a linked list by using two pointers moving at different speeds.

  • Use two pointers, one moving at a normal speed and another moving at double the speed.

  • If there is a loop, the two pointers will eventually meet at some point.

  • Alternatively, use a hash set to store visited nodes and check for duplicates.

Add your answer

Q25. what is scd in dw?

Ans.

SCD stands for Slowly Changing Dimension in Data Warehousing.

  • SCD is a technique used in data warehousing to track changes to dimension data over time.

  • There are different types of SCDs - Type 1, Type 2, and Type 3.

  • Type 1 SCD overwrites old data with new data, Type 2 creates new records for changes, and Type 3 maintains both old and new values in separate columns.

  • Example: In a customer dimension table, if a customer changes their address, a Type 2 SCD would create a new record ...read more

Add your answer

Q26. Leetcode's sort 0 1 array in place

Ans.

Sort an array of 0s and 1s in place without using extra space.

  • Use two pointers approach - one for 0s and one for 1s.

  • Swap elements at the two pointers until all 0s are on the left and 1s on the right.

Add your answer

Q27. Find that given tree is BST or not.

Ans.

Check if a given tree is a Binary Search Tree (BST) or not.

  • Traverse the tree in-order and check if the elements are in ascending order.

  • Check if the maximum value in the left subtree is less than the root and the minimum value in the right subtree is greater than the root.

  • Use recursion to check if all subtrees are BSTs.

  • Time complexity: O(n), Space complexity: O(h) where h is the height of the tree.

Add your answer

Q28. Find pair in BST with given sum

Ans.

Given a BST and a sum, find a pair of nodes whose values add up to the given sum.

  • Traverse the BST in-order and store the nodes in a list

  • Use two pointers approach to find the pair with the given sum

  • If the sum is less than the current pair, move the right pointer to the left

  • If the sum is greater than the current pair, move the left pointer to the right

  • If the sum is equal to the current pair, return the pair

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

Add your answer

Q29. optimizing techniques in spark

Ans.

Optimizing techniques in Spark involve partitioning, caching, and tuning resources for efficient data processing.

  • Use partitioning to distribute data evenly across nodes for parallel processing

  • Cache frequently accessed data in memory to avoid recomputation

  • Tune resources such as memory allocation and parallelism settings for optimal performance

Add your answer

Q30. repartition vs coalesce

Ans.

Repartition is used to increase the number of partitions in a DataFrame, while coalesce is used to decrease the number of partitions.

  • Repartition involves shuffling data across the network, which can be expensive in terms of performance and resources.

  • Coalesce is a more efficient operation as it minimizes data movement by only merging existing partitions.

  • Repartition is typically used when there is a need for more parallelism or to evenly distribute data for better performance.

  • C...read more

Add your answer

Q31. normalization in db and types

Ans.

Normalization in databases is the process of organizing data in a database to reduce redundancy and improve data integrity.

  • Normalization is used to eliminate redundant data and ensure data integrity.

  • It involves breaking down a table into smaller tables and defining relationships between them.

  • There are different normal forms such as 1NF, 2NF, 3NF, and BCNF.

  • Normalization helps in reducing data redundancy and improving query performance.

  • Example: In a database, instead of storing...read more

Add your answer

Q32. transformation vs action

Ans.

Transformation involves changing the data structure, while action involves performing a computation on the data.

  • Transformation changes the data structure without executing any computation

  • Action performs a computation on the data and triggers the execution

  • Examples of transformation include map, filter, and reduce in Spark or Pandas

  • Examples of action include count, collect, and saveAsTextFile in Spark

Add your answer

Q33. Python programming how to count vowels

Ans.

Python program to count vowels in a given string

  • Iterate through the string and check if each character is a vowel (a, e, i, o, u)

  • Increment a counter for each vowel found

  • Return the total count of vowels

Add your answer

Q34. Print the pascal triangle pattern

Ans.

The Pascal triangle pattern is a triangular array of binomial coefficients.

  • Use a 2D array to store the values of the Pascal triangle.

  • Each value in the triangle is the sum of the two values above it in the previous row.

  • Print the values in a formatted manner to display the Pascal triangle pattern.

Add your answer

Q35. What is Data science?

Ans.

Data science is a field that uses scientific methods, algorithms, and systems to extract knowledge and insights from structured and unstructured data.

  • Data science involves collecting, analyzing, and interpreting large amounts of data to solve complex problems.

  • It combines statistics, machine learning, and domain knowledge to make predictions and decisions.

  • Data scientists use programming languages like Python and R, as well as tools like SQL and Hadoop.

  • Examples of data science ...read more

Add your answer

Q36. Code in SQL and python(moderate)

Ans.

The candidate is asked to code in SQL and Python at a moderate level.

  • Use SQL to query data from databases

  • Use Python to manipulate and analyze data

  • Practice writing SQL queries and Python scripts

Add your answer

Q37. System Design and hr principles

Ans.

System design involves creating a high-level architecture of a software system, while HR principles focus on managing people effectively.

  • System design involves identifying components, defining their interactions, and ensuring scalability and reliability.

  • HR principles include hiring the right talent, providing training and development opportunities, and fostering a positive work culture.

  • Both system design and HR principles aim to optimize performance and achieve organizational...read more

Add your answer

Q38. how to install operating system

Ans.

To install an operating system, you need to boot from installation media and follow the on-screen instructions.

  • Create a bootable installation media (USB, DVD, etc.)

  • Insert the installation media into the computer

  • Boot the computer from the installation media

  • Follow the on-screen instructions to select language, partition the disk, and install the OS

  • Reboot the computer after installation is complete

Add your answer

Q39. Validate binary search tree.

Ans.

Validate if a binary tree is a binary search tree

  • In-order traversal should result in a sorted array

  • Check if each node's value is within the correct range

  • Recursively validate left and right subtrees

Add your answer

Q40. Reverse K group linked list.

Ans.

Reverse K group linked list

  • Iterate through the linked list in groups of size K

  • Reverse each group of K nodes

  • Connect the reversed groups back together

Add your answer

Q41. Nearest Left Greater element.

Ans.

Find the nearest element on the left side of an array that is greater than the current element.

  • Iterate through the array from right to left.

  • Use a stack to keep track of elements that are greater than the current element.

  • Pop elements from the stack until finding a greater element or the stack is empty.

  • If a greater element is found, that is the nearest left greater element.

  • If the stack is empty, there is no nearest left greater element.

Add your answer

Q42. rank vs dense rank

Ans.

Rank assigns unique ranks to each distinct value, while dense rank assigns ranks without gaps.

  • Rank function assigns unique ranks to each distinct value in a result set.

  • Dense rank function assigns ranks to rows in a result set without any gaps between the ranks.

  • Rank function may skip ranks if there are ties in values, while dense rank will not skip ranks.

Add your answer

Q43. What is Decision Tree

Ans.

A decision tree is a flowchart-like structure in which each internal node represents a test on an attribute, each branch represents the outcome of the test, and each leaf node represents a class label.

  • Decision trees are a popular machine learning algorithm used for classification and regression tasks.

  • They are easy to interpret and visualize, making them useful for understanding the decision-making process.

  • Each internal node in a decision tree represents a decision based on a ...read more

Add your answer

Q44. Matrix traversal in spiral Manner

Ans.

Matrix traversal in spiral manner involves visiting each element of a matrix in a spiral order.

  • Start by traversing the outermost layer of the matrix from top left to top right, then top right to bottom right, bottom right to bottom left, and finally bottom left to top left.

  • Continue this process for the inner layers until all elements are visited.

  • Keep track of the boundaries of the matrix to know when to switch directions.

Add your answer

Q45. Currying with arrow function

Ans.

Currying is a technique in functional programming where a function with multiple arguments is transformed into a sequence of nested functions, each taking a single argument.

  • Currying can be achieved using arrow functions in JavaScript.

  • Arrow functions automatically bind 'this' and do not have their own 'this' value.

  • Example: const add = a => b => a + b;

  • Example: const addFive = add(5); const result = addFive(3); // result will be 8

Add your answer

Q46. Design Custom Hashmap

Ans.

Custom implementation of HashMap in Java

  • Use an array of linked lists to handle collisions

  • Implement methods like put, get, remove, containsKey, and size

  • Handle resizing of the hashmap when load factor exceeds a certain threshold

Add your answer

Q47. Leetcode's Maximum Path Sum

Ans.

Find the maximum path sum in a binary tree

  • Use recursion to traverse the binary tree and calculate the maximum path sum at each node

  • At each node, calculate the maximum path sum that includes the current node and return the maximum path sum that does not include the current node

  • Update a global variable to keep track of the maximum path sum found so far

Add your answer

Q48. Data analysis with statistical tools

Ans.

Data analysis involves using statistical tools to analyze and interpret data.

  • Statistical tools help in summarizing and visualizing data

  • They can be used to identify patterns, trends, and relationships in the data

  • Common statistical tools include regression analysis, hypothesis testing, and clustering

  • Statistical tools help in making data-driven decisions and predictions

Add your answer

Q49. Sortr an array of 0,1

Ans.

Sort an array of 0s and 1s

  • Use a sorting algorithm like counting sort or two-pointer approach

  • Count the number of 0s and 1s and then reconstruct the array

  • Example: Input array = ['0', '1', '0', '1', '1'], Output array = ['0', '0', '1', '1', '1']

Add your answer

Q50. DSA problem - DFS in graphs

Ans.

DFS (Depth First Search) is a graph traversal algorithm that explores as far as possible along each branch before backtracking.

  • DFS is implemented using a stack data structure or recursion.

  • It starts at a selected node and explores as far as possible along each branch before backtracking.

  • DFS can be used to find connected components, detect cycles, and solve maze problems.

  • Example: In a graph with nodes A, B, C, and edges (A, B), (B, C), DFS starting at node A would visit nodes A...read more

Add your answer

Q51. DSA problem - minimum stack

Ans.

Implement a stack that supports push, pop, top, and retrieving the minimum element in constant time.

  • Use two stacks - one to store the actual elements and another to store the minimum values encountered so far.

  • When pushing an element, check if it is smaller than the current minimum and push it to the min stack if so.

  • When popping an element, check if it is the current minimum and pop from the min stack if so.

  • Top operation can be implemented by returning the top element of the m...read more

Add your answer

Q52. High Level System Design

Ans.

High level system design involves creating an overview of the architecture and components of a software system.

  • Identify the main components of the system

  • Define the interactions between components

  • Consider scalability and performance requirements

  • Choose appropriate technologies and frameworks

  • Create a diagram to visualize the system architecture

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at UB Engineering

based on 60 interviews
Interview experience
3.8
Good
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Interview Questions from Similar Companies

3.8
 • 351 Interview Questions
3.9
 • 154 Interview Questions
3.7
 • 142 Interview Questions
3.9
 • 137 Interview Questions
3.7
 • 133 Interview Questions
View all
Top Sigmoid Interview Questions And Answers
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
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

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