Model Question Paper CST 445 KTU Python For Engineers
APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY
SEVENTH SEMESTER B.TECH DEGREE EXAMINATION, MONTH & YEAR
Course Code: CST445 Course name : PYTHON FOR ENGINEERS
Max Marks: 100 Duration: 3 Hours
PART-A
(Answer All Questions. Each question carries 3 marks)
1. Explain the basic data types available in Python, with examples.
2. Write a Python program to reverse a number and also find the sum of digits of the number.Prompt the user for input.
3. Compare tuples, lists, and dictionaries.
4. Explain the concept of scope and lifetime of variables in Python programming language,
with a suitable example.
5. What is polymorphism? Give an example in the context of OOP in Python.
6. How is exception handling accomplished in Python programs?
7. Describe the characteristics of the CSV format.
8. Plot the function y = 3x^2 for −1 ≤ x ≤ 3 as a continuous line. Include enough points so that
the curve you plot appears smooth. Label the axes x and y
9. Describe random number generation using Python
10. How can a generalized eigen value problem can be solved using Python?
11. (a) Compare and contrast interpreted languages and compiled languages.How does it affect the quality of program development and execution of the program?(6)
(b) What are the possible errors in a Python program. Write a Python program to print the value of 2^(2n) +n+5 for n provided by the user.
(b) Input 4 integers (+ve and −ve). Write a Python code to find the sum of negative numbers, positive numbers, and print them. Also, find the averages of these two groups of numbers and print (8)
(b) Write a Python program to read a list of numbers and sort the list in a non-decreasing order without using any built in functions. Separate function should be written to sort the list wherein the name of the list is passed as the parameter.(9)
OR
14. (a) Illustrate the following Set methods with an example.
i. intersection( ) ii. Union( ) iii. Issubset( ) iv. Difference( ) v. update( ) vi.discard( ) (8)
(b) Write a Python program to check the validity of a password given by the user.
The Password should satisfy the following criteria: (6)
2. Contains at least one number between 0 and 9
3. Contains at least one letter between A and Z
5. Minimum length of password: 6
(b) Explain inheritance in Python. Give examples for each type of inheritance. (9)
(b) Define a class in Python to store the details of a ship (name, source,destination) with the following methods:
i) get_details( ) - to assign values to class attributes
ii) print_details( ) - to display the attribute values
Create an object of the class and invoke the methods
(b) Explain semi-log plots and log-log plots along with the functions used in creating such plots.(4)
(b) Given a file “auto.csv” of automobile data with the fields index, company, body-style, wheel-base, length, engine-type, num-of-cylinders, horsepower, average-mileage, and price, write Python codes using Pandas to
1) Clean and Update the CSV file
2) Print total cars of all companies
3) Find the average mileage of all companies
4) Find the highest priced car of all companies.
19. (a) Write python program to solve the following system of equations (4)
x1 − 2x2 + 9x3 + 13x 4 = 1
−5x1 + x2 + 6x3 − 7x4 = −3
4x1 + 8x2 − 4x3 − 2x4 = −2
8x1 + 5x2 − 7x3 + x 4 = 5
(b) Given the sales information of a company as CSV file with the following fields month_number, facecream, facewash, toothpaste, bathingsoap, shampoo, moisturizer, total_units, total_profit. Write Python codes to visualize the data as follows
1) Toothpaste sales data of each month and show it using a scatter plot
2) Face cream and face wash product sales data and show it using the bar chart
Calculate total sale data for last year for each product and show it using a Pie chart. (10)
SN Name Country Contribution Year
1 Linus Torvalds Finland Linux Kernel 1991
2 Tim Berners-Lee England World Wide Web 1990
3 Guido van Rossum Netherlands Python 1991
(b) Explain how integration is performed with SciPy. Illustrate the same with the two sample integrals using SciPy function (5)
Comments
Post a Comment