Clarivate
Apex Infotech Interview Questions and Answers
Q1. Best Time to Buy and Sell Stock II Problem Statement
Given the stock prices for a certain number of days, represented as an array, determine the maximum profit you can achieve. You may perform as many transacti...read more
The problem involves finding the maximum profit that can be achieved by buying and selling stocks on different days.
Iterate through the array of stock prices and find the local minima and maxima to calculate profit
Keep track of the total profit by adding the differences between consecutive maxima and minima
You can perform multiple transactions, so buy at each local minima and sell at each local maxima
Example: For prices = [7, 1, 5, 3, 6, 4], buy at 1, sell at 5, buy at 3, sel...read more
Abstract classes and interfaces in inheritance allow for defining common behavior and function signatures, while function overloading and overriding enable polymorphism.
Abstract classes are classes that cannot be instantiated and may contain abstract methods that must be implemented by subclasses.
Interfaces are similar to abstract classes but can only contain method signatures and constants, with no method implementations.
Function overloading refers to having multiple methods...read more
Q3. What is asynchronous function in JavaScript?
Asynchronous functions in JavaScript allow code to run without blocking other code from executing.
Asynchronous functions use callbacks or promises to handle the result of the function.
They are useful for tasks that may take a long time to complete, such as fetching data from a server.
Examples include setTimeout(), fetch(), and XMLHttpRequest().
Q4. What is polymorphism?
Polymorphism is the ability of an object to take on many forms.
It allows objects of different classes to be treated as if they were objects of the same class.
It is achieved through method overriding and method overloading.
Example: A parent class Animal can have child classes like Dog, Cat, and Cow. All of them have a common method called 'makeSound', but each of them makes a different sound.
Example: A method can be overloaded by having the same name but different parameters, ...read more
Q5. Reverse alternate words in a given string
Reverse alternate words in a given string
Split the string into words
Reverse alternate words using a loop
Join the words back into a string
Q6. Find frequency of letters in a given string
Use a hashmap to store the frequency of each letter in the given string.
Iterate through the string and update the frequency of each letter in the hashmap.
Return the hashmap containing the frequency of each letter.
Q7. Implement bubble sort
Bubble sort is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order.
Start at the beginning of the array and compare the first two elements. If the first element is greater than the second, swap them.
Continue comparing adjacent elements and swapping them if necessary until the end of the array is reached.
Repeat this process for each element in the array until no more swaps are needed, indic...read more
Interview Process at Apex Infotech
Top Associate Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month