When i load an
exe in the IDA the assembled code always starts at
00401000 address. Does it mean that in
pe files the code always starts at that specific address?
No it does not all pe files do not start at the same address 0x401000
historically 0x400000 is the ImageBaseAddress Header is 0x1000 bytes
so .code section starts at 0x401000 for a normal exe
since the Exe's module is the first to be loaded it normally gets its Preferred ImageBase Address
but a relocation table is a part of exe in case there is a conflict and the imagebase needs to be shifted to another base
you can control both aspects using linker switches
C:\>link /? | grep -iE "base|fixed"
you can also lookup about rebasing in ida