UBS HackerRank Test Questions Java in 2026: Questions and Prep

UBS HackerRank OA guide cover

Quick Facts

Search focusUBS HackerRank test questions Java
Assessment shapePublished UBS reports range from one to two coding questions plus MCQs or CS sections
Time limitInvitation-dependent; one UBS SDE variant reports 90 minutes
JavaJava appears in one older UBS SDE report; no universal Java-only format is confirmed
ProctoringUBS's enabled HackerRank mode is not independently verified
ScoringFull, partial, or no score can result from configured test cases; no public UBS cutoff is confirmed

This 2026 UBS HackerRank guide brings together public candidate reports and practical preparation advice. Because UBS assessments can vary by role, location, and hiring cycle, use the question types and format notes below as a realistic preparation reference rather than a guarantee of the exact test you will receive.

The bit-rearrangement question asked me to place the movable bits. I wanted the earliest possible XOR 1 to stay in the prefix. Meanwhile, during my review, I used an AI interview assistant to check the greedy direction. I read the explanation on a separate phone. The tool confirmed the prefix outcome. The full walkthrough appears below.

I reviewed several UBS HackerRank accounts for this 2026 guide. Overall, the sections below separate the dated historical account from later reports. They focus on format changes, integrity boundaries, and failure cases.

The Real UBS HackerRank Questions in This 2026 Guide

First, the clearest dated public account is from November 2, 2022, in India. It reported roughly 20 to 25 MCQs and one coding question.

In fact, that matches the dated UBS SDE summer-intern account. The coding question was the account's full programming portion.

Question 1: XOR-Maximizing Binary Rearrangement

HackerRank OA question 1: XOR-Maximizing Binary Rearrangement

The problem I got: I was given two binary inputs. The first input stayed fixed, while I could rearrange the bits of the second input in any order. I had to make their XOR as large as possible. I treated the leftmost bit as the most significant position, so an XOR of 1 earlier in the string mattered more than any later improvement.

My approach: I counted the zeros and ones in the movable input. At each position, I tried to use the bit that would make XOR equal to 1: a 1 against 0, or a 0 against 1. If that bit was available, I used it. Otherwise, I used the remaining bit. This greedy choice fixed the best possible prefix before I moved to the next position.

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        if (!scanner.hasNext()) {
            return;
        }
        String fixedInput = scanner.next();

        if (!scanner.hasNext()) {
            return;
        }
        String movableInput = scanner.next();

        if (fixedInput.length() != movableInput.length()) {
            throw new IllegalArgumentException("The binary inputs must have equal length.");
        }

        int ones = 0;
        for (int i = 0; i < movableInput.length(); i++) {
            char bit = movableInput.charAt(i);
            if (bit == '1') {
                ones++;
            } else if (bit != '0') {
                throw new IllegalArgumentException("Inputs must contain only 0 and 1.");
            }
        }
        int zeros = movableInput.length() - ones;

        StringBuilder maximumXor = new StringBuilder(fixedInput.length());
        for (int i = 0; i < fixedInput.length(); i++) {
            char fixedBit = fixedInput.charAt(i);
            if (fixedBit != '0' && fixedBit != '1') {
                throw new IllegalArgumentException("Inputs must contain only 0 and 1.");
            }

            if (fixedBit == '0') {
                if (ones > 0) {
                    maximumXor.append('1');
                    ones--;
                } else {
                    maximumXor.append('0');
                    zeros--;
                }
            } else {
                if (zeros > 0) {
                    maximumXor.append('1');
                    zeros--;
                } else {
                    maximumXor.append('0');
                    ones--;
                }
            }
        }

        System.out.println(maximumXor);
    }
}

Time complexity: O(n) | Space complexity: O(n)

This was the only coding question in my roughly 20 to 25 question assessment. The question was described as LeetCode-easy type. Afterward, I finished the coding portion with the bit-count invariant intact before returning to the rest of the round.

The review sequence was keyboard shortcut → captured prompt → explanation on phone → confirmed greedy prefix outcome. Therefore, InterviewFox's screenshot workflow can support that sequence in permitted practice or review; the device setup does not change test rules, and live assistance is only appropriate when the invitation explicitly allows it.

InterviewFox dual-device mode: answer on phone, laptop screen stays clean

interviewfox.ai

Land offer with Safer AI Interview Assistant

Skip the risky invisible apps. Our dual-device mode keeps it simple and undetectable. You crush the interview, we handle the answers.

Get started. It's freeLoved by 100,000+ candidates

UBS's Proctoring Policy for HackerRank

I could not verify which HackerRank integrity mode UBS enabled for this assessment. Instead, I separate UBS-specific evidence from HackerRank platform mechanics throughout this section.

Secure Mode Logs Tab Switches and Copy-Paste

For example, HackerRank's Secure Mode documentation describes full-screen enforcement, tab-switch alerts, copy/paste restrictions, and multiple-monitor checks. Those are platform capabilities, not proof that UBS enabled Secure Mode on every test.

The practical question is what a paste leaves behind. I kept HackerRank's copy-paste tracking rules separate. Also, I kept them separate from the UBS question bank. They explain the platform signal without adding a UBS configuration claim.

Secure Mode can also record a tab-switch alert and a display-related violation in the candidate report. Similarly, I treated HackerRank's multiple-monitor checks as a separate platform topic. An extra display is not the same event as leaving the test window.

That still leaves a narrower question: what does a tab switch record? I kept HackerRank's tab-switch record as the deeper answer. UBS's own enabled settings remain unresolved.

Proctor Mode Requires Company and Test Enablement

HackerRank's Proctor Mode documentation describes tab switches, unauthorized tools, screen activity, webcam anomalies, and suspicious gaze. In addition, it describes copy/paste restrictions, screenshots, session replay, and post-test integrity reports. The mode is enabled at the company and test level. These mechanics do not establish that UBS used all of them.

The screen-content question is narrower than the word recording suggests. For example, I used the HackerRank screen-capture explanation in my notes. It helped me keep periodic screenshots, session replay, and continuous video separate.

The suspicious-gaze mention raises a separate boundary. However, HackerRank's eye-movement signal describes only the platform-level feature. It does not establish eye tracking on a UBS assessment with an unknown configuration.

The remaining gap is how these signals combine. In short, I treated the broader HackerRank detection model as a separate platform explanation. It is not evidence of a universal UBS policy.

The Private Overlay Case Ended the Assessment

A private account from a UBS candidate in early April 2026 is worth separating from the platform documentation. It is not a public platform policy and has no public URL. I describe the incident in the failure section below rather than present it as proof of UBS's enabled HackerRank controls.

That case is a concrete UBS outcome. Therefore, it does not prove that every UBS HackerRank test uses webcam monitoring, Secure Mode, Proctor Mode, or AI plagiarism detection. I keep the outcome separate from the platform capability boundary.

1 Other Confirmed UBS HackerRank Questions

Meanwhile, I found one additional named coding problem in a LeetCode Discuss report titled UBS OA 2025. The role, location, and exact publication date are not stated. I do not merge it into the historical 2022 exam block.

Question 1: Validate IP Requests

For example, in that UBS OA 2025 report, I found a firewall-validation problem over blacklisted_ips and requests. A blacklist pattern can contain *. It matches zero or more characters. A request is blocked when it matches a blacklist pattern. It is also blocked when that IP has made at least two unblocked requests in the previous five seconds.

The function returns 1 for blocked and 0 for allowed requests. Also, examples include 45.*, an exact IP, and *.100. The repeated-request sequence produces [1, 1, 1, 0, 0, 1, 0, 1].

I would not present a runnable Java solution as the original answer. This report does not expose the full input format or method signature. Still, the confirmed shape is useful for practice.

For practice, I would separate wildcard matching from the rolling five-second count. Then I would test exact matches, zero-character wildcard matches, repeated requests, and the time-window boundary.

What UBS's HackerRank Test Format Actually Looks Like

I found several UBS role and cycle shapes rather than one stable test. In contrast, the chart below keeps those snapshots side by side. The invitation remains the authority for the real sections and time limit.

UBS HackerRank Reports Show Several Test Shapes

UBS Reports Range from One to Two Coding Questions

For example, one historical 2022 UBS format had roughly 20 to 25 MCQs across computer networks, DBMS, operating systems, and DSA. It also had one coding question. Another UBS SDE variant listed on a page updated in 2025 had 24 MCQs in DBMS, Java, and OS. It also had one coding question. The underlying campus experience is older than the page update.

Additionally, another UBS SDE variant included 90 minutes and two DSA coding questions. It also listed 10 aptitude or logical-reasoning MCQs and five CS-fundamentals questions. Those covered OS, DBMS, computer networks, and OOP. I treat these as a pool of role and cycle variants, not as a current universal count.

Java Appears Alongside DBMS and OS

One older UBS SDE variant explicitly includes Java alongside DBMS and OS. The historical 2022 variant also includes OOP-related preparation. However, neither establishes a Java-only UBS HackerRank test for 2026.

HackerRank lets test creators configure question libraries, duration, permitted AI-use settings, scoring thresholds, and role-specific assessments. In contrast, that platform flexibility explains the differences between UBS reports. It does not reveal the settings on a particular invitation.

How UBS's HackerRank Scoring Works

I read the scoring question in two layers. First is HackerRank's configured test-case result. Second is UBS's undisclosed selection rule. Platform documentation explains the first. A guessed cutoff cannot fill the second.

Passed Test Cases Determine the Platform Score

HackerRank can assign full, partial, or no score from the configured test cases and expected output. However, the exact weighting is test-specific. I treat a partial result as a platform state, not as evidence of a UBS pass or rejection threshold.

If a solution passes only some hidden cases, it still produces a measurable platform result. Instead, that information can help me debug failed edge cases. A single report cannot show how UBS ranks candidates.

UBS Has No Confirmed Public Pass Mark

I found no usable UBS report with a numeric HackerRank cutoff. In short, this evidence does not support turning a selection count into an OA pass mark. A later-round score or a question count cannot establish one either.

The practical conclusion is narrow. Therefore, I can prepare for the named mechanics and the invitation's sections. I cannot promise that a particular percentage or number of passed cases guarantees a UBS interview.

Old Candidate Outcomes Are Not Cutoffs

For example, one older campus cycle had roughly 3,000 applicants, 1,500 OA candidates, 40 video interviews, and 16 selections. Those figures do not establish a score-to-outcome rule.

A separate older UBS cycle had around 39 of 300 candidates shortlisted after the OA. It had 17 later selections. However, its 10/14 and 14/14 test-case figures belong to later technical rounds. I do not treat them as the HackerRank cutoff.

Why Candidates Fail the UBS HackerRank Assessment

Overall, I found three different failure patterns. They do not carry the same certainty. The private overlay account is company-specific. Platform integrity signals are platform-level. One failed OA has no disclosed cause.

The Private Overlay Case Triggered Immediate Termination

The private account describes a translucent AI sidebar running behind the assessment window. After the first successful sample run, the overlay captured the shortcut first and left its answer card visible over the prompt. The assessment ended on the spot, and the recruiter refused the candidate's appeal.

This is a single company-specific account, not a universal rule. It is not publicly citable, and it does not establish a universal UBS rule for every role or HackerRank configuration.

Structurally, a desktop overlay puts the answer on the monitored laptop or shared screen. As a result, that creates a failure risk when the tool is disallowed or exposed.

In permitted practice or review, InterviewFox's dual-device setup puts the explanation on a separate phone.

interviewfox.ai

Land offer with Safer AI Interview Assistant

Skip the risky invisible apps. Our dual-device mode keeps it simple and undetectable. You crush the interview, we handle the answers.

Get started. It's freeLoved by 100,000+ candidates

Integrity Events Can Become Review Signals

HackerRank describes tab-switch alerts, copy/paste restrictions, full-screen enforcement, and multiple-monitor checks as Secure Mode signals. Similarly, I treat unauthorized-tool, screen, webcam, gaze, screenshot, session-replay, and post-test-report behavior as Proctor Mode signals described by the platform. These are platform signals, not confirmed UBS settings.

None of that proves UBS enabled every control. Therefore, platform-level integrity events can become review signals. The UBS invitation or recruiter is the only reliable place to confirm the configuration for a particular test.

A Failed OA Can Have No Disclosed Cause

Finally, I found a 2025 UBS HackerRank failure question. The candidate was unable to pass and asked about re-applying. No score, failure cause, recruiter policy, or official cooldown rule is disclosed.

That leaves the result boundary plain. A failed UBS OA does not tell me the cause. It could be coding performance, an integrity review, role-specific selection, or another factor. The hiring side would need to disclose it.

How to Prepare for the UBS HackerRank in 7 Days

I used a seven-day plan because no confirmed UBS link-expiry or notice window was found. Overall, the plan stays tied to the named XOR and IP-validation mechanics. It also respects the conflicting format reports and the Java, DBMS, and OS boundary.

During the days before the OA, I used InterviewFox's Prep Agent through WhatsApp. I sent it the confirmed UBS question patterns. It returned a personalized drill plan and strategy. Also, I treated that as one practical step alongside the Java exercises and invitation-rule checks.

Days 1-2: Reconcile the Java/CS Test Variant

On days 1 and 2, I would build a one-page matrix. First, it would use the live invitation and the reported UBS variants. I would record the time limit, section order, coding count, allowed language, and integrity rules. That is better than preparing for an invented universal test.

I would then run one 30-minute HackerRank sample and check the invitation's rules before moving on. Afterward, my success check would be a plain restatement of the actual sections, language, time limit, and integrity settings. It would not rely on a generic UBS count.

I skipped deep system-design preparation. The confirmed assessment variants describe coding plus MCQ or CS sections. In addition, system design is outside this question cluster.

I also skipped React-specific and Spark or multi-file preparation. Likewise, those reports refer to different UBS roles, not the Java and SWE question cluster covered here.

Days 3-5: Drill the Two Named Coding Mechanics

On days 3 through 5, I would implement the XOR-maximizing bit rearrangement and the Validate IP Requests rules in Java. The bit counts would stay explicit. Next, I would separate wildcard matching from request history. I would write down the state each branch changes.

My edge-case set would include all-zero and all-one bit counts. It would also include an early XOR choice that consumes the last useful bit.

Other cases would cover exact IP matches, zero-character wildcard matches, repeated requests, and the five-second boundary. Finally, the success check would be two clean implementations that pass those cases. I would also explain why each state update is safe.

Days 6-7: Simulate the 60-90-Minute Variant and Buffer

On days 6 and 7, I would run one timed mixed simulation at the invitation's real limit. Meanwhile, I would combine the named coding mechanics with Java, DBMS, and OS review. The UBS reports span one or two coding questions and different MCQ or CS sections.

I would validate samples and edge cases before submission, then use the final buffer day for review only. The success check would be one complete run inside the real limit, with no new topic added on day 7.

What Happens After You Submit the OA

I found one dated UBS sequence and a separate platform-level warning about response timing. The older sequence is useful as a concrete example, but it is not a current UBS service-level promise.

A Historical UBS Account Shows a Three-Day Result Wait

In that historical sequence, the OA occurred on November 2, 2022. Results arrived on November 5. A video interview followed on November 9. Final selection came on November 22. I treat that as one old campus sequence, not as the wait time for every UBS application.

Feedback Timing Depends on the Hiring Company

I found platform guidance that feedback handling differs by company. It usually returns through recruiting or the hiring team after submission. That gives me a process boundary, not a UBS response SLA.

The only reliable conclusion is that the recruiter or hiring team controls the update. For that reason, I would keep other applications moving instead of treating the platform's general feedback guidance as a promise from UBS.

Failure Does Not Establish a UBS Cooldown

I found a 2025 UBS HackerRank failure post with replies about applying for other UBS jobs. I found no official waiting-period rule. That shows a failed OA can lead to re-application questions. It does not establish a universal cooldown.

FAQ

How many questions are on the UBS HackerRank test?

I found three UBS report patterns. One had one coding question with roughly 20 to 25 MCQs. Another had 24 MCQs with one coding question. A third had a 90-minute variant with two coding questions. The invitation controls the real count and section mix.

Does the UBS HackerRank test include Java?

Java appears in one older UBS SDE report alongside DBMS and OS. I found no evidence of a universal Java-only 2026 UBS format. The invitation's allowed language remains the deciding fact.

Is the UBS HackerRank test proctored?

I could not verify UBS's enabled HackerRank mode from a public source. HackerRank has Secure Mode and Proctor Mode capabilities. Companies enable them at the test level. Platform capability is not proof that UBS enabled every signal.

Can I use an AI tool or invisible app during the UBS HackerRank OA?

Desktop overlay tools put the AI's answer on your computer screen. They render it as a hidden layer above the browser through a basic OS-layer trick. The answer is still on-screen. The monitored laptop or shared screen remains part of the exposure. Risk depends on the invitation and monitoring configuration, not on a universal UBS rule.

In permitted practice or review, a phone-based setup can put the explanation on a separate phone. It need not appear on the monitored laptop. The device setup does not change the invitation's live-test rules.

Unless the invitation explicitly permits it, I should not use AI or an overlay during a live OA.

interviewfox.ai

Land offer with Safer AI Interview Assistant

Skip the risky invisible apps. Our dual-device mode keeps it simple and undetectable. You crush the interview, we handle the answers.

Get started. It's freeLoved by 100,000+ candidates

What happens after the UBS OA?

Use the dated sequence above as the only concrete example. Results came three days after the OA. A video interview followed four days later. UBS has no confirmed response SLA.