0% found this document useful (0 votes)
59 views3 pages

CST445 B

Uploaded by

jith2808
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views3 pages

CST445 B

Uploaded by

jith2808
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

C 1000CST445122201 Pages: 3

Reg No.:_______________ Name:__________________________


APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY
Seventh Semester B.Tech Degree (S, FE) Examination May 2023 (2019 Scheme)

Course Code: CST445


Course Name: PYTHON FOR ENGINEERS
Max. Marks: 100 Duration: 3 Hours
PART A
Answer all questions, each carries 3 marks. Marks

1 What is a datatype? Explain different datatypes used in python. (3)


2 What will be the output of the following code (3)
for c in range(25,15,-2):
c=c+5
print(c, end=' ')
3 Describe the working of lambda function with an example (3)
4 Let num=[14,[26,52],2,[8,3],56]. Write the expressions for following (3)
operations in Python:
i) Replace the value 56 with 92
ii) Print the value 8.
iii) Remove the value 52 from list
5 List the different object-oriented concepts. (3)
6 What is a constructor. Explain with an example. (3)
7 Explain with example the difference between read(), readline() and readlines() (3)
functions associated with files in python.
8 Illustrate how mathematical expressions are written using matplotlib. (3)
9 Illustrate the following methods to generate random numbers (3)
(i) rand() (ii) randn() (iii) randint()
10 With example explain eye() and reshape() in matrix operations. (3)
PART B
Answer any one full question from each module, each carries 14 marks.
Module I
11 a) Describe about different selection structure used in python with suitable (6)
examples.

Page 1of 3
1000CST445122201

b) Write a python program to check whether a number given by a user is (8)


palindrome or not.
OR
12 a) Write a python program to print the factorial of a number and count the number (7)
of digits in the factorial.
b) Write a Python program to find the roots of a quadratic equation. (7)
Module II
13 a) What is recursion? Write a python program to find the nth fibonacci number (7)
using recursion after getting the number from the user prompt.
b) Explain dictionary in python. How does the following dictionary operations (7)
work (i) values() (ii) keys() (iii) pop() (iv) items() (v) len(). Explain with
examples.
OR
14 a) With examples explain any four built-in methods used for set operation. (8)
b) Write a python program to read a list of numbers. Define a separate function to (6)
check whether each element in a list is prime or not. Print the prime numbers as
a list.
Module III
15 a) Describe the use of try-except method in Python with suitable illustration. (7)
b) What is abstraction? Write a program to create an abstract class named (7)
quadrilateral to find the perimeter of a rectangle.
OR
16 a) Explain the concept of multiple inheritance with an example. Explain how (9)
python handles diamond problem.
b) Create a class Person with attributes name, age salary. Define a method (5)
getdetails() to assign values to the attributes and a method display() for showing
the details. Create an instance of the class and call the methods.
Module IV
17 a) Plot the functions tan x and cot x vs x on the same plot with x going from −2π to (7)
2π. Make sure the limits of the x-axis do not extend beyond the limits of the
data. Plot tan x in red color and cot x in blue color and include a legend to label
the two curves. Place the legend within the plot at the lower right corner. Draw
thin gray lines behind the curves, one horizontal at y = 0 and the other vertical at
x = 0.

Page 2of 3
1000CST445122201

b) Create a file “num.txt” with 10 integer numbers, write the odd numbers to (7)
another file named “odd.txt” and find the sum and average of odd numbers
OR
18 a) Explain in detail about the structure of matplotlib. (6)
b) Illustrate contour plot and vector plot. (8)
Module V
19 a) Write a python program to calculate the eigen values and eigen vectors of a (4)
0 2
matrix, A= [ ]
2 3
b) With example explain the different methods of creating a one-dimensional array (10)
using NumPy.
OR
20 a) Write a python program to solve the following system of equations. (4)
4x1+3x2+2x3+x4=25
x1-2x2+2x3+3x4=-10
2x1+3x2-5x3+2x4=-4
x1+3x2+4x3+2x4=9
b) A CSV file ‘student.csv’ consist of student details which has the following fields (10)
rollno, name, mark1, mark2, mark3. Write python code to do the following using
pandas library.
a) Read and display the first 5 rows of CSV file
b) Display the rollno and name in the sorted order of name
c) Add a new column total(mark1+mark2+mark3) to the data frame
d) Display rollno, name and total marks of all the students in the descending
order of total marks
e) Find the mean and variance of mark1
f) Find the highest and lowest mark in mark2.
g) Plot the marks mark3 against name
h) Display last two rows of the CSV file
i) store the data frame in a new CSV file ‘studentnew.csv’
j) Set rollno as index
****

Page 3of 3

You might also like