Utility Functions — AI Technical Interview Questions & Answers

Utility Functions

Utility Functions

  • Utility Functions is about choosing a sequence of actions toward a goal, sometimes with other agents or chance. State the goal, the actions, and whether the world is deterministic. Planning ≠ classification.
  • Output: idea / do / check for Utility Functions. Fill those three in the viva.
  • Tiny Utility Functions story: get the key, open the door, reach the gold. That beats a UML diagram.

Technical Interview Tip: Goal + actions + deterministic or not.

Code Examples for Utility Functions

Example

# Utility Functions
print("idea :", "Utility Functions")
print("do   : one tiny example on paper")
print("check: one failure case")

Output: idea / do / check for Utility Functions. Fill those three in the viva.

How to Explain Utility Functions to an Interviewer

Explain Utility Functions as if you are teaching a junior — definition, then one example.

Utility Functions — actions toward a goal. State the world type.

What does the example print, and what does that prove?

idea / do / check for Utility Functions

What mistake do freshers make with Utility Functions?

Utility Functions — calling every ML model “planning”.