We know that a ruler is a measuring stick marked with certain units along its edges. To measure the length of any object with the help of a ruler, we have to place the end of the object at point '0' of the ruler.
Now, we will place the object along the length of the ruler and note the readings on the ruler. The readings on the ruler will tell us the length of the object.
By following the above steps, we observe that the length of the given pencil is 4 cm.