thanx for the response.The fact is the problem got resolved when i left the hostname blank.I guess it took the local host as the default one and connected to the local QM defined.
I have used WebSpehere MQ Explorer for Windows to create a local queue manager and a set of local queues and I am trying to access the same form the piece of code below..