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?

PART-B
(Answer any one full question from each module)
Module -1
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.

           OR
12. (a) Describe Arithmetic operators, Assignment operators, Comparison operators, Logical operators, and Bitwise operators in detail with examples.(6)
(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)
 
Module -2
13. (a) Write a Python code to create a function called list_of_frequency that takes a string and prints the letters in non-increasing order of the frequency of their occurrences. Use dictionaries.(5)
(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)
1. Contains at least one letter between a and z
2. Contains at least one number between 0 and 9
3. Contains at least one letter between A and Z
4. Contains at least one special character from $, #, @
5. Minimum length of password: 6

Module -3
15. (a) How can a class be instantiated in Python? Write a Python program to express the instances as return values to define a class RECTANGLE with parameters height, width, corner_x, and corner_y and member functions to find center, area, and perimeter of an instance.(5)
(b) Explain inheritance in Python. Give examples for each type of inheritance. (9)
OR
16. (a) Write a Python class named Circle constructed by a radius and two methods which will compute the area and the perimeter of a given circle (6)
(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

Module -4
17. (a) Plot the functions sin x and cos x vs x on the same plot with x going from −π to π. Make sure the limits of the x-axis do not extend beyond the limits of the data. Plot sin x in the color orange and cos x in the color green and include a legend to label the two curves. Place the legend within the plot, but such that it does not cover either of the sine or cosine traces. Draw thin gray lines behind the curves, one horizontal at y = 0 and the other vertical at x = 0.(10)
(b) Explain semi-log plots and log-log plots along with the functions used in creating such plots.(4)

OR
18. (a) Explain how matplotlib can be used to create dimensional contour plots and vector field plots.(6)
(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.
 
Module -5
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)
                                                                                                 
OR
20. (a) Write Python program to write the data given below to a CSV file.(9)
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

Popular posts from this blog

Python For Engineers CST 445 KTU Open Elective Notes S7 - Dr Binu V P 9847390760

Plotting- Simple plots,setting limits,subplot, semilog, loglog plots