Logic of software test interview

Logic of software test interview

Question 1: the choir has to get to the concert venue in 17 minutes. On the way, they have to cross a bridge. Four people start from the same end of the bridge. It's very dark, and they have only one flashlight. At most two people can cross the bridge together at one time, and they must hold a flashlight when crossing the bridge, so someone has to bring the flashlight to both ends of the bridge. Flashlights can't be delivered by losing them. The walking speed of four people is different. If two people walk together, the slower one shall prevail. Bono takes 1 minute to cross the bridge, Edge takes 2 minutes to cross the bridge, Adam takes 5 minutes to cross the bridge and Larry takes 10 minutes to cross the bridge. How are they going to cross the bridge in 17 minutes

2 Minutes and 1 minute pass at the same time, and 2 minutes come back alone, which takes 4 minutes;
5 Minutes and 10 minutes passed at the same time, and 1 minute came back alone, taking 11 minutes;
2 Minutes and 1 minute pass at the same time, taking 2 minutes
 It took 17 minutes

Question 2: there are 7g and 2G weights and a balance. How to divide 140g of salt into 50g and 90g by using these items three times?

For the first time, divide the salt into two 70 grams and take out one of them;
The second time, use two weights to weigh 9 grams;
The third time, use 9 grams of salt and 2 grams of weight to weigh 11 grams;
So weigh out 20 grams and pour into another 70 grams to obtain 50 grams and 90 grams.

Question 3: 100 people answered five questions, 81 of them answered the first question correctly, 91 of them answered the second question correctly, 85 of them answered the third question correctly, 79 of them answered the fourth question correctly, 74 of them answered the fifth question correctly, and those who answered three or more questions correctly were considered as passing. Then, of these 100 people, at least () passed

First solve the original problem. The number of wrong answers to each question is (the order is not important): 26, 21, 19, 15, 9

 Distribution level 3: the maximum number of people who answer three wrong questions is: (26)+21+19+15+9)/3=30

 Distribution level 2: the maximum number of people who answer two wrong questions is: (21)+19+15+9)/2=32

 Distribution level 1: the maximum number of people who answer one question incorrectly is: (19)+15+9)/1=43

 Max_3=Min(30, 32, 43)=30. So the answer is: 100-30=70. 

 In fact, because 26 is less than 30, after finding the first distribution layer, you can judge that the answer is 70. 

To minimize the number of people who pass, we must do two things:

Those who fail should answer as many questions correctly as possible, which reduces the number of questions that qualified people need to answer correctly, and only fewer qualified people are needed

Try to answer as many questions correctly as possible for each qualified person, so as to reduce the number of qualified people

 By 1, everyone can do at least two questions correctly

 You 2 have to divide the remaining 210 questions to 70 of them: 210/3 = 70,Let these 70 people do all the questions correctly, while the other 30 people only do two questions correctly

 It is also easy to give a specific implementation scheme:

 Let 70 people answer all five questions correctly, 11 people only answer the first and second questions correctly, 10 people only answer the second and third questions correctly, 5 people answer the third and fourth questions correctly, and 4 people only answer the fourth and fifth questions correctly

 Obviously, any slight change will increase the number of qualified students. So the minimum number of people who pass is 70!

Question 4: Xiao Ming and Xiao Qiang are both students of teacher Zhang. Teacher Zhang's birthday is M month N,
Both of them knew that Mr. Zhang's birthday was one of the following 10 groups. Mr. Zhang told Xiaoming the M value and Xiaoqiang the N value. Mr. Zhang asked them if they knew what day his birthday was

3 March 4 March 5 March 8
6 June 4 June 7
9 September 1 September 5
12 December 1 December 2 December 8
 Xiao Ming said: if I don't know,Xiaoqiang must not know
 Xiaoqiang said: I didn't know,But now I know
 Xiao Ming said: Oh,Then I know
 Please infer from the above conversation what day is Miss Zhang's birthday 
The answer should be September 1. 
1)First, analyze these 10 groups of dates,It is not difficult to find through observation,There are only two groups of dates, June 7 and December 2 
The number of days is unique. It can be seen from this that,If Xiaoqiang knows N It's 7 or 2,Then he must know what the teacher said 
birthday. 
2)Xiao Ming said: if I don't know,Xiaoqiang certainly doesn't know ",And the date of the 10 groups 
The number of months is 3,6,9,12,And there are more than two groups of dates in the corresponding month,So Xiao Ming knows M after 
It's impossible to know the teacher's birthday. 
3)Further analysis "Xiao Ming said: if I don't know,Xiaoqiang certainly doesn't know ",Combined with step 2 
conclusion,Xiaoqiang knows N You'll never know. 
4)Combine steps 3 and 1,It can be inferred that all the dates in June and December are not the teacher's birthday,because 
If Xiao Ming knows M It's 6,And if Xiaoqiang's N==7,Then Xiaoqiang knows the teacher's birthday.(By the first 
1 Step has been launched),Similarly,If Xiao Ming's M==12,Ruo Xiaoqiang's N==2,Then Xiaoqiang can also know the teacher's life
 Day. Namely: M Not equal to 6 and 9. Now only "March 4, March 5, March 8, September 1" is left 
9 Five group dates of "May 5". And Xiaoqiang knows,therefore N Not equal to 5(There are March 5 and September 5),here, 
Xiaoqiang's N∈(1,4,8)Note: at this time N Although there are three possibilities,But for Xiaoqiang, as long as you know what's in it 
one kind,Come to a conclusion. So "Xiaoqiang said: I didn't know,But now I know ", 
For us, we need to continue reasoning 
thus,The rest may be "March 4, March 8, September 1" 
5)Xiao Ming said: Oh,Then I know. ",explain M==9,N==1,(N==5 Has been excluded,3 Monthly
 There are two groups)

**Question 5: there are two blind people. They bought two pairs of black socks and two pairs of white socks respectively. The fabric and size of eight pairs of socks are exactly the same, and each pair of socks is connected with a piece of trademark paper. The two blind men accidentally mixed up eight pairs of socks. How can each of them get back two pairs of black socks and two pairs of white socks**

Tear the logo off each pair of socks,Then each person takes one of each pair

Question 6: 1 yuan for a bottle of soda. After drinking, change two empty bottles for a bottle of soda. Q: how many bottles of soda can you drink at most if you have 20 yuan?

Ask someone to borrow a bottle.20 Yuan for soda, 20 10 bottles for 10 sodas, 10 Empty bottle for 5 soda,5 Empty bottles plus borrowed empty bottles
 Change three sodas, Three bottles for one soda,1 bottle left, 1 Empty bottles plus remaining empty bottles for 1 soda, 1 empty bottle left.Give it back to others
 
20+ 10+5+3+1+1 = 40 bottle.
or, Two empty bottles for a bottle of soda.Get soda(Bottle not included)The cost is equal to the cost of empty bottles, It's fifty cents. 20 Block is equal to 40 fifty cents
.So 40 bottles

Question 7: it is said that someone gave the landlady of the wine shop a difficult problem: he knew that there were only two spoons in the shop, which could scoop 7 Liang and 11 liang of wine respectively, but forced the landlady to sell him 2 liang of wine. The clever landlady was unambiguous. She scooped the wine in the wine jar with these two spoons and poured it around. She actually measured 2 liang of wine. Can you do it

7 Pour two into 11 two, Fill it with 7 Liang and 11 Liang, 7 Three out of two, Pour out 11 Liang, Pour 3 Liang into 11 Liang, Fill it with 7 twice and 11 twice, 7 6 out of 2, Pour out 11 pairs, Pour 6 Liang into, Then pour 7 Liang into 11 Liang, surplus
2 two. So get

Question 8: observe the following figures. What should be the next?

1,1,3,7,17,41,?

Resolution:
Start with Item 3,The first term is equal to twice the previous term plus the previous term.2×1+1=3;2×3+1=7;
2×7+3=17; ...;2×41+17=99,So fill in 99

Question 9: observe the following figures. What should I fill in the question mark?

17,24,33,46, ==?==   ,92
 Resolution:
65 The reason is that the difference between two adjacent numbers is
7 9 13 19 27 They form an equal difference sequence of two adjacent numbers 2 4 6 8

Keywords: Interview

Added by PastorHank on Tue, 01 Feb 2022 23:35:55 +0200