Which of the following best describes what an AI agent does?
Think about how a robot or virtual assistant works by noticing things and acting.
An AI agent observes its surroundings and acts to reach specific goals, like a self-driving car sensing roads and steering.
What will be the output of this simple AI agent code that moves in a 1D space?
class SimpleAgent: def __init__(self): self.position = 0 def sense(self, environment): return environment[self.position] def act(self, perception): if perception == 'obstacle': self.position -= 1 else: self.position += 1 environment = ['clear', 'clear', 'obstacle', 'clear'] agent = SimpleAgent() for _ in range(3): p = agent.sense(environment) agent.act(p) print(agent.position)
Track the agent's position step by step as it senses and acts.
The agent starts at 0, moves forward twice on 'clear', then encounters 'obstacle' and moves back once, ending at position 1.
You want to build an AI agent that learns to play a video game by trial and error. Which model type is best suited?
Think about learning from rewards and punishments over time.
Reinforcement Learning agents learn by interacting with the environment and receiving feedback, ideal for games.
Which metric best measures how well an AI agent achieves its goals over time?
Consider a score that adds up all successes and failures during tasks.
Cumulative reward sums all rewards the agent gets, showing overall success in goal achievement.
What error will this AI agent code raise when running?
class Agent: def __init__(self): self.state = None def act(self, input): match input: case 'go': self.state = 'moving' case 'stop': self.state = 'stopped' case _: self.state = 'idle' agent = Agent() agent.act('stop')
Check the syntax of the match-case statements carefully.
The 'case' line for 'stop' is missing a colon, causing a SyntaxError.