Bird
Raised Fist0
ROSframework~20 mins

What is ROS (Robot Operating System) - Practice Questions & Exercises

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
ROS Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What is the primary purpose of ROS?

ROS is often described as a framework for robots. What is its main goal?

ATo serve as an operating system that runs only on robot-specific computers
BTo control the hardware of robots directly without any software layers
CTo provide a set of tools and libraries that help build robot software easily and modularly
DTo replace all robot hardware components with software simulations
Attempts:
2 left
💡 Hint

Think about what software developers need to build complex robot programs.

❓ component_behavior
intermediate
2:00remaining
How do ROS nodes communicate?

In ROS, nodes are separate programs that work together. How do they share information?

ABy writing and reading files on the robot's hard drive
BBy sending messages through topics and services using a publish-subscribe model
CBy directly calling each other's functions in the same memory space
DBy using a shared global variable accessible to all nodes
Attempts:
2 left
💡 Hint

Think about how many programs can talk without being tightly connected.

❓ lifecycle
advanced
2:00remaining
What happens when a ROS node crashes unexpectedly?

Consider a ROS system where one node crashes. What is the typical behavior of the rest of the system?

AThe crashed node is automatically replaced by a backup node
BThe entire ROS system shuts down immediately
CAll nodes restart automatically to recover from the crash
DOther nodes continue running independently, but communication with the crashed node stops
Attempts:
2 left
💡 Hint

Think about how independent nodes are in ROS.

📝 Syntax
advanced
2:00remaining
Which command correctly starts a ROS 2 node named 'talker' from package 'demo_nodes_cpp'?

You want to run the 'talker' node in ROS 2. Which command is correct?

Aros2 run demo_nodes_cpp talker
Bros run demo_nodes_cpp talker
Cros2 launch demo_nodes_cpp talker
Dros2 start demo_nodes_cpp talker
Attempts:
2 left
💡 Hint

Remember the ROS 2 CLI command to run a node from a package.

🔧 Debug
expert
3:00remaining
Why does this ROS 2 Python node fail to publish messages?

Given this ROS 2 Python node code snippet, why does it not publish messages?

import rclpy
from rclpy.node import Node
from std_msgs.msg import String

class Talker(Node):
    def __init__(self):
        super().__init__('talker')
        self.publisher_ = self.create_publisher(String, 'chatter', 10)
        self.timer = self.create_timer(1.0, self.timer_callback)

    def timer_callback(self):
        msg = String()
        msg.data = 'Hello ROS 2'
        self.publisher_.publish(msg)


def main(args=None):
    rclpy.init(args=args)
    node = Talker()
    rclpy.spin(node)
    rclpy.shutdown()

if __name__ == '__main__':
    main()
AThe node never calls rclpy.spin(), so callbacks don't run
BThe node does not keep running because main() exits immediately
CThe message type String is not imported correctly
DThe publisher is created with a wrong topic name
Attempts:
2 left
💡 Hint

Check if the node stays alive to send messages repeatedly.

Practice

(1/5)
1. What is the main purpose of ROS (Robot Operating System)?
easy
A. To replace all programming languages used in robotics
B. To help robots share information and work together
C. To design robot hardware components
D. To control the hardware of a robot directly

Solution

  1. Step 1: Understand ROS's role in robotics

    ROS is designed to enable communication and cooperation between different parts of a robot or multiple robots.
  2. Step 2: Compare options with ROS's purpose

    Only To help robots share information and work together correctly states that ROS helps robots share information and work together, while others describe unrelated tasks.
  3. Final Answer:

    To help robots share information and work together -> Option B
  4. Quick Check:

    ROS purpose = share info and cooperate [OK]
Hint: ROS is about robot communication and cooperation [OK]
Common Mistakes:
  • Thinking ROS controls hardware directly
  • Confusing ROS with hardware design tools
  • Believing ROS replaces all programming languages
2. Which of the following is the correct way to describe a ROS node?
easy
A. A type of robot sensor
B. A hardware component of the robot
C. A small program that sends and receives messages
D. A physical connection cable

Solution

  1. Step 1: Define what a ROS node is

    A ROS node is a small program that performs a specific task and communicates with other nodes by sending and receiving messages.
  2. Step 2: Match the definition to the options

    A small program that sends and receives messages correctly describes a ROS node as a small program for communication, while others describe hardware or physical parts.
  3. Final Answer:

    A small program that sends and receives messages -> Option C
  4. Quick Check:

    ROS node = small communicating program [OK]
Hint: Nodes are programs, not hardware or cables [OK]
Common Mistakes:
  • Confusing nodes with physical robot parts
  • Thinking nodes are sensors or cables
  • Ignoring the messaging role of nodes
3. Consider this simple ROS setup:
Node A publishes messages to topic 'chatter'. Node B subscribes to 'chatter' and prints messages.
What happens when Node A sends a message?
medium
A. No message is sent because topics are disabled
B. Node A receives the message back
C. Node B crashes due to missing messages
D. Node B receives and prints the message

Solution

  1. Step 1: Understand publisher and subscriber roles

    Node A publishes messages on a topic; Node B subscribes to that topic to receive messages.
  2. Step 2: Trace message flow

    When Node A sends a message, Node B receives it and prints it as it subscribes to the same topic.
  3. Final Answer:

    Node B receives and prints the message -> Option D
  4. Quick Check:

    Publisher sends, subscriber receives [OK]
Hint: Publisher sends, subscriber receives messages [OK]
Common Mistakes:
  • Assuming publisher receives its own message
  • Thinking topics can be disabled by default
  • Believing subscriber crashes without messages
4. You wrote a ROS node that should publish messages but it never sends anything. Which is the most likely mistake?
medium
A. The node did not call the publish function
B. The node subscribed to the wrong topic
C. The robot hardware is disconnected
D. The node is written in the wrong programming language

Solution

  1. Step 1: Identify publishing process in ROS

    To send messages, a node must explicitly call the publish function on a topic.
  2. Step 2: Analyze why no messages are sent

    If no messages appear, the most common cause is forgetting to call publish, not subscribing or hardware issues.
  3. Final Answer:

    The node did not call the publish function -> Option A
  4. Quick Check:

    Missing publish call = no messages sent [OK]
Hint: Always call publish() to send messages [OK]
Common Mistakes:
  • Confusing publishing with subscribing
  • Blaming hardware before checking code
  • Thinking language choice stops publishing
5. You want to build a robot system where multiple nodes share sensor data and control commands efficiently. Which ROS feature helps you achieve this?
hard
A. Using ROS topics for message passing between nodes
B. Writing all code in a single large node
C. Connecting nodes with physical wires only
D. Disabling message communication to speed up processing

Solution

  1. Step 1: Identify how ROS enables node communication

    ROS uses topics to allow nodes to send and receive messages asynchronously and efficiently.
  2. Step 2: Evaluate options for sharing data and commands

    Using ROS topics for message passing between nodes correctly uses ROS topics for communication; other options ignore ROS's messaging system or suggest impractical methods.
  3. Final Answer:

    Using ROS topics for message passing between nodes -> Option A
  4. Quick Check:

    ROS topics enable efficient node communication [OK]
Hint: Use ROS topics to share data between nodes [OK]
Common Mistakes:
  • Trying to put all logic in one node
  • Thinking physical wires replace messaging
  • Disabling communication to improve speed
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard