← Programming Concepts in Mechanical Engineering (25ME34I)
Solved Model Question Papers
Programming Concepts in Mechanical Engineering (25ME34I) · C-25 Diploma Mechanical, Semester III
Read with diagrams, search and self-test
A.1 CIE-1 Theory Test (Weeks 1–4) – 90 minutes, 50 marks
Answer any one full question from each section. Each question carries 25 marks (7 +6+6+6).
Section 1
Q1 (a) Draw a flowchart to check whether a given number is prime. (7) – Fig. 1.7 and Program 1.5.
(b) Discuss the importance of breaking a problem into smaller steps while creating an algorithm. (6) – Section 1.4 and Chapter 1, Q2.
(c) How do you declare variables to store a person's name and age? Which data types are appropriate and why? (6) – Chapter 2, Q2.
(d) Explain the purpose of input() with an engineering example. (6) – Chapter 2,
Q3.
Q2 (a) Draw a flowchart to find the maximum of three forces F1, F2, F3. (7) – Fig. 1.6.
(b) Compare how Python, with its libraries, is more advantageous than C++ or Java. (6) – Section 1.3 table.
(c) Discuss the boolean variable in Python and its use in engineering decision making. (6) – Chapter 2, Q4.
(d) If a user enters a decimal number but an integer is needed, how is it handled using type conversion? Give code. (6)
value = float(input("Enter number of teeth: ")) # user typed 12.75
teeth = int(value) # truncate to 12
teeth_r = round(value) # or round to nearest -> 13
print("Truncated:", teeth, " Rounded:", teeth_r)Enter number of teeth: 12.75 Truncated: 12 Rounded: 13
Section 2
Q3 (a) Write an if-else condition to check whether a product's weight is acceptable for transport. (7) – Section 3.3.
(b) Differentiate break, continue and pass with an example of checking machine components for faults. (6) – Section 3.7.
(c) Describe the role of function parameters and return values; give an example calculating the cost of various materials. (6) – Chapter 4, Q1.
(d) Differentiate built-in and user-defined functions; give an example where a built-in function is more efficient. (6) – Section 4.7.
Q4 (a) Use elif to give low, medium and high pipeline-pressure warnings. (7) – Section 3.4, Fig. 3.1.
(b) Differentiate for and while loops with engineering examples. (6) – Section 3.6.3.
(c) Explain why user-defined functions are necessary even when built-in functions exist. (6) – Chapter 4, Q3.
(d) Differentiate local and global variables with an engineering example. (6) – Section 4.5.
A.2 CIE-2 Practice Test – 180 minutes, 50 marks
Answer any one full question (5 + 5 + 10 + 15 + 15 = 50 marks).
Question 1: (a) Algorithm and flowchart to convert Fahrenheit to Centigrade – Program 1.1. (b) Even or odd – Program 3.1. (c) Multiplication table using for loop – Program 3.2. (d) Write random numbers to a file and read them back – Program 6.2. (e) GCD using a function – Program 4.2.
Question 2: (a) Algorithm and flowchart for efficiency of a simple machine – Program 1.2. (b) math module for trigonometric calculations – Program 4.4. (c) Dictionary of student records with add and remove functions – Program 5.3. (d) Car class with start, stop and display – Program 7.1. (e) Read a CSV file and count rows – Program 6.4.
Scheme of valuation for a practice question (typical)
| Component | Marks share |
|---|---|
| Algorithm / flowchart / logic | 20 % |
| Program writing (syntax, structure, comments) | 40 % |
| Execution with correct output | 30 % |
| Viva-voce | 10 % |
A.3 SEE Model Practical Question Paper – 180 minutes, 50 marks
Answer any one full question.
Question 1
(a) Write a Python class to represent a Car with model, year and colour, and methods to start, stop and display details. (10 marks, CO2) – Program 7.1.
(b) Develop a Python program to calculate the sample average and sample range for given data and plot X-bar and R charts using Matplotlib. (20 marks, CO3) – Program 10.1 (with the manual verification of Example 10.1).
(c) Write a program to build an automated water-pump controller using Raspberry Pi. (20 marks, CO4) – Program 8.8, block diagram Fig. 8.5.
Question 2
(a) Create a Python program that stores student names in a list and performs adding, removing and sorting. (10 marks) – Program 5.1.
(b) Calculate mean, variance and standard deviation using Python and generate X-bar and R control charts from sample data. (20 marks) – Programs 11.1 and 11.3.
(c) Write a program to control DC motors using the L298N motor driver with Raspberry Pi. (20 marks) – Program 8.5, wiring Fig. 8.4.
Additional practice questions for SEE
1. Write a program to compute Cp and Cpk for given data and comment on capability – Program 11.2.
2. Plot a Pareto chart for given defect data – Program 12.1.
3. Write a program for p-chart / c-chart – Programs 10.3, 10.4.
4. Interface DHT11 and display temperature and humidity; switch a fan above a set temperature – Programs 9.1, 8.7.
5. Measure distance with HC-SR04 and stop a motor when an obstacle is within 20 cm – Programs 9.4, 9.7.
6. Write a program to plot the stress distribution in a plate with and without a hole – Program 13.3.
7. Solve a stepped bar using the stiffness method – Program 13.1.
In the practical examination, first write the aim, algorithm/flowchart and circuit connections (for Raspberry Pi), then the program. Use meaningful variable names and comments. Run the program, note the output, and be ready to explain every line in the viva.
APPENDIX B