Welcome to the forum, smart.kunti!
Let's make sure you're talking about the same thing as the others who posted in this topic, because I'm not sure. When you talk about the ruler not matching your drawing, are you talking about the rulers which are part of the Inkscape window - along the top and left edges of the canvas? If so, that's different from what the others were talking about. They had created custom rulers using a path effect (Path menu > Path Effect).
So if you're talking about the rulers which are part of the Inkscape window, then we don't expect those to match perfectly. They are only there as a general guide. To find out the actual size of objects, you need to use either the W and H fields in the Selection tool control bar, or using the Node tool, there are X and Y fields on the control bar, or use guides which can be set to precise coordinates, or a grid, which can also be configured precisely (such as with a pixel grid, for example).
And even the guides and the grid lines might not *look like* they agree with the rulers, or agree with nodes which have been set to precise coordinates. If you look closely, you'll notice that with different zoom levels, they might appear to be more or less "off". So you need to focus on those elements which can set precise coordinates, or the W and H fields with Selection tool.
As long as your objects' sizes are set properly (and you have the scale set properly) you can trust that they are the correct size, even though they don't match with the rulers.
I'm not familiar enough with GIMP to know if it has the same kind of situation. And I just had suddenly wondered if other vector-capable programs such as CAD have the same situation. I really just don't know.
If you are talking about a ruler created with a path effect, that ruler might not match the built-in rulers either!
Oh, but wait! Having said all that (which I'll leave intact, because it will help you anyway) I just was looking more closely at your screenshot. You have units set for pixels (which dictates how the rulers will be set). But your object appears to be using cm for units.
If you want to use cm for units throughout your file, I think you might need to change the Scale setting in Document Properties. Unfortunately, that thing confuses me to pieces. But hopefully someone else will be along shortly, who can tell you exactly what to do.