In bash, If I have a file called file1 how can I use stdin along with the binary corresponding to the following code in order to return the integer file descriptor corresponding to file1 ?
You have an apparent misconception. There is no single the file descriptor for any given file, nor indeed any file descriptor at all for a file that is not open. File descriptors are per-process resources associated in each process with that process's open files. The question is thus based on a false premise.
Furthermore, even if you redirect a process's standard input to come from file1, that does not identify stdin with file1 in that process. It merely means that you can read file1's contents via stdin, once. You cannot in that case gain any other information about file1 from stdin, so even in a more general sense, the methodology you propose to use to get information about file1 (other than its contents) is not viable.