Represent and Evaluate Boolean Predicate Expressions

Quick Overview

This Coreweave software engineering question asks candidates to represent and evaluate boolean predicate expressions. It is useful practice for expression trees, recursive evaluation, short-circuit behavior, and designing extensible internal representations.

Represent and Evaluate Boolean Predicate Expressions

Company: Coreweave

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Onsite

Design a data structure to represent and evaluate predicates such as `abc > 5 and (test < 8 or team > 9)`. Support comparisons, `and`, `or`, parentheses, and evaluation against a dictionary of variable values. ### Constraints & Assumptions - Variables map to numeric values. - Operators include `<`, `>`, `<=`, `>=`, `==`, `and`, and `or`. - Input can be parsed before evaluation. - Short-circuit evaluation is desirable. ### Clarifying Questions to Ask - Do we need `not`? - Are strings or only numbers supported? - Should unknown variables be errors or false? - Does the parser need to handle whitespace and precedence? - Will predicates be reused many times? ### What a Strong Answer Covers ```premium-lock What a Strong Answer Covers ``` ### Follow-up Questions - How would you add function calls? - How would you compile predicates for faster repeated evaluation? - How would you serialize the AST? - How would you prevent unsafe arbitrary code execution?

Quick Answer: This Coreweave software engineering question asks candidates to represent and evaluate boolean predicate expressions. It is useful practice for expression trees, recursive evaluation, short-circuit behavior, and designing extensible internal representations.

|Home/Software Engineering Fundamentals/Coreweave
Coreweave logo
Coreweave
Jul 2, 2026, 7:02 PM
mediumSoftware EngineerOnsiteSoftware Engineering Fundamentals
12
0

Design a data structure to represent and evaluate predicates such as abc > 5 and (test < 8 or team > 9). Support comparisons, and, or, parentheses, and evaluation against a dictionary of variable values.

Constraints & Assumptions

  • Variables map to numeric values.
  • Operators include < , > , <= , >= , == , and , and or .
  • Input can be parsed before evaluation.
  • Short-circuit evaluation is desirable.

Clarifying Questions to Ask Guidance

  • Do we need not ?
  • Are strings or only numbers supported?
  • Should unknown variables be errors or false?
  • Does the parser need to handle whitespace and precedence?
  • Will predicates be reused many times?

What a Strong Answer Covers Premium

Follow-up Questions Guidance

  • How would you add function calls?
  • How would you compile predicates for faster repeated evaluation?
  • How would you serialize the AST?
  • How would you prevent unsafe arbitrary code execution?
Loading comments...