Oracle
40+ Jgn Sugar And Biofuels Interview Questions and Answers
Q1. Triplets with Given Sum Problem
Given an array or list ARR
consisting of N
integers, your task is to identify all distinct triplets within the array that sum up to a specified number K
.
Explanation:
A triplet i...read more
The task is to find all distinct triplets in an array that sum up to a specified number.
Iterate through all possible triplets using three nested loops.
Check if the sum of the triplet equals the target sum.
Print the triplet if found, else print -1.
Handle duplicate triplets by skipping duplicates during iteration.
Q2. Square Root (Integral) Problem Statement
Given a number N
, calculate its square root and output the integer part only.
Example:
Input:
18
Output:
4
Explanation:
The square root of 18 is approximately 4.24. The ...read more
Calculate the integer square root of a given number.
Use binary search to find the square root of the number.
Start with a range from 0 to N, and iteratively narrow down the range until you find the integer square root.
Return the integer part of the square root as the output.
Q3. Search in a Row-wise and Column-wise Sorted Matrix Problem Statement
You are given an N * N matrix of integers where each row and each column is sorted in increasing order. Your task is to find the position of ...read more
Given a sorted N * N matrix, find the position of a target integer 'X'.
Use binary search in each row to narrow down the search space.
Start from the top-right corner or bottom-left corner for efficient search.
Handle cases where 'X' is not found by returning {-1, -1}.
Q4. Partition Equal Subset Sum Problem
Given an array ARR
consisting of 'N' positive integers, determine if it is possible to partition the array into two subsets such that the sum of the elements in both subsets i...read more
The problem is to determine if it is possible to partition an array into two subsets with equal sum.
Use dynamic programming to solve this problem efficiently.
Create a 2D array to store the results of subproblems.
Check if the sum of the array is even before attempting to partition it.
Iterate through the array and update the 2D array based on the sum of subsets.
Return true if a subset with half the sum is found, false otherwise.
Q5. Convert Sentence to Pascal Case
Given a string STR
, your task is to remove spaces from STR
and convert it to Pascal case format. The function should return the modified STR
.
In Pascal case, words are concatenat...read more
Convert a given string to Pascal case format by removing spaces and capitalizing the first letter of each word.
Iterate through each character in the string
If the character is a space, skip it
If the character is not a space and the previous character is a space or it is the first character, capitalize it
Q6. Valid Parenthesis Problem Statement
Given a string str
composed solely of the characters "{", "}", "(", ")", "[", and "]", determine whether the parentheses are balanced.
Input:
The first line contains an integ...read more
Check if given string of parentheses is balanced or not.
Use a stack to keep track of opening parentheses
Pop from stack when encountering a closing parenthesis
Return 'YES' if stack is empty at the end, 'NO' otherwise
Q7. Subarray Challenge: Largest Equal 0s and 1s
Determine the length of the largest subarray within a given array of 0s and 1s, such that the subarray contains an equal number of 0s and 1s.
Input:
Input begins with...read more
Find the length of the largest subarray with equal number of 0s and 1s in a given array.
Iterate through the array and maintain a count of 0s and 1s encountered so far.
Store the count difference in a hashmap with the index as key.
If the same count difference is encountered again, the subarray between the two indices has equal 0s and 1s.
Return the length of the largest such subarray found.
Q8. Count Inversions Problem Statement
Given an integer array ARR
of size N
, your task is to find the total number of inversions that exist in the array.
An inversion is defined for a pair of integers in the array ...read more
Count the number of inversions in an integer array.
Iterate through the array and for each pair of elements, check if the conditions for inversion are met.
Use a nested loop to compare each pair of elements efficiently.
Keep a count of the inversions found and return the total count at the end.
Q9. Remove the Kth Node from the End of a Linked List
You are given a singly Linked List with 'N' nodes containing integer data and an integer 'K'. Your task is to delete the Kth node from the end of this Linked Li...read more
Remove the Kth node from the end of a singly linked list.
Traverse the list to find the length 'N'.
Calculate the position of the node to be removed from the beginning as 'N - K + 1'.
Remove the node at the calculated position.
Handle edge cases like removing the head or tail of the list.
Update the pointers accordingly after removal.
Q10. Sum Tree Conversion
Convert a given binary tree into its sum tree. In a sum tree, every node's value is replaced with the sum of its immediate children's values. Leaf nodes are set to 0. Finally, return the pre...read more
Convert a binary tree into a sum tree by replacing each node's value with the sum of its children's values. Return the preorder traversal of the sum tree.
Traverse the tree in a bottom-up manner to calculate the sum of children for each node.
Set leaf nodes to 0 and update non-leaf nodes with the sum of their children.
Return the preorder traversal of the modified tree.
Q11. Convert a Number to Words
Given an integer number num
, your task is to convert 'num' into its corresponding word representation.
Input:
The first line of input contains an integer ‘T’ denoting the number of tes...read more
Convert a given integer number into its corresponding word representation.
Implement a function that takes an integer as input and returns the word representation of the number in English lowercase letters.
Break down the number into its individual digits and convert each digit into its word form (e.g., 1 to 'one', 2 to 'two').
Combine the word forms of individual digits to form the word representation of the entire number.
Ensure there is a space between consecutive words and th...read more
Q12. Vertical Sum in a Binary Tree
Given a binary tree with positive integers at each node, calculate the vertical sum for node values, where the vertical sum is the sum of nodes that can be connected by a vertical ...read more
Calculate the vertical sum of node values in a binary tree.
Traverse the binary tree in a vertical order and keep track of the sum for each vertical line.
Use a hashmap to store the sum for each vertical line.
Recursively traverse the tree, updating the sum for each vertical line as you go.
Output the vertical sums for each test case in the order they were given.
Q13. Graph Coloring Problem
You are given a graph with 'N' vertices numbered from '1' to 'N' and 'M' edges. Your task is to color this graph using two colors, such as blue and red, in a way that no two adjacent vert...read more
Given a graph with 'N' vertices and 'M' edges, determine if it can be colored using two colors without adjacent vertices sharing the same color.
Use graph coloring algorithm like BFS or DFS to check if it is possible to color the graph with two colors.
Check if any adjacent vertices have the same color. If yes, then it is not possible to color the graph as described.
If the graph has connected components, color each component separately to determine if the entire graph can be co...read more
Q14. Inplace Rotate Matrix 90 Degrees Anti-Clockwise
You are provided with a square matrix of non-negative integers of size 'N x N'
. The task is to rotate this matrix by 90 degrees in an anti-clockwise direction wit...read more
Rotate a square matrix by 90 degrees anti-clockwise without using extra space.
Iterate through each layer of the matrix from outer to inner layers
Swap elements in groups of 4 to rotate the matrix in place
Handle odd-sized matrices separately by adjusting the loop boundaries
Q15. Spring Collections Difference between list and set What is sorted mean in hashed set java Serialization Exceptions How can you give an exception to caller method Unix- how to move a folder without giving yes/no...
read moreInterview questions for Software Developer related to Spring, Collections, Serialization, Exceptions, Unix, Annotations, Json, Build tools, Restful services, and more.
List and Set are both collection interfaces in Java. List allows duplicates and maintains insertion order while Set doesn't allow duplicates and doesn't maintain any order.
Sorted in Hashed Set means that the elements are stored in a sorted order based on their hash code.
Serialization is the process of converting...read more
Q16. What is rotational shifts. What is web service flow. How will you check ports on Unix or Solaris machine.
Rotational shifts refer to working in different shifts at different times. Web service flow is the sequence of steps involved in a web service request. Checking ports on Unix or Solaris machine involves using the netstat command.
Rotational shifts involve working in different shifts at different times, such as day shift, night shift, and swing shift.
Web service flow involves a sequence of steps, such as sending a request, receiving a response, and processing the data.
To check ...read more
Q17. Which database are you going to use for Parking lot and Why ?
I would use a relational database like MySQL for the Parking lot as it provides structured data storage and supports complex queries.
Relational databases like MySQL offer structured data storage for parking lot information
Supports complex queries for managing parking lot data efficiently
Ability to handle large amounts of data and transactions
Provides data integrity and security features
Can easily integrate with other systems and applications
SQL query to retrieve the Nth highest salary from a database
Use the ORDER BY clause to sort salaries in descending order
Use the LIMIT clause to retrieve the Nth highest salary
Consider handling cases where there might be ties for the Nth highest salary
Q19. Program Based on Java String Operations. Print concatenation of Zig Zag string from a row
Program to concatenate Zig Zag string from a row using Java String Operations.
Use StringBuilder to efficiently concatenate strings
Use loops to traverse the rows and columns of the zig zag pattern
Use conditional statements to determine the direction of traversal
Q20. Tell us about Coalnet Architecture of MMS Module?
Coalnet Architecture of MMS Module is a system for managing and monitoring coal mines.
Coalnet Architecture is designed to manage and monitor coal mines.
It includes modules for tracking production, equipment maintenance, and safety.
The MMS Module specifically focuses on maintenance management.
It allows for scheduling and tracking of maintenance tasks, as well as inventory management.
The architecture is scalable and can be customized to fit the needs of different mines.
It is bu...read more
Q21. How to check ports in Solaris or linux machine
To check ports in Solaris or Linux machine, use the netstat command.
Open the terminal and type 'netstat -an' to display all open ports.
Use 'netstat -an | grep
' to check if a specific port is open. To check listening ports, use 'netstat -an | grep LISTEN'.
For Solaris, use 'netstat -an | grep .
' instead of '| grep '.
Q22. Given array contain duplicate elements need to remove duplicates and after deletion oreder of remaining element should remain same..
Remove duplicates from array of strings while maintaining original order.
Iterate through the array and use a Set to keep track of unique elements.
Add elements to a new array only if they are not already in the Set.
Q23. What is the difference between iterator and geneator
Iterator is a design pattern that allows sequential access to elements, while generator is a function that can pause and resume execution.
Iterator is an object that provides a way to access elements of a collection sequentially.
Generator is a function that can yield multiple values one at a time, allowing it to pause and resume execution.
Iterators are used in loops to iterate over collections like arrays, while generators are used to create iterable sequences.
Q24. What is java and explain oopes concept
Java is a popular programming language used for developing various applications. OOPs (Object-Oriented Programming) is a programming paradigm based on the concept of objects.
Java is a class-based, object-oriented programming language.
OOPs concepts include encapsulation, inheritance, polymorphism, and abstraction.
Encapsulation is the bundling of data and methods that operate on the data into a single unit.
Inheritance allows a class to inherit properties and behavior from anoth...read more
Q25. a robot that cleans the whole room
A robot that cleans the whole room is a useful tool for maintaining cleanliness and saving time.
Efficiently cleans all surfaces in the room
Can reach tight spaces and corners easily
Saves time and effort for the user
Examples: Roomba vacuum cleaner, iRobot Braava mopping robot
Q26. How would you solve this bug
To solve the bug, I would first identify the root cause by analyzing the code, testing different scenarios, and debugging.
Review the code where the bug is occurring to understand the logic and flow
Use debugging tools to step through the code and track the variables
Test different scenarios to reproduce the bug and identify patterns
Check for any recent changes or updates that may have introduced the bug
Q27. Longest string with no repeating character
Find the longest string in an array with no repeating characters.
Iterate through each string in the array
Use a set to keep track of characters seen so far
Update the longest string found without repeating characters
Q28. Linux bash script to rename files
Use 'mv' command in a bash script to rename files in Linux.
Use 'mv' command followed by the current file name and the new file name to rename files.
You can use wildcards like '*' to rename multiple files at once.
Make sure to test the script on a few files before running it on all files.
Q29. Linux system calls with an example
Linux system calls are functions provided by the kernel for user-space programs to interact with the operating system.
System calls are used to request services from the kernel, such as creating processes, opening files, and networking.
Examples of system calls include open(), read(), write(), fork(), exec(), and socket().
System calls are invoked using a software interrupt or trap instruction, switching the CPU from user mode to kernel mode.
System calls are essential for the fu...read more
Q30. How do you create thread locks
Thread locks are created using synchronization mechanisms to prevent multiple threads from accessing shared resources simultaneously.
Use synchronized keyword in Java to create a synchronized block or method
Use locks from java.util.concurrent.locks package like ReentrantLock
Use synchronized collections like ConcurrentHashMap to handle thread safety
Implement thread-safe data structures like BlockingQueue for producer-consumer scenarios
Q31. What is web service flow
Web service flow is the sequence of steps involved in the communication between a client and a server over the internet.
Web service flow involves a client sending a request to a server
The server processes the request and sends a response back to the client
The response can be in various formats such as XML, JSON, or plain text
Web service flow can be synchronous or asynchronous
Examples of web services include RESTful APIs and SOAP web services
Q32. What is testing explain types
Testing is the process of evaluating a software application to identify defects or bugs.
Types of testing include unit testing, integration testing, system testing, acceptance testing, and regression testing.
Unit testing involves testing individual components or modules of the software.
Integration testing checks if different modules work together correctly.
System testing evaluates the entire system's functionality.
Acceptance testing ensures that the software meets the user's r...read more
Q33. What is exceptions handling
Exceptions handling is a mechanism to handle errors or exceptional situations in a program.
Exceptions allow for graceful handling of errors without crashing the program
Try-catch blocks are commonly used to catch and handle exceptions
Exceptions can be thrown manually using 'throw' keyword
Common exceptions include NullPointerException, ArrayIndexOutOfBoundsException, etc.
Q34. What is auto event wireup
Auto event wireup is a feature in ASP.NET that automatically connects events to event handlers based on naming conventions.
Auto event wireup simplifies event handling by automatically connecting events to event handlers without needing to manually wire them up in code.
In ASP.NET Web Forms, auto event wireup is enabled by default, but can be disabled by setting the AutoEventWireup attribute to false in the Page directive.
Event handlers are expected to follow a specific naming ...read more
Q35. What are Decorators in Python
Decorators in Python are functions that modify the behavior of other functions or methods.
Decorators are denoted by the @ symbol followed by the decorator name.
They allow you to add functionality to an existing function without modifying its code.
Common use cases include logging, authentication, and memoization.
Example: @staticmethod decorator in Python is used to define a method that is not bound to the class instance.
Q36. Locators in automation selenium
Locators in automation selenium are used to identify web elements on a webpage for testing purposes.
Locators include ID, class name, name, tag name, link text, partial link text, and xpath.
ID is the most efficient locator as it is unique for each element.
Xpath is powerful but can be slow and brittle if not used correctly.
Using CSS selectors can also be a good alternative to xpath.
It is important to choose the right locator strategy based on the specific element and context.
Q37. Implement your own search functionality
Implement a custom search functionality using algorithms like binary search or linear search.
Understand the requirements for the search functionality
Choose an appropriate search algorithm based on the data size and type
Implement the chosen algorithm in the programming language of choice
Test the search functionality with different input data to ensure accuracy
Q38. Dynamic memory allocation in C
Dynamic memory allocation in C allows for allocating memory at runtime, enabling flexibility in memory usage.
Use functions like malloc(), calloc(), and realloc() to allocate memory dynamically.
Remember to free the allocated memory using free() to avoid memory leaks.
Dynamic memory allocation is commonly used for creating arrays or structures of unknown size.
Example: int *ptr = (int*)malloc(5 * sizeof(int));
Q39. Trapping rain water problem
Trapping rain water problem involves calculating the amount of water that can be trapped between buildings given their heights.
Calculate the maximum height of buildings to the left and right of each building
Find the minimum of the two heights
Subtract the height of the current building to get the amount of water that can be trapped at that building
Q40. writte code for fibonacci
Fibonacci code generates a series of numbers where each number is the sum of the two preceding ones.
Start with two variables initialized to 0 and 1
Use a loop to calculate the next number by adding the previous two
Repeat the process until reaching the desired length or value
Q41. Design Toll system
Design a toll system for collecting fees from vehicles using RFID technology.
Implement RFID technology for automatic vehicle identification
Set up toll booths with RFID readers to detect vehicles
Calculate toll fees based on vehicle type, distance traveled, and time of day
Provide payment options such as prepaid accounts or credit card payments
Q42. Generate paranthesis
Generate all valid combinations of parentheses for a given number n
Use backtracking to generate all possible combinations of opening and closing parentheses
Keep track of the number of opening and closing parentheses used
Add opening parentheses if there are remaining to be used, and add closing parentheses if it won't create an invalid combination
Q43. Dense rank in sql
Dense rank in SQL is a function that assigns a rank to each row in a result set with no gaps between the ranks.
Dense rank is used to assign unique ranks to each row in a result set, with no gaps between the ranks.
It is similar to the RANK function, but does not leave gaps in the ranking sequence.
For example, if two rows have the same value and are ranked 1 and 2, the next row will be ranked 3, not 2.
Q44. Sort using frequency
Sort an array of strings based on their frequency of occurrence.
Create a frequency map to count the occurrences of each string
Sort the strings based on their frequency in descending order
If two strings have the same frequency, sort them lexicographically
Return the sorted array
Q45. Camel banana problem
The Camel Banana problem is a puzzle that involves calculating the number of bananas a camel can eat.
The problem involves a camel that can carry a certain weight and a number of bananas with different weights.
The camel can only carry a maximum weight and can only eat a certain number of bananas.
The goal is to determine the maximum number of bananas the camel can eat without exceeding its weight limit.
More about working at Oracle
Top HR Questions asked in Jgn Sugar And Biofuels
Interview Process at Jgn Sugar And Biofuels
Top Software Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month