
Oracle


100+ Oracle Interview Questions and Answers for Freshers
Q1. Puzzle: – Two persons X and Y are sitting side by side with a coin in each’s hand. The game is to simultaneously flip the coin till anyone wins. Player X will win if he gets a consecutive HEAD, TAIL however Y w...
read moreThe game is not fair.
Player X has a higher chance of winning as they only need to get a consecutive HEAD, TAIL.
Player Y needs to get a consecutive HEAD, HEAD which is less likely to occur.
The probability of Player X winning is higher than Player Y winning.
Q2. In a bag you have 20 black balls and 16 red balls.When you take out 2 black balls you take another white ball.If you take 2 white balls then you take out 1 black ball and if balls are of different color you tak...
read moreThe last ball that will be left is black.
When you take out 2 black balls, you take another white ball.
If you take 2 white balls, you take out 1 black ball.
If balls are of different color, you take out another black ball.
Since there are more black balls initially, the last ball will be black.
Q3. Design a website similar to bookmyshow.com for booking cinema tickets but it must be for a single location only which can have multiple theatres in it. In this he wanted me to design a basic rough GUI, relevant...
read moreDesign a website similar to bookmyshow.com for booking cinema tickets for a single location with multiple theatres.
Design a user-friendly GUI with options for advance booking, user login, user registration, movie rating, and saving card details.
Create relevant database tables to store information about movies, theatres, bookings, user details, and card details.
Link the GUI to the database to enable data flow and retrieval.
Implement features like advance booking, where users c...read more
Q4. Provided a string a character and a count, you have to print the string after the specified character has occurred count number of times. Ex: String: “This is demo string” Character: ‘i’ Count: 3 Output: “ng” H...
read moreThe program prints the substring after a specified character has occurred a certain number of times in a given string.
Iterate through the string to find the specified character.
Keep track of the count of occurrences of the character.
Once the count reaches the specified count, extract the substring after that position.
Handle corner cases such as when the character is not in the string or when it doesn't occur the specified number of times.
Q5. There are five glasses that are kept upside down.At a time you are bound to turn four glasses.Give minimum number of times in which you can turn back all the glasses so that now none among them are upside down
Minimum number of times to turn all glasses upside down when 4 can be turned at a time.
Turn over any four glasses, leaving one untouched.
Repeat the above step until only one glass is left upside down.
Finally, turn over the last glass to complete the task.
Minimum number of turns required is 3.
Q6. 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}.
Q7. Code: – Given the value of a starting position and an ending position, you have to reach from start to end in a linear way, and you can move either to position immediate right to current position or two step ri...
read morePrint all possible paths from start to end in a linear way, moving either one or two steps right.
Use dynamic programming to solve the problem
Create a 2D array to store the number of paths to each position
Start from the end position and work backwards
At each position, calculate the number of paths by summing the number of paths from the next two positions
Print all the paths by backtracking from the start position
Q8. 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.
Q9. 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
Q10. 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
Q11. 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.
Q12. 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.
Q13. 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
Q14. Write a code for inserting two numbers in a text file given n2>n1 and the next entry should not be overlapping like if first was 4,6 next can't be 5,7.the second n1 has to be greater than first n2
The code inserts two numbers in a text file, ensuring that the second number is greater than the first and there is no overlap between entries.
Read the existing entries from the text file
Check if the new numbers satisfy the conditions
If conditions are met, insert the new numbers into the file
Otherwise, display an error message
Q15. 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
Q16. 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
Q17. Reverse Words in a String: Problem Statement
You are given a string of length N
. Your task is to reverse the string word by word. The input may contain multiple spaces between words and may have leading or trai...read more
Reverse words in a string word by word, removing leading/trailing spaces and extra spaces between words.
Split the input string by spaces to get individual words
Reverse the order of the words
Join the reversed words with a single space in between
Q18. Minimum Number of Platforms Needed Problem Statement
You are given the arrival and departure times of N trains at a railway station for a particular day. Your task is to determine the minimum number of platform...read more
The task is to determine the minimum number of platforms needed at a railway station based on arrival and departure times of trains.
Sort the arrival and departure times in ascending order.
Use two pointers to track overlapping schedules.
Increment platform count when a new train arrives before the previous one departs.
Q19. Write code to find the middle element of a linked list
Code to find the middle element of a linked list
Traverse the linked list with two pointers, one moving twice as fast as the other
When the fast pointer reaches the end, the slow pointer will be at the middle element
If the linked list has even number of elements, return the second middle element
Q20. Write a code to count the number of times '1' occurs from 1 to 999999
Code to count the number of times '1' occurs from 1 to 999999
Loop through all numbers from 1 to 999999
Convert each number to a string and count the number of '1's in it
Add the count to a running total
Return the total count
Q21. Given a matrix.Write a code to print the transpose of the matrix
The code prints the transpose of a given matrix.
Iterate through each row and column of the matrix.
Swap the elements at the current row and column with the elements at the current column and row.
Print the transposed matrix.
Q22. Puzzle: Gi1ven 4 coins, arrange then to make maximum numbers of triangle of the figure
Arrange 4 coins to make maximum number of triangles
Place 3 coins in a triangle formation and the fourth coin in the center to form 4 triangles
Place 2 coins on top of each other and the other 2 coins on either side to form 2 triangles
Place 2 coins in a line and the other 2 coins on either side to form 2 triangles
Q23. Puzzle: Given 10 coins, arrange them such that we get 4 different rows each containing 4 coins
Arrange 10 coins in 4 rows of 4 coins each.
Place 4 coins in a row and keep the remaining 6 aside.
Place 3 coins from the remaining 6 in the next row and keep the remaining 3 aside.
Place 2 coins from the remaining 3 in the third row and keep the remaining 1 aside.
Place the last coin in the fourth row along with the remaining 1 coin from step 3.
The final arrangement will have 4 rows with 4 coins each.
Q24. Explain multitasking and multiprogramming
Multitasking is the ability of an operating system to run multiple tasks concurrently while multiprogramming is the ability to run multiple programs concurrently.
Multitasking allows multiple tasks to run concurrently on a single processor system.
Multiprogramming allows multiple programs to run concurrently on a single processor system.
Multitasking is achieved through time-sharing, where the processor switches between tasks at a very high speed.
Multiprogramming is achieved thr...read more
Q25. Design circular doubly linked list with all operations.
Circular doubly linked list is a data structure where each node has a reference to both the next and previous nodes, forming a circular loop.
Create a Node class with data, next, and prev pointers
Implement operations like insert, delete, search, and display
Ensure the last node's next pointer points to the first node and the first node's prev pointer points to the last node
Q26. Different types of searching and sorting algo discussion.
Searching and sorting algorithms are essential in programming for efficiently organizing and retrieving data.
Searching algorithms: linear search, binary search, depth-first search, breadth-first search
Sorting algorithms: bubble sort, selection sort, insertion sort, merge sort, quick sort
Examples: Searching for a specific item in a list, sorting a list of numbers in ascending order
Q27. What is the difference between a micro controller and a micro processor?
Microcontroller is a self-contained system with memory, peripherals and processor, while microprocessor only has a processor.
Microcontroller has on-chip memory and peripherals, while microprocessor requires external memory and peripherals.
Microcontroller is used in embedded systems, while microprocessor is used in general-purpose computing.
Examples of microcontrollers include Arduino, PIC, and AVR, while examples of microprocessors include Intel Pentium, AMD Ryzen, and ARM Co...read more
Q28. Can an array have elements of different data types?
Yes, an array can have elements of different data types.
An array can have elements of different data types, but it's not recommended.
It can make the code harder to read and maintain.
For example, an array can have both strings and numbers: ['apple', 5, 'banana']
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
Q30. What is a linked list ? What are its uses?
A linked list is a linear data structure where each element is a separate object linked together by pointers.
Linked list is used to implement stacks, queues, and hash tables.
It is used in computer memory allocation.
It is used in image processing to represent pixels.
It is used in music player to create a playlist.
It is used in web browsers to store the history of visited web pages.
Q31. Modified Balanced Parentheses where a character can be matched with any other character, i.e. / with &, ! with ? and so on.
Modified Balanced Parentheses where characters can be matched with any other character.
Use a stack to keep track of opening characters
When encountering a closing character, check if it matches the top of the stack
If it matches, pop from the stack, else return false
Continue until end of string, return true if stack is empty
Q32. Largest element in window size K
Find the largest element in a window of size K in an array.
Iterate through the array and maintain a deque to store the indices of elements in decreasing order.
Remove indices from the front of the deque that are outside the current window.
The front of the deque will always have the index of the largest element in the current window.
Q33. Given an array of strings, print all the possible combinations of strings created by picking one character from each string of the array. The individual strings do not contain any duplicates. Ex: {ABC, DE} Ans...
read morePrint all possible combinations of strings by picking one character from each string in the array.
Iterate through each character of the first string and combine it with each character of the second string.
Repeat the process for all strings in the array to get all possible combinations.
Use nested loops to generate combinations efficiently.
Q34. What are data structures?
Data structures are ways of organizing and storing data in a computer so that it can be accessed and used efficiently.
Data structures can be linear or non-linear
Examples of linear data structures include arrays, linked lists, and stacks
Examples of non-linear data structures include trees and graphs
Choosing the right data structure is important for optimizing performance and memory usage
Q35. 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.
Number and Digits Problem Statement
You are provided with a positive integer N
. Your task is to identify all numbers such that the sum of the number and its digits equals N
.
Example:
Input:
N = 21
Output:
[15]
Identify numbers whose sum with digits equals given integer N.
Iterate through numbers from 1 to N and check if sum of number and its digits equals N.
Use a helper function to calculate sum of digits for a given number.
Return -1 if no such number exists for a test case.
Q37. Given a date in string format, write a java program to return the date n days after the given date. Solve the question without using DateTimeFormatter or any similar Date parsing libraries.
Java program to calculate date n days after given date without using Date parsing libraries.
Parse the input date string to extract day, month, and year components.
Calculate the total number of days represented by the input date.
Add the specified number of days to the total days calculated.
Convert the final total days back to day, month, and year components to get the new date.
Q38. Explain about the transaction that happen in a bank
Transactions in a bank involve the movement of funds between accounts or the exchange of currency.
Transactions can be initiated by customers or by the bank itself
Common types of transactions include deposits, withdrawals, transfers, and loans
Transactions are recorded in the bank's ledger and may be subject to fees or interest
Electronic transactions have become increasingly popular, such as online banking and mobile payments
Q39. Rotational Equivalence of Strings Problem Statement
Given two strings 'P' and 'Q' of equal length, determine if string 'P' can be transformed into string 'Q' by cyclically rotating it to the right any number of...read more
Q40. Tell me about the OS your phone uses? What are the other phone operating systems available in the market
My phone uses iOS. Other phone operating systems available in the market are Android, Windows, and Blackberry OS.
iOS is developed by Apple and is exclusive to iPhones and iPads.
Android is developed by Google and is used by various phone manufacturers such as Samsung, LG, and HTC.
Windows is developed by Microsoft and is used by Nokia and other phone manufacturers.
Blackberry OS is developed by Blackberry and is exclusive to Blackberry phones.
Q41. Sql query using joins
SQL query using joins
Use JOIN keyword to combine rows from two or more tables based on a related column between them
Types of joins include INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN
Example: SELECT * FROM table1 INNER JOIN table2 ON table1.column = table2.column
Q42. Print all combinations of numbers in an array which sum up to a number k. Ex : Arr={3,1,4,5} k=5 Ans : {{1,4},{5}}
Use backtracking to find all combinations of numbers in an array that sum up to a given number.
Start by sorting the array in non-decreasing order to easily identify combinations.
Use backtracking to recursively find all combinations that sum up to the target number.
Keep track of the current combination and the remaining sum as you traverse the array.
Add the current combination to the result when the sum equals the target number.
Q43. Merge K Sorted Arrays Problem Statement
Given 'K' different arrays that are individually sorted in ascending order, merge all these arrays into a single array that is also sorted in ascending order.
Input
The f...read more
Merge K sorted arrays into a single sorted array.
Iterate through all arrays and merge them using a min-heap.
Use a priority queue to efficiently merge the arrays.
Time complexity can be optimized to O(N log K) using a min-heap.
Q44. Subarray With Given Sum Problem Statement
Given an array ARR
of N integers and an integer S, determine if there exists a contiguous subarray within the array with a sum equal to S. If such a subarray exists, re...read more
Q45. Find The Repeating And Missing Number Problem Statement
You are provided with an array nums
which contains the first N positive integers. In this array, one integer appears twice, and one integer is missing. Yo...read more
Given an array of first N positive integers with one number repeating and one missing, find the repeating and missing numbers.
Iterate through the array and keep track of the sum of elements and sum of squares of elements.
Calculate the missing number using the formula: missing = N*(N+1)/2 - sum of elements.
Calculate the repeating number using the formula: repeating = missing + sum of elements - sum of squares of elements.
Q46. Preorder Traversal to BST Problem Statement
Given an array or list PREORDER
representing the preorder traversal of a Binary Search Tree (BST) with N
nodes, construct the BST which matches the given preorder tra...read more
Given a preorder traversal of a BST, construct the BST and print its inorder traversal.
Parse the input to get the number of test cases and preorder traversal for each case
Construct the BST using the preorder traversal by recursively building the tree
Print the inorder traversal of the constructed BST for each test case
Q47. Design Tic Tac Toe
Design a Tic Tac Toe game
Create a 3x3 grid to represent the game board
Allow two players to take turns marking X and O on the grid
Check for win conditions after each move to determine the winner
Handle tie game if all spaces are filled without a winner
Q48. Rearrange The Array Problem Statement
You are given an array/list 'NUM' of integers. Rearrange the elements of 'NUM' such that no two adjacent elements are the same in the rearranged array.
Example:
Input:
NUM[...read more
The task is to rearrange an array such that no two adjacent elements are the same.
Iterate through the array and check if any adjacent elements are the same.
If adjacent elements are the same, swap one of them with a different element.
Return 'YES' if a valid rearrangement is possible, 'NO' otherwise.
Q49. Anagram Pairs Verification Problem
Your task is to determine if two given strings are anagrams of each other. Two strings are considered anagrams if you can rearrange the letters of one string to form the other...read more
Determine if two strings are anagrams of each other by checking if they have the same characters in different order.
Create character frequency maps for both strings
Compare the frequency of characters in both maps to check if they are anagrams
Return True if the frequencies match, False otherwise
Q50. Remove BST Keys Outside Given Range
Given a Binary Search Tree (BST) and a specified range [min, max], your task is to remove all keys from the BST that fall outside this range. The BST should remain valid afte...read more
Q51. Check if a Number is Binary
Determine if a given string of integers bin
represents a valid binary number. Return 'true'
if the string represents a valid binary number, otherwise return 'false'
. A binary number ...read more
Check if a given string represents a valid binary number composed of 0s and 1s.
Iterate through each character in the string and check if it is either '0' or '1'.
If any character is not '0' or '1', return 'false'.
Return 'true' if all characters are '0' or '1'.
Q52. Print all Pythagorean triplets within a given range.
Print Pythagorean triplets within a given range.
Iterate through all possible combinations of a, b, and c within the given range
Check if a^2 + b^2 = c^2 for each combination
Print the triplets that satisfy the Pythagorean theorem
Q53. Reverse a String Problem Statement
Given a string STR
containing characters from [a-z], [A-Z], [0-9], and special characters, determine the reverse of the string.
Input:
The input starts with a single integer '...read more
Reverse a given string containing characters from [a-z], [A-Z], [0-9], and special characters.
Iterate through each character in the string and append them in reverse order to a new string
Use built-in functions like reverse() or slice() to reverse the string
Handle special characters and numbers along with alphabets
Q54. BST to Greater Tree Conversion
Convert a given binary search tree (BST) with 'N' nodes into a Greater Tree. In this transformation, each node's data is modified to the sum of the original node's data plus the s...read more
Convert a given BST into a Greater Tree by updating each node's data to the sum of original data and all greater nodes' data.
Traverse the BST in reverse inorder (right, root, left) to update nodes' data.
Keep track of the sum of greater nodes' data while traversing.
Update each node's data by adding the sum of greater nodes' data to the original data.
Example: Input BST: 4 1 6 0 2 5 7 -1 -1 -1 3 -1 -1 -1 -1. Output Greater Tree: 22 26 15 30 27 18 7 -1 -1 -1 33 -1 -1 -1 -1.
Q55. Check if given string has Balanced Parentheses.
Check if a string has balanced parentheses.
Use a stack to keep track of opening parentheses.
Iterate through the string and push opening parentheses onto the stack.
When a closing parenthesis is encountered, pop from the stack and check if it matches the closing parenthesis.
If stack is empty at the end and all parentheses are matched, the string has balanced parentheses.
Q56. Describe in steps how you downloaded any software recently
I recently downloaded VLC media player.
Visited the official website of VLC media player
Clicked on the download button
Selected the appropriate version for my operating system
Waited for the download to complete
Opened the downloaded file and followed the installation wizard
Q57. Predict Output based on whether static variables can be accessed from non-static method
Static variables can be accessed from non-static methods using an object reference or by making the variable non-static.
Static variables can be accessed from non-static methods by creating an object of the class containing the static variable.
Alternatively, the static variable can be made non-static to be accessed directly from a non-static method.
Attempting to access a static variable directly from a non-static method will result in a compilation error.
Q58. String a = "Something" String b = new String("Something") How many object created?
Two objects created - one in the string pool and one in the heap.
String 'a' is created in the string pool, while String 'b' is created in the heap.
String pool is a special area in the heap memory where strings are stored to increase reusability and save memory.
Using 'new' keyword always creates a new object in the heap, even if the content is the same as an existing string in the pool.
Q59. String a = "Something" a.concat(" New") What will be garbage collected?
Only the original string 'Something' will be garbage collected.
The concat method in Java does not modify the original string, but instead returns a new string with the concatenated value.
In this case, 'a' remains as 'Something' and a new string 'Something New' is created, but not assigned to any variable.
Since the new string is not stored in any variable, it will not be garbage collected.
Q60. Guesstimate - how many flights are handled by Bangalore airport on a daily basis
Around 600 flights are handled by Bangalore airport on a daily basis.
Bangalore airport is one of the busiest airports in India
It handles both domestic and international flights
On average, there are around 25-30 flights per hour
The number of flights may vary depending on the day of the week and time of the year
Q61. Common Elements in two Sorted Linked List
Finding common elements in two sorted linked lists.
Traverse both lists simultaneously using two pointers.
Compare the values of the nodes pointed by the two pointers.
If they are equal, add the value to the result list and move both pointers.
If not, move the pointer pointing to the smaller value.
Repeat until one of the lists is fully traversed.
Q62. Delete nth node from end of linked list
Delete nth node from end of linked list
Use two pointers, one to traverse the list and another to keep track of the nth node from the end
Once the nth node is reached, move both pointers until the end of the list
Delete the node pointed by the second pointer
The result of adding two binary numbers in a 64-bit and a 32-bit operating system will differ due to the different number of bits used for calculations.
In a 64-bit operating system, the result will be more accurate and can handle larger numbers compared to a 32-bit system.
Overflow may occur in a 32-bit system when adding large binary numbers, leading to incorrect results.
Example: Adding 1111 (15 in decimal) and 1111 (15 in decimal) in a 32-bit system may result in overflow an...read more
Q64. Write code two merge and remove duplicates from two sorted arrays with any Collections
Merge and remove duplicates from two sorted arrays without using Collections
Use two pointers to iterate through both arrays simultaneously
Compare elements at each pointer and add the smaller one to the result array
Skip duplicates by checking if the current element is equal to the previous element
Q65. 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
Q66. Kth element after merging two sorted arrays
Finding the Kth element after merging two sorted arrays.
Merge the two sorted arrays into a single array.
Sort the merged array.
Return the Kth element from the merged and sorted array.
Q67. 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.
Q68. What is inheritance in oops
Inheritance in OOP allows a class to inherit properties and behaviors from another class.
Inheritance promotes code reusability by allowing a new class to use the properties and methods of an existing class.
The class that is being inherited from is called the base class or parent class, while the class that inherits is called the derived class or child class.
Derived classes can add new properties and methods, or override existing ones from the base class.
Example: class Animal ...read more
Q69. What is oops?
OOPs stands for Object-Oriented Programming. It is a programming paradigm based on the concept of objects.
OOPs is a way of organizing and designing code around objects
It emphasizes on encapsulation, inheritance, and polymorphism
It helps in creating reusable and modular code
Examples of OOPs languages are Java, C++, Python, etc.
Q70. Difference between 'having' clause and 'where' clause in MySQL
HAVING clause is used with GROUP BY to filter groups, WHERE clause is used to filter rows.
HAVING clause is used with GROUP BY clause to filter groups based on aggregate functions.
WHERE clause is used to filter rows based on conditions.
HAVING clause is used after GROUP BY clause, while WHERE clause is used before GROUP BY clause.
HAVING clause can use aggregate functions, while WHERE clause cannot.
Example: SELECT category, COUNT(*) FROM products GROUP BY category HAVING COUNT(*...read more
Q71. What is the difference between static and dynamic typing in python?
Static typing requires variable types to be declared at compile time, while dynamic typing allows types to be determined at runtime.
Static typing requires explicit declaration of variable types, while dynamic typing infers types at runtime.
Static typing helps catch errors at compile time, while dynamic typing may lead to runtime errors.
Python is dynamically typed, but can be used with type hints for static type checking.
Example of static typing: int x = 5
Example of dynamic ty...read more
Q72. Write code to emulate Producer/Consumer Problem
Emulate Producer/Consumer Problem using code
Create a shared buffer between producer and consumer
Use synchronization mechanisms like mutex or semaphore to control access to the buffer
Implement producer and consumer functions to add and remove items from the buffer respectively
Q73. What is the difference between list and touple in python?
Lists are mutable, ordered collections of items, while tuples are immutable, ordered collections of items.
Lists are defined using square brackets [], while tuples are defined using parentheses ().
Lists can be modified after creation (mutable), while tuples cannot be modified (immutable).
Lists are typically used for collections of similar items that may need to be changed, while tuples are used for fixed collections of items.
Example: list_example = [1, 2, 3] and tuple_example ...read more
Q74. What knowledge to you have about PL/SQL?
PL/SQL is a procedural language designed specifically for the Oracle Database management system.
PL/SQL is used to create stored procedures, functions, triggers, and packages in Oracle databases.
It is a block-structured language that allows developers to write code in logical blocks.
PL/SQL supports data types such as VARCHAR2, NUMBER, DATE, BOOLEAN, etc.
It also supports control structures like IF-THEN-ELSE, FOR LOOP, WHILE LOOP, etc.
PL/SQL can be used to manipulate data in Ora...read more
Q75. Rotate a linked list
Rotate a linked list
Create a new node and make it the head
Traverse the list to find the tail and connect it to the old head
Update the tail to point to null
Handle edge cases like empty list or rotating by 0 positions
Q76. Write code to create a deadlock
Creating a deadlock involves two or more threads waiting for each other to release a resource they need.
Create two threads, each trying to lock two resources in a different order
Ensure that one thread locks resource A first and then tries to lock resource B, while the other thread locks resource B first and then tries to lock resource A
This will result in a situation where each thread is waiting for the other to release the resource it needs, causing a deadlock
Q77. Write code to implement LRU Cache
Implement LRU Cache using a data structure like LinkedHashMap in Java
Use LinkedHashMap to maintain insertion order
Override removeEldestEntry method to limit cache size
Update the access order on get and put operations
Q78. Product of an array except self
Calculate the product of all elements in an array except for the element itself.
Iterate through the array and calculate the product of all elements except the current element.
Use two separate arrays to store the product of elements to the left and right of the current element.
Multiply the corresponding elements from the left and right arrays to get the final result.
Q79. What is Function overloading and overriding?
Function overloading is having multiple functions with the same name but different parameters. Function overriding is redefining a function in a subclass.
Function overloading allows multiple functions with the same name but different parameters.
Function overriding involves redefining a function in a subclass with the same name and parameters as in the superclass.
Example of function overloading: int add(int a, int b) and float add(float a, float b)
Example of function overridin...read more
Q80. Write polyfill for array map
Polyfill for array map function in JavaScript
Create a function called myMap that takes a callback function as an argument
Loop through the array and apply the callback function to each element
Return a new array with the results of the callback function applied to each element
Q81. Why do you want to work as a python developer?
I am passionate about coding and enjoy problem-solving using Python.
I have a strong interest in programming and have been learning Python for a while.
I find Python to be a versatile and powerful language that can be used in various applications.
I enjoy the challenge of writing efficient and clean code to solve complex problems.
I believe working as a Python developer will allow me to further enhance my skills and contribute to innovative projects.
Q82. Difference between POJO and Bean
POJO is a Plain Old Java Object with private fields and public getters/setters, while a Bean is a Java class with private fields and public zero-argument constructors.
POJO stands for Plain Old Java Object
POJO has private fields and public getters/setters
Bean is a Java class with private fields and public zero-argument constructors
Beans are usually used in Java EE frameworks like Spring for dependency injection
Q83. Write code to start 5 threads
Code to start 5 threads in Java
Create a class that implements the Runnable interface
Instantiate 5 objects of the class
Create 5 threads using the objects and start them
Q84. Write code to read a file
Code to read a file in Java
Use FileReader and BufferedReader classes to read the file
Handle exceptions using try-catch blocks
Close the file after reading using close() method
Q85. How can you divide a cake into 8 parts only 3 cuts allowed
To divide a cake into 8 parts with only 3 cuts, make two perpendicular cuts to create 4 equal pieces, then cut each of those pieces in half.
Make a horizontal cut across the middle of the cake to create 2 equal halves.
Make a vertical cut through the middle of the cake to create 4 equal quarters.
Make a diagonal cut through each quarter to create 8 equal parts.
Q86. Write a program to separate strong for special characters
Program to separate strong for special characters in an array of strings
Iterate through each string in the array
For each string, iterate through each character
Check if the character is a special character and separate it into a new string if it is
Q87. Singleton Pattern in details
Singleton pattern ensures a class has only one instance and provides a global point of access to it.
Ensures a class has only one instance by providing a global access point to it.
Uses a private constructor to restrict instantiation of the class.
Provides a static method to access the singleton instance.
Commonly used in scenarios where only one instance of a class is needed, such as database connections or logging.
Example: Singleton pattern can be implemented in Java using a pr...read more
Q88. Find second highest vowel occurance in a string
Find the second highest occurrence of a vowel in a string.
Iterate through the string and count the occurrences of each vowel (a, e, i, o, u).
Store the counts in an array and find the second highest count.
Return the vowel with the second highest count.
Q89. count no of links in as web page
To count the number of links on a web page, you can use a web scraping tool or inspect the page's HTML code.
Use a web scraping tool like BeautifulSoup or Selenium to extract all the links from the webpage.
Inspect the HTML code of the webpage and look for anchor tags (<a>) which contain the links.
Count the number of anchor tags to determine the total number of links on the webpage.
Q90. Write locator for element in webpage
Use CSS selector to locate element on webpage
Use unique id or class names to locate element
Use CSS selectors like 'id', 'class', 'name', 'tag name', etc.
Use XPath if necessary for complex element locating
Q91. Normalization of database to BCNF
Normalization to BCNF ensures that every non-trivial functional dependency is satisfied.
Identify all functional dependencies
Eliminate partial dependencies
Eliminate transitive dependencies
Ensure every determinant is a candidate key
Q92. how do we measure code quality?
Code quality can be measured through various metrics and tools to ensure readability, maintainability, efficiency, and reliability.
Use code review processes to assess adherence to coding standards and best practices
Utilize static code analysis tools to identify potential bugs, code smells, and security vulnerabilities
Measure code complexity using metrics like cyclomatic complexity and maintainability index
Track code coverage with unit tests to ensure adequate test coverage
Mon...read more
Q93. What is Polymorphism?
Polymorphism is the ability of an object to take on many forms.
Polymorphism allows objects of different classes to be treated as objects of a common superclass.
It enables methods to be overridden in a subclass to provide different implementations.
Polymorphism enhances code reusability and flexibility.
Example: A superclass 'Animal' with subclasses 'Dog' and 'Cat' can be treated as 'Animal' objects.
Example: Method 'draw()' in superclass 'Shape' can be overridden in subclasses '...read more
Q94. Tell me anput yourself, after 2 years
In 2 years, I see myself as a proficient Order Management Analyst with a deep understanding of the industry and a track record of successful projects.
Continuing to develop my skills in order management software and systems
Taking on more complex projects and responsibilities
Building strong relationships with clients and colleagues
Possibly pursuing additional certifications or advanced education in the field
Q95. remove zeros from arrays list
Remove zeros from arrays list of strings
Iterate through each string in the array
Use filter method to remove zeros from each string
Return the updated array without zeros
Q96. return type of Findelements
FindElements method returns a list of web elements matching the specified locator.
Return type of FindElements is List
It returns a list of all elements matching the specified locator
Example: List
elements = driver.findElements(By.xpath("//input[@type='text']"));
Q97. What is Abstraction?
Abstraction is the process of simplifying complex systems by focusing on the essential details.
Abstraction involves hiding unnecessary details and exposing only the relevant information.
It allows us to create models or representations that capture the essential characteristics of a system.
Abstraction helps in managing complexity and improving understanding and communication.
Examples of abstraction include using functions or methods to encapsulate a series of operations, using...read more
Q98. All neighbors distance k in binary tree
Find all nodes at distance k from a given node in a binary tree.
Use depth-first search to traverse the binary tree and keep track of the distance from the target node.
When reaching the target node, start exploring its children at distance k.
Consider using a queue to keep track of nodes at each level while traversing the tree.
Q99. Prepare DB schema for universiry
Design a database schema for a university
Create tables for students, courses, professors, departments, and enrollments
Establish relationships between tables using foreign keys
Include attributes such as student ID, course ID, professor ID, department ID, and enrollment date
Consider normalization to reduce redundancy and improve data integrity
Q100. Explain all connections and terms
Connections and terms in technology analysis are essential for understanding the relationships between different components and concepts.
Connections refer to the relationships between different elements in a system or network.
Terms are the specific vocabulary used to describe concepts, tools, and processes in technology analysis.
Understanding connections and terms helps analysts make sense of data, identify patterns, and draw conclusions.
Examples: network topology, data encry...read more
More about working at Oracle







Top HR Questions asked in Oracle for Freshers
Interview Process at Oracle for Freshers

Top Interview Questions from Similar Companies








Reviews
Interviews
Salaries
Users/Month

