There seems to be a lot of discussion saying it is unfair to compare the Pentax kit zoom lens to a Nikon prime - although this may be true in theory - one should not get away from the fact the OP does have a legitimate complaint - as his posted photos show - there is a visible softness to the images.
It's a great pity that the EXIF information was not attached or posted with the images for us to ascertain if there were any possible problems -
that information is in every photo that then K-x produces -
it is hardly any trouble to post them or make sure they are still attached to the image - this sort of information is so useful when problems are encountered - and without it most of us are merely guessing.
It is also worthwhile noting that the Pentax 18-55 kit lens happens to be pretty respectable - I would be equally disappointed if any of my shots with the Kx and that kit lens gave results as posted -
PopPhoto has reviewed the Samsung clone of this 18-55 and this is their SQF chart:
EDIT to ADD -
I found that PopPhoto has actually tested the Nikon 35mm f/1.8 prime -
comparing both SQF at 35mm - the Pentax 18-55 kit is not shabby at all.
----------------------------------------------------
in other words the Pentax 18-55 may in theory be "inferior" to a Nikon prime lens - but it's hardly a "dog" -
please let's get things in perspective.
The OP's posted images
are disappointing -
but I think I'll reserve my comments until we can see the all important EXIF data......