Home  >  Article  >  Backend Development  >  13 logical thinking programming test questions for programmers

13 logical thinking programming test questions for programmers

藏色散人
藏色散人Original
2018-11-05 14:09:318882browse

Programming logic test questions, test how many correct answers can you get?

1. Are there any numbers that meet the following conditions at the same time: when divided by 10, the remainder is 9, when divided by 9, the remainder is 8, and when divided by 8, the remainder is 7. How many such numbers are there between 100 and 1000?

2. There is a pair of rabbits. They give birth to a pair of rabbits every month from the third month after birth. After the rabbit grows to the third month, they give birth to a pair of rabbits every month. If the rabbits do not die, What is the total number of rabbits per month?

3. Determine how many prime numbers there are between 101-200 and output all prime numbers.

4. Print out all the "daffodil numbers". The so-called "daffodil number" refers to a three-digit number whose cube sum is equal to the number itself.

For example: 153 is a "daffodil number" because 153=1 cubed + 5 cubed + 3 cubed.

5. Decompose a positive integer into prime factors. For example: input 90, print out 90=2*3*3*5.

6. Use the nesting of conditional operators to complete this question: students with academic scores >= 90 points are represented by A, students with scores between 60-89 are represented by B, and students with scores below 60 are represented by C. express.

7. Input two positive integers m and n, and find their greatest common divisor and least common multiple.

8. Enter a line of characters and count the number of English letters, spaces, numbers and other characters in it.

9. Find the value of s=a aa aaa aaaa aa...a, where a is a number. For example, 2 22 222 2222 22222 (a total of 5 numbers are added at this time), and the addition of several numbers is controlled by the keyboard.

10. If a number is exactly equal to the sum of its factors, the number is called a "perfect number". For example, 6=1+2+3. Programming to find all perfect numbers within 1000.

11. A ball falls freely from a height of 100 meters. Each time it hits the ground, it bounces back to half of its original height. When it falls again, how many meters does it pass in total when it hits the ground for the 10th time? How high is the 10th rally?

12. With the numbers 1, 2, 3, and 4, how many different three-digit numbers can be formed without repeated numbers? How many are they?

13. 1,000 dogs, counting from the first one, kill every other dog (count again from the first one after counting to the end), and only one dog is left alive in the end. Which dog is this? dog?

The above is the detailed content of 13 logical thinking programming test questions for programmers. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:PHP MySQL: update dataNext article:PHP MySQL: update data