Published: 23 Aug 2025 | Reading Time: 12 min read
Oracle was established in 1977 and is among the top industry leaders in database management and cloud computing with multiple careers in diverse fields. Oracle recruitment could be challenging, and job seekers must show technical and analytical skills. This comprehensive guide provides an overview of different Oracle job roles, Oracle recruitment process stages, fundamental coding concepts to learn for the Oracle coding round interview questions, and suggestions on cracking the recruitment process.
The Oracle recruitment process consists of five distinct stages:
You submit your CV through Oracle's careers portal.
You have logical reasoning, quantitative aptitude, and verbal ability.
You deal with programming, algorithms, data structures, and solving problems. Sometimes there might be live coding.
Assessing fit within the culture, language skills, and disposition to work in Oracle.
If successful, you will receive an offer letter detailing the job role and pay package.
The Oracle coding interview question basics are embedded in the following core areas:
Here are 12 Oracle coding test questions asked in the technical assessment or interview:
Problem Description:
You are tasked with organising a group of people based on a simple classification system. Each person is assigned a number that can only be 0, 1, or 2, representing different types of roles in a team. Your task is to arrange the group so that all 0s are at the front, followed by all 1s, and then 2s. This way, the group can be easily segmented for different activities. The arrangement must be done efficiently since the group can consist of many people.
Input:
5 2 0 1 2 0
Output:
0 0 1 2 2
#include <iostream>
using namespace std;
void sortColors(int arr[], int n) {
int count[3] = {0};
for (int i = 0; i < n; i++) {
count[arr[i]]++;
}
for (int i = 0; i < count[0]; i++) arr[i] = 0;
for (int i = 0; i < count[1]; i++) arr[count[0] + i] = 1;
for (int i = 0; i < count[2]; i++) arr[count[0] + count[1] + i] = 2;
}
int main() {
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
sortColors(arr, n);
for (int i = 0; i < n; i++) {
cout << arr[i] << " ";
}
cout << endl;
return 0;
}
def sort_colors(arr):
count = [0, 0, 0] # To count 0s, 1s, and 2s
for num in arr:
count[num] += 1
index = 0
for i in range(3):
for _ in range(count[i]):
arr[index] = i
index += 1
# Input and Output
n = int(input())
arr = list(map(int, input().split()))
sort_colors(arr)
print(" ".join(map(str, arr)))
import java.util.Scanner;
public class SortColors {
public static void sortColors(int[] arr) {
int[] count = new int[3]; // To count 0s, 1s, and 2s
for (int num : arr) {
count[num]++;
}
int index = 0;
for (int i = 0; i < count[0]; i++) arr[index++] = 0;
for (int i = 0; i < count[1]; i++) arr[index++] = 1;
for (int i = 0; i < count[2]; i++) arr[index++] = 2;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = sc.nextInt();
}
sortColors(arr);
for (int num : arr) {
System.out.print(num + " ");
}
System.out.println();
}
}
Problem Description:
Imagine you're an investor who buys and sells stocks. You are given a list of stock prices for each day. You can buy a stock on one day and sell it on a later day. You aim to maximize your profit by buying at the lowest price and selling at the highest possible price. However, you can only perform one buy and one sell operation. Determine your maximum profit using this strategy while ensuring the solution runs efficiently with larger data sets.
Input:
7
1 9 2 11 1 9 2
Output:
10
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n, profit = 0, min_price = INT_MAX;
cin >> n;
for (int i = 0; i < n; i++) {
int price;
cin >> price;
min_price = min(min_price, price);
profit = max(profit, price - min_price);
}
cout << profit << endl;
return 0;
}
n = int(input())
profit = 0
min_price = float('inf')
for _ in range(n):
price = int(input())
min_price = min(min_price, price)
profit = max(profit, price - min_price)
print(profit)
import java.util.Scanner;
public class MaxProfit {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int profit = 0, minPrice = Integer.MAX_VALUE;
for (int i = 0; i < n; i++) {
int price = sc.nextInt();
minPrice = Math.min(minPrice, price);
profit = Math.max(profit, price - minPrice);
}
System.out.println(profit);
}
}
Problem Description:
You are a software developer working on a financial application that requires you to implement subtraction of two large numbers. However, these numbers may involve borrow operations, which are common when subtracting digits that are smaller than the corresponding digits in the other number. Your task is to count the number of borrow operations required to perform the subtraction, or return "Not possible" if the subtraction cannot be performed (e.g., if the first number is smaller than the second). The solution must be optimal for large numbers with varying lengths.
Constraints:
#include <iostream>
#include <cstring>
using namespace std;
int countBorrows(char* num1, char* num2) {
int len1 = strlen(num1), len2 = strlen(num2);
if (len1 < len2 || (len1 == len2 && strcmp(num1, num2) < 0)) {
return -1;
}
int borrow = 0, count = 0;
for (int i = 0; i < len1; i++) {
int digit1 = num1[len1 - 1 - i] - '0';
int digit2 = (i < len2) ? num2[len2 - 1 - i] - '0' : 0;
if (digit1 < digit2 + borrow) {
borrow = 1;
count++;
} else {
borrow = 0;
}
}
return count;
}
int main() {
char num1[100], num2[100];
cin >> num1 >> num2;
int result = countBorrows(num1, num2);
if (result == -1) {
cout << "Not possible" << endl;
} else {
cout << result << endl;
}
return 0;
}
def count_borrows(num1, num2):
if len(num1) < len(num2) or (len(num1) == len(num2) and num1 < num2):
return -1
borrow = 0
count = 0
for i in range(len(num1)):
digit1 = int(num1[-1 - i])
digit2 = int(num2[-1 - i]) if i < len(num2) else 0
if digit1 < digit2 + borrow:
borrow = 1
count += 1
else:
borrow = 0
return count
num1 = input().strip()
num2 = input().strip()
result = count_borrows(num1, num2)
if result == -1:
print("Not possible")
else:
print(result)
import java.util.Scanner;
public class BorrowNumber {
public static int countBorrows(String num1, String num2) {
if (num1.length() < num2.length() || (num1.length() == num2.length() && num1.compareTo(num2) < 0)) {
return -1;
}
int borrow = 0, count = 0;
for (int i = 0; i < num1.length(); i++) {
int digit1 = num1.charAt(num1.length() - 1 - i) - '0';
int digit2 = (i < num2.length()) ? num2.charAt(num2.length() - 1 - i) - '0' : 0;
if (digit1 < digit2 + borrow) {
borrow = 1;
count++;
} else {
borrow = 0;
}
}
return count;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String num1 = sc.next();
String num2 = sc.next();
int result = countBorrows(num1, num2);
if (result == -1) {
System.out.println("Not possible");
} else {
System.out.println(result);
}
}
}
Problem Description:
You have an array of some unique transactions of a company. You want to know how many unique types of transactions were happening within two days of the timeline of the company. A transaction is defined by an integer, so you have some range of days. Your goal is to find out how many unique types of transactions were happening in that range. This needs to be achieved in a time-effective manner as the array could be enormous and you must give a quick output for any given range of days.
Constraints:
Input:
5 1 2 2 3 4 1 3
Output:
3
#include <iostream>
#include <unordered_set>
using namespace std;
int distinctCount(int arr[], int l, int r) {
unordered_set<int> distinct;
for (int i = l; i <= r; i++) {
distinct.insert(arr[i]);
}
return distinct.size();
}
int main() {
int n, l, r;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
cin >> l >> r;
cout << distinctCount(arr, l, r) << endl;
return 0;
}
def distinct_count(arr, l, r):
return len(set(arr[l:r+1]))
n = int(input())
arr = list(map(int, input().split()))
l, r = map(int, input().split())
print(distinct_count(arr, l, r))
import java.util.HashSet;
import java.util.Scanner;
public class DistinctCount {
public static int distinctCount(int[] arr, int l, int r) {
HashSet<Integer> distinctSet = new HashSet<>();
for (int i = l; i <= r; i++) {
distinctSet.add(arr[i]);
}
return distinctSet.size();
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = sc.nextInt();
}
int l = sc.nextInt();
int r = sc.nextInt();
System.out.println(distinctCount(arr, l, r));
}
}
Problem Description:
You are working on a text processing application where you need to analyze the frequency of vowels in various sentences. Your task is to count how many vowels (a, e, i, o, u) are in a given text string. The string could be a long paragraph, and your solution should be efficient enough to handle large text sizes. The input string can contain uppercase and lowercase letters, and your program must accurately account for vowels regardless of their case. This operation is critical for text-based analytics, including readability assessments.
Constraints:
Input:
Hello World
Output:
3
#include <iostream>
using namespace std;
int countVowels(string s) {
int count = 0;
for (char c : s) {
if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' ||
c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U') {
count++;
}
}
return count;
}
int main() {
string s;
getline(cin, s);
cout << countVowels(s) << endl;
return 0;
}
def count_vowels(s):
vowels = "aeiouAEIOU"
return sum(1 for char in s if char in vowels)
s = input().strip()
print(count_vowels(s))
import java.util.Scanner;
public class VowelCount {
public static int countVowels(String s) {
int count = 0;
for (char c : s.toCharArray()) {
if ("aeiouAEIOU".indexOf(c) != -1) {
count++;
}
}
return count;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
System.out.println(countVowels(s));
}
}
Problem Description:
You are a financial analyst evaluating loan offers from two banks. Both banks offer different interest rates and loan tenures with varying periods. Your task is calculating the total interest paid over the full tenure for each loan offer, based on the principal amount. You must compare both offers and determine which bank has the cheaper total interest cost.
Input:
1000 5 3 6 2
Output:
Bank 1 Interest: 150.00
Bank 2 Interest: 120.00
Bank 2 offers the cheaper interest.
#include <iostream>
using namespace std;
int main() {
double p, r1, t1, r2, t2;
cin >> p >> r1 >> t1 >> r2 >> t2;
double interest1 = p * r1 * t1 / 100;
double interest2 = p * r2 * t2 / 100;
cout << "Bank 1 Interest: " << interest1 << "\nBank 2 Interest: " << interest2 << endl;
cout << (interest1 < interest2 ? "Bank 1" : "Bank 2") << " offers the cheaper interest." << endl;
return 0;
}
p, r1, t1, r2, t2 = map(float, input().split())
interest1 = p * r1 * t1 / 100
interest2 = p * r2 * t2 / 100
print(f"Bank 1 Interest: {interest1}\nBank 2 Interest: {interest2}")
print("Bank 1" if interest1 < interest2 else "Bank 2", "offers the cheaper interest.")
import java.util.Scanner;
public class LoanInterest {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double p = scanner.nextDouble(), r1 = scanner.nextDouble(), t1 = scanner.nextDouble(), r2 = scanner.nextDouble(), t2 = scanner.nextDouble();
double interest1 = p * r1 * t1 / 100;
double interest2 = p * r2 * t2 / 100;
System.out.printf("Bank 1 Interest: %.2f\nBank 2 Interest: %.2f\n", interest1, interest2);
System.out.println((interest1 < interest2 ? "Bank 1" : "Bank 2") + " offers the cheaper interest.");
}
}
Problem Description:
You have a list of donation values (integers), and your function is to determine whether it's possible to pick a subset which sums up to a given target value. This is helpful in planning charity donations.
Input:
5 1 2 3 4 5 10
Output:
Subset found
#include <iostream>
#include <vector>
using namespace std;
bool subsetSum(vector<int>& arr, int target) {
vector<bool> dp(target + 1, false);
dp[0] = true;
for (int num : arr)
for (int i = target; i >= num; i--) dp[i] |= dp[i - num];
return dp[target];
}
int main() {
int n, target;
cin >> n;
vector<int> arr(n);
for (int i = 0; i < n; i++) cin >> arr[i];
cin >> target;
cout << (subsetSum(arr, target) ? "Subset found" : "Subset not found") << endl;
return 0;
}
def subset_sum(arr, target):
dp = [False] * (target + 1)
dp[0] = True
for num in arr:
for i in range(target, num - 1, -1):
dp[i] |= dp[i - num]
return dp[target]
n = int(input())
arr = list(map(int, input().split()))
target = int(input())
print("Subset found" if subset_sum(arr, target) else "Subset not found")
import java.util.Scanner;
public class SubsetSum {
public static boolean subsetSum(int[] arr, int target) {
boolean[] dp = new boolean[target + 1];
dp[0] = true;
for (int num : arr)
for (int i = target; i >= num; i--) dp[i] |= dp[i - num];
return dp[target];
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[] arr = new int[n];
for (int i = 0; i < n; i++) arr[i] = scanner.nextInt();
int target = scanner.nextInt();
System.out.println(subsetSum(arr, target) ? "Subset found" : "Subset not found");
}
}
Problem Description:
You are working on a system that stores customer orders in a linked list. You need to reverse the list to process them in the reverse order.
Input:
5 1 2 3 4 5
Output:
5 4 3 2 1
#include <iostream>
using namespace std;
struct Node { int data; Node* next; };
void reverse(Node*& head) {
Node *prev = nullptr, *cur = head, *next = nullptr;
while (cur) { next = cur->next; cur->next = prev; prev = cur; cur = next; }
head = prev;
}
int main() {
int n, val;
Node *head = nullptr;
cin >> n;
while (n--) { cin >> val; Node* newNode = new Node{val, head}; head = newNode; }
reverse(head);
for (Node* temp = head; temp; temp = temp->next) cout << temp->data << " ";
cout << endl;
return 0;
}
class Node:
def __init__(self, data):
self.data, self.next = data, None
def reverse(head):
prev, current = None, head
while current:
current.next, prev, current = prev, current, current.next
return prev
n = int(input())
head = None
for _ in range(n):
val = int(input())
new_node = Node(val)
new_node.next = head
head = new_node
head = reverse(head)
while head:
print(head.data, end=" ")
head = head.next
print()
import java.util.Scanner;
class Node {
int data;
Node next;
Node(int data) { this.data = data; }
}
public class ReverseLinkedList {
public static Node reverse(Node head) {
Node prev = null, current = head, next = null;
while (current != null) {
next = current.next;
current.next = prev;
prev = current;
current = next;
}
return prev;
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
Node head = null;
for (int i = 0; i < n; i++) {
Node newNode = new Node(scanner.nextInt());
newNode.next = head;
head = newNode;
}
head = reverse(head);
while (head != null) {
System.out.print(head.data + " ");
head = head.next;
}
System.out.println();
}
}
Problem Description:
You are provided with an array of integers. Your objective is to determine the maximum product of two different numbers from the array. This will maximize the choice of two numbers so that their product is optimized in real life applications like stock market prediction or finance modeling.
Input:
5 1 -10 3 7 2
Output:
Maximum Product: 70
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> arr(n);
for (int i = 0; i < n; i++) cin >> arr[i];
sort(arr.begin(), arr.end());
int product = max(arr[0] * arr[1], arr[n-1] * arr[n-2]);
cout << "Maximum Product: " << product << endl;
return 0;
}
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
product = max(arr[0] * arr[1], arr[-1] * arr[-2])
print(f"Maximum Product: {product}")
import java.util.Scanner;
import java.util.Arrays;
public class MaxProduct {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[] arr = new int[n];
for (int i = 0; i < n; i++) arr[i] = scanner.nextInt();
Arrays.sort(arr);
int product = Math.max(arr[0] * arr[1], arr[n - 1] * arr[n - 2]);
System.out.println("Maximum Product: " + product);
}
}
Problem Description:
You are given a string provided to you. Your job is to identify the first non-repeating character in the string. An operation of this sort is useful for programs like text parsing, in which individual characters can be used to identify errors or key words from user input.
Input:
swiss
Output:
First non-repeating character: w
#include <iostream>
#include <unordered_map>
using namespace std;
int main() {
string s;
cin >> s;
unordered_map<char, int> freq;
for (char c : s) freq[c]++;
for (char c : s) {
if (freq[c] == 1) {
cout << "First non-repeating character: " << c << endl;
return 0;
}
}
cout << "No non-repeating character found." << endl;
return 0;
}
s = input()
freq = {}
for c in s:
freq[c] = freq.get(c, 0) + 1
for c in s:
if freq[c] == 1:
print(f"First non-repeating character: {c}")
break
else:
print("No non-repeating character found.")
import java.util.HashMap;
import java.util.Scanner;
public class FirstNonRepeating {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String s = scanner.next();
HashMap<Character, Integer> freq = new HashMap<>();
for (char c : s.toCharArray()) {
freq.put(c, freq.getOrDefault(c, 0) + 1);
}
for (char c : s.toCharArray()) {
if (freq.get(c) == 1) {
System.out.println("First non-repeating character: " + c);
return;
}
}
System.out.println("No non-repeating character found.");
}
}
Problem Description:
You are given an array of numbers from 1 to n with one missing number. Your task is to find the missing number. This problem helps analyze data gaps, such as finding missing entries in a sequence or identifying faulty data in data processing systems.
Input:
5
1 2 4 5
Output:
Missing Number: 3
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int sum = n * (n + 1) / 2;
int arr_sum = 0;
for (int i = 0; i < n - 1; i++) {
int num;
cin >> num;
arr_sum += num;
}
cout << "Missing Number: " << sum - arr_sum << endl;
return 0;
}
n = int(input())
arr = list(map(int, input().split()))
total_sum = n * (n + 1) // 2
arr_sum = sum(arr)
print(f"Missing Number: {total_sum - arr_sum}")
import java.util.Scanner;
public class MissingNumber {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int totalSum = n * (n + 1) / 2;
int arrSum = 0;
for (int i = 0; i < n - 1; i++) {
arrSum += scanner.nextInt();
}
System.out.println("Missing Number: " + (totalSum - arrSum));
}
}
Problem Description:
You are given an array of integers and a number k. Your task is to rotate the array by k positions to the right. This problem is commonly used in real-time systems where items are rotated for processing, such as in circular buffers or data streams.
Input:
5
1 2 3 4 5
2
Output:
Rotated Array: 4 5 1 2 3
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n, k;
cin >> n;
vector<int> arr(n);
for (int i = 0; i < n; i++) cin >> arr[i];
cin >> k;
k = k % n; // handle cases where k > n
reverse(arr.begin(), arr.end());
reverse(arr.begin(), arr.begin() + k);
reverse(arr.begin() + k, arr.end());
for (int i : arr) cout << i << " ";
cout << endl;
return 0;
}
n = int(input())
arr = list(map(int, input().split()))
k = int(input())
k = k % n # handle cases where k > n
arr = arr[-k:] + arr[:-k]
print(" ".join(map(str, arr)))
import java.util.Scanner;
import java.util.Arrays;
public class RotateArray {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[] arr = new int[n];
for (int i = 0; i < n; i++) arr[i] = scanner.nextInt();
int k = scanner.nextInt();
k = k % n; // handle cases where k > n
reverse(arr, 0, n - 1);
reverse(arr, 0, k - 1);
reverse(arr, k, n - 1);
for (int i : arr) System.out.print(i + " ");
System.out.println();
}
static void reverse(int[] arr, int start, int end) {
while (start < end) {
int temp = arr[start];
arr[start] = arr[end];
arr[end] = temp;
start++;
end--;
}
}
}
Here are the tips to crack Oracle coding round:
Practice quantitative reasoning and verbal ability questions.
Concentrate on data structures and algorithms. Can practice with platforms such as LeetCode, HackerRank, and CodeSignal.
Get accustomed to Oracle databases, cloud services, and technical solutions.
Practice with technical and HR mock interviews to gain confidence.
As Oracle has a firm table on database-related ensuing queries, practice writing SQL queries and understanding database design.
Effectively showcase your problem-solving abilities.
In conclusion, coding questions in Oracle test a candidate's capability to solve problems and knowledge of data structures and algorithms. The questions can be simple and advanced, emphasising arrays, linked lists, trees, graphs, and algorithms such as sorting, searching, and dynamic programming. The Oracle coding round questions also focus on SQL and database concepts. A candidate must regularly practice coding problems, become a master at core algorithms, and write very efficient, optimised code. The way in which problems can be approached must be clear and well-defined.
The typical recruitment process for Oracle comprises four rounds: an online aptitude test, technical interviews (a coding round and problem-solving), HR interviews, and sometimes another round of interviews, which is for specific roles or more senior positions.
Cracking Oracle interviews could be tough to crack, as they usually want to check your problem-solving, algorithmic thinking, and coding aptitude. With steady ground work, rigorous coding practices, and a clear understanding of concepts, you can increase your odds against all others.
Oracle coding interviews consist of coding in different programming scripts such as Java, C++, Python, and occasionally SQL. The views check data structures, algorithms, and problem solving, with SQL being essential for database roles.
Source: NxtWave - CCBP Blog
Contact: [email protected] | +919390111761 (WhatsApp only)