In a sequence, each number is the sum of the previous two numbers. If the 5th number is 20 and the 6th number is 32, what is the 4th number?
A10
B12
C15
D18
Correct Answer:
B. 12
EXPLANATION
Let the 4th number be x. Then 5th number = previous number + x. If 5th = 20 and 6th = 32, then 6th = 5th + 5th_previous, so 32 = 20 + (5th_previous). Therefore, 5th_previous = 12. Since 5th_previous is the 4th number, the answer is 12.
A train travels from City A to City B at 60 km/h and returns at 40 km/h. The total distance between the two cities is 240 km. What is the average speed of the train for the entire journey?
A48 km/h
B50 km/h
C52 km/h
D55 km/h
Correct Answer:
A. 48 km/h
EXPLANATION
Average speed = Total Distance / Total Time. Distance one way = 240 km. Time from A to B = 240/60 = 4 hours. Time from B to A = 240/40 = 6 hours. Total Distance = 480 km, Total Time = 10 hours. Average Speed = 480/10 = 48 km/h.
A software developer needs to optimize a SQL query. Currently, the query performs a full table scan on a table with 1 million rows. Which of the following would be the BEST approach to improve performance?
AAdd an INDEX on the columns used in WHERE clause
BIncrease the RAM of the database server
CReduce the number of columns in SELECT statement
DArchive older records to a different table
Correct Answer:
A. Add an INDEX on the columns used in WHERE clause
EXPLANATION
Adding an INDEX on columns used in WHERE clause is the most direct and effective way to optimize query performance by avoiding full table scans. This is a standard database optimization technique. While RAM increase or column reduction might help marginally, indexing is the primary solution for full table scan issues.
A train travels from City A to City B at 60 km/h. On the return journey, it travels at 40 km/h. If the total time taken for both journeys is 10 hours, what is the distance between the two cities?
A240 km
B300 km
C360 km
D420 km
Correct Answer:
A. 240 km
EXPLANATION
Let distance = d. Time = Distance/Speed. d/60 + d/40 = 10. LCM(60,40) = 120. (2d + 3d)/120 = 10. 5d = 1200. d = 240 km.