Govt. Exams
Entrance Exams
A's work rate = 1/12, B's work rate = 1/18. Combined rate = 1/12 + 1/18 = 3/36 + 2/36 = 5/36. Time = 36/5 = 7.2 days.
int x = 5;
int y = ++x + x++ + x;
System.out.println(y);
++x makes x=6, then 6 is added. x++ uses 6 then increments to 7. Finally +x adds 7. So: 6 + 6 + 7 = 19.
Let distance = d km. Time A to B = d/60 hours, Time B to A = d/40 hours. Total time: d/60 + d/40 = 10. LCM(60,40)=120, so (2d + 3d)/120 = 10, giving 5d/120 = 10, thus d = 240 km.
Binary search has a time complexity of O(log n) because it divides the search space by half in each iteration. This works only on sorted arrays.
Cost per apple = 50/12 = Rs. 4.17. Selling price = Rs. 5. Profit = 5-4.17 = 0.83. Profit% = (0.83/4.17)×100 ≈ 20%.
Factors of 24: 1,2,3,4,6,8,12,24. Factors of 36: 1,2,3,4,6,9,12,18,36. GCD = 12
Let numbers be 3x and 4x. 3x + 4x = 70. 7x = 70. x = 10. Numbers are 30 and 40
Let number = x. 30% of x = 45. 0.30x = 45. x = 45/0.30 = 150
z-index controls the stacking order of overlapping elements on a webpage
ArrayList provides O(1) random access, while LinkedList provides O(n) access