i want to wrie a code which determines whether a given input is relocatable object file or executable file?
i have knowledge about C .....but this task is totally new for me.
can anyone please guide me?

Here are some hints how to recognize the kind of executable files, but that isn't completly reliable on iteself. Just because the first two bytes of a file contain a certain signature doesn't mean it is an executable file -- it could be a plain text file or some other kind of binary file.

you will have to learn a great deal about the format of executable and object files in order to accurately detect which format a given file is in. I have no idea how to do it and I'm not really interested enough to learn.