PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Software Engineering Fundamentals/Oracle

Apply operations efficiently using Command pattern

Last updated: Mar 29, 2026

Quick Overview

This question evaluates skills in object-oriented design, the Command Pattern, correctness reasoning, extensibility of operation abstractions, and optimization strategies for applying and combining operations on mutable state.

  • medium
  • Oracle
  • Software Engineering Fundamentals
  • Software Engineer

Apply operations efficiently using Command pattern

Company: Oracle

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Onsite

You are given an initial state and a list of operations that should be applied to it. ### Setup - The state can be thought of as a mutable object (e.g., a document, a numeric value, an inventory map, or a configuration object). - Each operation has a type and parameters (e.g., `Set(key, value)`, `Increment(key, delta)`, `Delete(key)`, etc.). ### Requirements 1. **Implement an operation executor** that applies all operations to produce the final state. 2. Use an object-oriented approach consistent with the **Command Pattern**: - Each operation should be represented as a command with an `execute(state)` method (and optionally `undo(state)` if discussed). 3. **Optimize execution** when possible: - Avoid naively applying every operation sequentially if there are opportunities to combine, cancel, reorder, or short-circuit operations **without changing the final result**. ### What to discuss - Your command abstractions and how new operation types can be added. - Correctness constraints for optimization (when reordering/merging is safe). - Time/space complexity and edge cases (conflicting operations, no-ops).

Quick Answer: This question evaluates skills in object-oriented design, the Command Pattern, correctness reasoning, extensibility of operation abstractions, and optimization strategies for applying and combining operations on mutable state.

Related Interview Questions

  • Extend and optimize an existing CLI tool - Oracle (medium)
Oracle logo
Oracle
Feb 12, 2026, 12:00 AM
Software Engineer
Onsite
Software Engineering Fundamentals
1
0
Loading...

You are given an initial state and a list of operations that should be applied to it.

Setup

  • The state can be thought of as a mutable object (e.g., a document, a numeric value, an inventory map, or a configuration object).
  • Each operation has a type and parameters (e.g., Set(key, value) , Increment(key, delta) , Delete(key) , etc.).

Requirements

  1. Implement an operation executor that applies all operations to produce the final state.
  2. Use an object-oriented approach consistent with the Command Pattern :
    • Each operation should be represented as a command with an execute(state) method (and optionally undo(state) if discussed).
  3. Optimize execution when possible:
    • Avoid naively applying every operation sequentially if there are opportunities to combine, cancel, reorder, or short-circuit operations without changing the final result .

What to discuss

  • Your command abstractions and how new operation types can be added.
  • Correctness constraints for optimization (when reordering/merging is safe).
  • Time/space complexity and edge cases (conflicting operations, no-ops).

Solution

Show

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Software Engineering Fundamentals•More Oracle•More Software Engineer•Oracle Software Engineer•Oracle Software Engineering Fundamentals•Software Engineer Software Engineering Fundamentals
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.