What I understand from the question is :
Class brought cans of fruit = six
Cans of beans = four
Boxes of noodles = seven
Cans of Soup = four
Ratio of cans of fruit to the total number of food items = ?
Total number of food items = 6 + 4 + 7 + 4 = 21
Cans of fruits : Total number of food items
6 : 21 = 2 : 7
So the ratio of cans of fruit to the total number of food items is 2 : 7
It means two out of every seven food items the class brought is can of fruits.