Question
What will be the value of `x` after the following
pseudo-code execution? ```   x = 0   data = [10, 20, 30]   for item in data:     if item > 15:       x = x + item     else:       x = x - item   ```Solution
 Dry Run:       `x = 0`       `item = 10`: `10 > 15` is false. `x = 0 - 10 = -10`       `item = 20`: `20 > 15` is true. `x = -10 + 20 = 10`       `item = 30`: `30 > 15` is true. `x = 10 + 30 = 40`       Final `x = 40`
The number of students in class 'A' is 128, and the ratio of the number of girls to boys is 5:11. If the average number of boys in classes A and B is 14...
The ratio of the present ages of P and Q is 7:4 respectively. If the age of P 13 years hence from now will be 125% more than the age of Q 4 years ago fr...
There are three distinct numbers a, b and c. If a = 200, (a + b) = 500 and (c – b) = 100, find the average of a, b and c.
- In a community park, the ratio of the number of benches, swings, and slides is 4:3:2, respectively, and the average number of these items is 60. What is th...
In a school with 400 students, the average of the age of the boys is 16 years and that of the girls is 12 years. If the average age of the school is 14 ...
There are five containers in a truck hold. The weight of the first container is 100 kg and the weight of the second container is 20% higher than the wei...
Anil bought 27 notebooks for Rs.1280 from shop A and 20 notebooks for Rs.1211 from shop B. What is the average price he paid per book?
In a training group of 32 members, the average score is 60. One member with a score of 56 leaves, and 4 new members with an average score of 64 join. Wh...
The average of 27 numbers is 20.The average of first 13 numbers is 15 and that of the last 13 numbers is 18. What will be the 27th number?
An ODI is played between India and Pakistan. Team India’s average run rate for the first 33 overs was 6.5 runs per over while in the remaining 17 over...