In this paper, the fundamental semiconductor properties of Hg1-xCdxTe and Hg1-xZnxTe are investigated by ab initio calculations based on the FP-LAPW method. Structural properties have been calculated using LDA and GGA approximations. The electronic properties are studied using the LDA and GGA approximations, and the potential TB-mBJLDA coupled with the lattice parameters aLDA and aGGA. The optical properties are determined from the optimal gap energies based on the TB-mBJLDA potential. Lattice parameters aLDA obtained by the LDA calculations predict values that are in good agreement with the experimental results and are better than those results obtained by the GGA calculations. The use of TB-mBJLDA potential coupled with the lattice parameter aGGA gives gap energy values in good agreement with the experimental results for all alloys except Hg1-xZnxTe (x=0.5, 0.75) where the (TB-mBJ LDA+aLDA) is more suitable. Optical constants are calculated from the dielectric function in the energy range (0-30 eV). The spectrum of real and imaginary parts of the dielectric function, the energy loss function, the refractive index, the extinction coefficient, the absorption coefficient, and the reflectivity show that optical properties of Hg1-xCdxTe are comparable to those of Hg1-xZnxTe. Our results are found to be in reasonable agreement with existing data reported in the literature.