Is the program 32 or 64 bits? Assignment is simple to explain: write the shortest code you need to determine whether an executable binary program supplied as parameter is 32 or 64 bits.

If there is a different kind of bitness, you can also do for it, but is not mandatory.

What I really don't want is telling me you support other bitnesses and after I get 32 or 64 as a result.

Valid outputs for 32:

32
32bit
32bits
32 bit
32 bits


The same pattern for 64.

No accepted answer.
Jelly on Linux, 6 bytes

5ịO×32


Try it online!

Usage note: the question says "write the shortest code you need to determine whether an executable binary program supplied as parameter", and that's exactly what you need to do here; supply the entire executable binary program as the parameter. Not its filename, the program itself. (I hope you have a fairly understanding shell!) The TIO link uses the shortest known ELF program Linux will run, by Brian Raiter as the example program.

Linux uses ELF as its executable format. It turns out that the fifth byte of an ELF program specifies the processor bitwidth it's designed for: 0x01 for a 32-bit program, or 0x02 for a 64-bit program. So all we have to do is extract the byte in question (5ị), convert it from a character to a number (O), and multiply by 32 (×32).

There's probably a language that can use this exact algorithm more succinctly, but I wanted to post this answer to demonstrate the algorithm.