In triangle ABC, AB > BC > AC. BC = 5 and AC = 12. If the triangle is an acute triangle what could be the possible value of AB?
For AB = 13 the triangle will be a right triangle. SO, as the triangle is an acute AB<13 As ABC is a triangle AB>0. So, 0<AB<13
what is the value for 1 + 2 + 3 + .... + 100.
If you want to do this calculation manually then it would take much time. So, we can make a simple approach without having much idea about the term sum formula. S = 1 + 2 + 3 + ... + 100 S = 100 + 99 + 98 + ....+ 1 (reversed the array) 2S = 101+101+101+.....+101 (100 times 101) 2S = 10100 S = 10100/2 = 5050 (ANSWER) If you notice here we did (100/2) times (1 + 100) (n/2) times (first term + last term) And this is the formula for term sum of a series S = (n/2) (a+l) n = number of terms. a= first term l = last term.
What are an abstraction, encapsulation and the difference between them?
Suppose want to buy a product online. So, you started searching for it on any online site(for e.g. say Amazon). Now on the product search page, you are just giving the keyword for the product you want to buy and you will have the search results on your plate. You don't know what has happened behind the scene. How the search results are fetched. This is what the abstraction is. Now behind the scene, there could be so many operations like matching the keywords from the available products, fetch the matched products from DB, maybe some operations like by default sorted by price and etc. All of this operation would be performed in one go (on the back end in one method say SearchProducts). So, this is what the encapsulation is. Here all the operations are encapsulated in one method. We can also say Encapsulation is the implementation of the abstraction.