Step-by-step explanation:
Barium is a metal and has excess of electrons. Thus, in order to become stable barium will donate its extra electrons to an electron deficient atom. As a result, there will be formation of ionic bond.
Non-metals have deficiency of electrons and thus, they will readily accept electrons from barium in order to complete their octet. Mostly non-metals have a charge of -1. 
Therefore, they will combine with barium to form a compound with formula 
 .
.
For example, when barium combines with fluorine, the formula will be 
 .
.
Hence, we can conclude that barium can combine with fluorine, iodine, chlorine, and bromine such that the formula could be written as 
 .
.