Analysis | C Language Level 1 Practical Exam Questions from the Electronics Society (September 2024)

Analysis | C Language Level 1 Practical Exam Questions from the Electronics Society (September 2024)Follow me for more children’s programming contentAnalysis | C Language Level 1 Practical Exam Questions from the Electronics Society (September 2024)

1. Talk is cheap. Show me the code.

The famous quote by Linus Torvalds, the father of Linux, is: “Talk is cheap. Show me the code.” Please output this sentence directly on the screen.

Time limit: 1000

Memory limit: 65536

Input

There is no input for this question.

Output

Output `Talk is cheap. Show me thecode.` on one line.

Sample Input

None

Sample Output

Talk is cheap. Show me the code

Analysis | C Language Level 1 Practical Exam Questions from the Electronics Society (September 2024)

2. Amazing News

“Let me tell you an amazing piece of news: next year, everyone in the world will be the same age, all equal to 2022. Next year is very special, it happens only once every 1000 years. Your age next year + your birth year will equal 2022. For example: if you are 57 next year and were born in 1965, it adds up to 2022. It’s particularly strange, even experts can’t explain it! Calculate and see if it equals 2022. It’s truly a once-in-a-millennium event! Share it with your friends and let everyone calculate!” This “electronic package” post is said to appear every year. Please determine the year the post was made based on the age and birth year mentioned by the poster.

Time limit: 1000

Memory limit: 65536

Input

The first line contains two positive integers, the age and the birth year, where age is in the range (0,200) and birth year is in the range (1900,2022).

Output

Output the year the post was made on one line.

Sample Input

57 1965

Sample Output

2021

Hint

Sample explanation: Since the post states “next year everyone will be the same age”, the post was made this year, which is 2021.

Analysis | C Language Level 1 Practical Exam Questions from the Electronics Society (September 2024)

3. Height Matching Calculation

Experts have found through multiple research data that an ideal height pairing follows a formula: (female height) x 1.15 = (male height). Please write a program to calculate the ideal matching height for any user.

Time limit: 1000

Memory limit: 65536

Input

The first line gives a positive integer N (≤10), representing the number of users inquiring. The following N lines provide the gender and height of each user in the format “gender height”, where “gender” is “F” for female and “M” for male; “height” is a real number in the range [1.0,3.0].

Output

For each inquiry, output the calculated ideal matching height value, rounded to two decimal places.

Sample Input

2

M 1.75

F 1.8

Sample Output

1.61

1.96

Analysis | C Language Level 1 Practical Exam Questions from the Electronics Society (September 2024)

4. Body Weight Health Assessment

According to medical research standards, an individual’s standard weight can be calculated using the following formula: Standard weight (kg) = (Height (cm) – 100) x 0.9. If the absolute difference between actual weight and standard weight is less than 10% of the standard weight, it is considered within the healthy weight range. The conversion relationship between jin and kg is: 1 kg = 2 jin. Now, based on the given height and actual weight data of individuals, assess their weight health status.

Time limit: 1000

Memory limit: 65536

Input

The first line contains a positive integer N (≤20), representing the number of individuals to be assessed. The following N lines each provide two integers, representing a person’s height H (120 < H < 200, in cm) and actual weight W (50 < W ≤ 300, in jin), separated by a space.

Output

For each individual, output an assessment conclusion on one line: if the actual weight is within the healthy weight range, output You are in perfect shape!; if the actual weight exceeds the healthy weight range, output You are overweight!; if the actual weight is below the healthy weight range, output You are underweight!.

Sample Input

3

169 136

150 81

178 155

Sample Output

You are in perfect shape!

You are underweight!

You are overweight!

Analysis | C Language Level 1 Practical Exam Questions from the Electronics Society (September 2024)

5. Automatic Packing Machine

The working procedure of an automatic packing line for cantaloupes is as follows: first, the system sets the total weight W that each box of cantaloupes should have; then the conveyor belt transports each cantaloupe to an automatic weighing device, which performs the following operations based on the weighing results:

If the total weight measured is exactly W, all the cantaloupes on the scale are packed and sent away:

If the total weight measured is less than W, the cantaloupe remains on the scale;

If the total weight measured exceeds W, the cantaloupe is returned to the conveyor belt.

Please write a program to count how many cantaloupes were packed into how many boxes.

Time limit: 1000

Memory limit: 65536

Input

The first line gives two positive integers N (≤1000) and W (≤10000), representing the number of cantaloupes on the conveyor belt and the specified weight per box (grams). The following line provides N positive integers, which are the weights of each cantaloupe on the conveyor belt, with each weight not exceeding 2000 grams. Assume the conveyor belt transports the cantaloupes to the weighing device in the order given.

Output

Output the number of successfully packed boxes and the number of cantaloupes packed in one line, separated by a single space, with no extra spaces at the beginning or end of the line.

Sample Input

12 5000

2000 1500 1800 1000 1800 500 1900 1500 2000 1600 2000 2000

Sample Output

2 7

Sample Explanation:

12 5000

2000 1500 1800 1000 1800 500 1900 1500 2000 1600 2000 20002000 3500 5300 4500 6300 5000 1900 3400 5400 5000 2000 4000

HintSample explanation: The 1st, 2nd, 4th, and 6th cantaloupes make exactly one box; the 7th, 8th, and 10th cantaloupes make exactly one box.

Analysis | C Language Level 1 Practical Exam Questions from the Electronics Society (September 2024)For more detailed content, please follow the public account and contact me in the class.

————————————————

Leave a Comment