As mentioned above, you should consult one of the numerous fleet databases on the net. Not all list engines installed on the aircraft, but some do.
A340-200/300 all have CFM56-5C2/3/4 engines depending on the variant
A340-500/600 have RR
About half of A330's in the world have RR
Trent 700's, PW
4000 are next and IMO CF6-80E's are the least common on A330s.
The B777 originally flew with PWs, but GE
-90's and RR
Trent 800s are the more popular choice.