PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Shopify

Implement an interactive CLI class with tests

Last updated: Apr 18, 2026

Quick Overview

This question evaluates object-oriented design, command-line interface implementation, persistent state management, input validation and error logging, extensibility for new commands, comprehensive unit testing, and continuous integration configuration.

  • Medium
  • Shopify
  • Coding & Algorithms
  • Machine Learning Engineer

Implement an interactive CLI class with tests

Company: Shopify

Role: Machine Learning Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Onsite

Design and implement a command-line interactive application as a single class using OOP principles. The program should support commands: add <key> <value>, get <key>, delete <key>, list, help, and exit; persist state to a local file; validate and handle invalid input gracefully; log errors; and be easily extensible for new commands. Write comprehensive unit tests that cover happy paths, edge cases (e.g., duplicate keys, missing keys, malformed commands), and error handling. Include a README with local setup instructions, how to run tests, and a GitHub workflow (e.g., Actions) that runs the test suite on push. Explain your class design (state, methods, dependency boundaries), how you would refactor to support subcommands/modules, and trade-offs you made under a 60-minute time constraint.

Quick Answer: This question evaluates object-oriented design, command-line interface implementation, persistent state management, input validation and error logging, extensibility for new commands, comprehensive unit testing, and continuous integration configuration.

Related Interview Questions

  • Compute Jaccard Similarity for Lists - Shopify (medium)
  • Implement URL Shortening Codec - Shopify (medium)
  • Simulate a rover fleet - Shopify (medium)
  • Simulate robot moves on a grid - Shopify (medium)
  • Implement a Capacity-Bounded Cache - Shopify (medium)
Shopify logo
Shopify
Aug 13, 2025, 12:00 AM
Machine Learning Engineer
Onsite
Coding & Algorithms
3
0

Design and implement a command-line interactive application as a single class using OOP principles. The program should support commands: add <key> <value>, get <key>, delete <key>, list, help, and exit; persist state to a local file; validate and handle invalid input gracefully; log errors; and be easily extensible for new commands. Write comprehensive unit tests that cover happy paths, edge cases (e.g., duplicate keys, missing keys, malformed commands), and error handling. Include a README with local setup instructions, how to run tests, and a GitHub workflow (e.g., Actions) that runs the test suite on push. Explain your class design (state, methods, dependency boundaries), how you would refactor to support subcommands/modules, and trade-offs you made under a 60-minute time constraint.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Shopify•More Machine Learning Engineer•Shopify Machine Learning Engineer•Shopify Coding & Algorithms•Machine Learning Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,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.