# Tutor profile: Vishwajeet S.

## Questions

### Subject: Basic Math

Find the following sum - $$(4/12)$$ + $$(5/16)$$

In mathematics, two fractions can only be added directly if their denominators (12 and 16 here respectively) are equal. For fractions whose denominators aren't equal, they are made equal by converting them to their Least Common Multiple (LCM). So we need to first convert 12 and 16 to their LCM. LCM or least common multiple of 'a' and 'b' is the smallest number which is divisible by both a and b. You can start by checking the multiples of the larger one of 'a' and 'b' and see if that is divisible by both. So for 12 and 16, we see the multiples of 16. 16 x 1 = 16 => Divisible by 16 but not by 12. 16 x 2 = 32 => Divisible by 16 but not by 12. 16 x 3 = 48 => Now, 48 is divisible by both 16 and 12 (48/16 = 3 and 48/12 = 4!) So 48 is the LCM of 12 and 16. Next, we convert the denominators to 48. For that, we need to multiply the denominators with suitable numbers. To make 12 into 48, we need to multiply it by 4. But wait! You cannot simply multiply denominator with a number and leave the numerator as is. You need to multiply the numerator by the same number. Multiplying numerator and denominator by a fraction by the same number does not change the fraction. So $$4/12$$ = $$(4*4)/(12*4)$$ = $$16/48$$ Doing the same with 3/16, 16 need to be multiplied with 3 to make it 48, but then numerator (5) must also be multiplied by 3. So $$5/16$$ = $$(5*3)/(16*3)$$ = $$15/48$$ Once the denominators of the two fractions are equal, their numerators can directly be added and denominator remains same. $$(16/48)$$ + $$(15/48)$$ = $$(16+15)/48$$ = $$31/48$$ Therefore $$(4/12)$$ + $$(5/16)$$ = $$31/48$$

### Subject: C++ Programming

How many times does the FOR LOOP run in the following 2 code snippets- {Note: The number of times the for loop runs is the number of times its conditions are satisfied} A) *************Start of snippet 1************* int i=0; for(i=0; i < 5; i++) { if(i==2) { break; //'break' terminates the loop when i = 2 is satisfied. } } *************End of snippet 1************** B) *************Start of snippet 2************* int i=0; for(i=0; i < 5; ++i) { if(i==2) { break; //'break' terminates the loop when i = 2 is satisfied. } } *************End of snippet 2************** {Assume all required variables and header files are declared for the context of this code}

As you can see, the difference between the two code snippets is the "Post-Increment of i (i++)" in snippet 1 and "Pre-Increment of i (++i)" in snippet 1. Post-Increment increases the value of a variable (i here) by 1 after the value of the variable is used in required expression while Pre-Increment does so before using the variable value in the required expression. Does that mean, every time snippet 1 uses 'i' and then increments it and snippet 2 increments 'i' and then use it? NO. FOR LOOPS increment or decrement their variable at the end of the loop. That way it doesn't matter whether you use ++i or i++. It happens in the end. So the first snippet runs for i=0, 1, 2 before it is terminated. So 3 times. Similarly, the second snippet also runs for i=0, 1, 2 before it is terminated. So again 3 times. Both for loops run for 3 times.

### Subject: Physics

A police car is standing a point A on road. Suddenly a thief passes by in a car traveling at a constant velocity of 20 m/s. By the time police car starts, the thief's car is already at point B, 100 meters from A. However, the police's car is faster and travels at 25 m/s constant velocity. Does the police catch the thief? If yes, how long before they do so? (Assume the road to be a straight line and all other conditions are ideal)

Since the police and thief travel in the same direction and the police's car happens to be faster than the thief's car (20m/s < 25 m/s), the police will eventually catch the thief. At the time when police start chasing, they are at point A, 100 meters behind thief's car at B. Let us assume that thief travels $$x$$ meters before he is caught. This means that police must have driven $$x+100$$ meters. Now, clearly, in the time thief travels $$x$$ meters, police traveled $$x+100$$ meters (that is why they were able to catch him!) Time is taken by a thief to travel $$x$$ m : = distance traveled by thief/velocity of thief = $$x/20$$ --------------------------- Lets call this $$t_{thief}$$ Time taken by police to travel $$x+100$$ m : = distance traveled by police / velocity of police = $$(x+100)/25$$ --------------------------- Lets call this $$t_{police}$$ Now, $$t_{thief}$$ = $$t_{police}$$ Solving for $$x$$: => $$(x+100)/25 = x/20$$ => $$20*(x+100) = 25*x$$ [cross multiplying] => $$20x + 2000 = 25x$$ => $$2000 = 25x - 20x$$ or $$25x = 2000$$ => $$5x = 2000$$ => $$x = 400$$ m Thus, police had to travel 400 meters before they caught the thief. Now $$t_{police}$$ (time taken to catch the thief) = $$(400+100 m) / (25 m/s)$$ = $$20 s$$ Therefore, police catch the thief after 20s of pursuit.

## Contact tutor

needs and Vishwajeet will reply soon.