The reaction of 1-amino-5-(4-methylbenzoyl)-4-(4-methylphenyl)pyrimidin-2(1H)-one/-thione (1a,b) with ethyl acetoacetate (EA) afforded moderate to good yields (59-63%) of ethyl 2-methyl-4-(4-methylbenzoyl)-5-(4-methylphenyl)-7-oxo/-thioxo-3,3a-dihydropyrazolo[1,5-c]pyrimidine-3-carboxylate (2a,b). The newly synthesized compounds were characterized by elemental analyses, IR, (1)H and (13)C NMR spectral data. All were compared with their previous analogues. The reaction mechanism of 1 with EA was studied by means of the B3LYP/6-31G(d,p) method. In addition, for reactants Fukui functions were performed using the data calculated with the Becke3-Lee-Yang-Parr (B3LYP) hybrid function.