D 1200csT362052301
Reg No.:
APJ ABDUL KAL,{M TECIINOLOGICAL t]N
B.Tech Degree 56 (S, FE) / 54 (PT) (S) ExaminationJanuary 2024
Course Code: CST362
Course Name: PROGRAMMTNG tN pyTHON
Max. Marks: 100 Duration:3 Hours
PART A
Answer all questions, each carries 3 marks. Marks
'Explain type conversion with example.
(3)
Write a program that accepts the lengths of three sides of a triangle as inputs and (3)
outputs whether or not the triangle is a right triangle.
3 Differentiate between lists and tuples with the help of examples. (3)
4 Write a Python program to print all palindromes in a line of text. (3)
5 Comment on event driven programming. (3)
6 Write a Python program to draw a hexagon using turtle graphics. (3)
7 Give an example for constructor overloading. (3)
8 Explain method oveniding in Python. (3)
9 Explain the attributes of an ndarray object. (3)
l0 Explain the use of flask in web development. (3)
PART B
Answer onefull questionfrom each modure, each carries 14 marks.
Module I
I I a) Discuss the steps involved in the waterfall model of software development (8)
process with the help of a neat diagram.
t
b) Write a Python program to print all numbensfbtween 100 and 1000 whose sum (6)
of digits is divisible by 9.
OR
12 E Illustrate the use of ranlee in pythin. e
(6)
b) writea Python program to print all prime factors of a given number. (s)
Module ll
13 a) write a Python program to compute.the sum of the series (l- + (6)
xz/21 x4/4! -
x6l6!+..........n terms).
b) Illustrate the use of iny four dictionary methods. (8)
Page lof3
1200csT36205230L
OR
14 a) Write a Python program tobonvert a decimal number to its binary equivalent. (7)
b) Write a Fython program to read a text file and store the count of occurrences of (7)
each character in a dictionarv.
Module lll
15 a) write a Srthon program to convert a coror image to a grayscale image. (6)
b) Explain the attributes and methods of Turtle object. (8)
OR
16 a) Write Python GUI program to input two strings and output a concatenated string (6)
' when a button is pressed.
b) Discuss on the types of window components and their functions. (8)
Module lV
17 a) Illustrate the use of abstract classes in python. (6)
b) Define a class Student in Python with attributes to store the roll number, name (8)
and marks of three subjects for each student. Define the following methods:
readDataQ- to assign values to the attributes
computeTotalQ - to find the total marks
print details0 - to display the attribute values and the total marks
Create an object of the class and invoke the methods.
OR
I
l8 a) Explain, with the help of suitable examples, the different types of inheritance. (8)
b) Write a Python program to demonstrate the use of try, except and finally blocks. (6)
Module V
l9 a) consider a csV file 'weather.csv' with the following columns (date, (8)
temperature, humidity, windSpeed, precipiJationType, prace, weather
{Rainy,
Cloudy, Sunny)).
Write commands to do the following using pandas library.
1. Print first l0 rows of weather data- b
2. Find the maximum and minimum temperature
3. List the places with temperature less than 2goc.
4. List the places with weather ..Cloudy,,
=
5. Sort and display each weather and its frequency
6. Create a bar plot to visualize temperature of each day.
Page2of3
I
fl(xrcsT362052301
b) Explain the different ways by which numpy arrays are created. (6)
rOR
20 a) Write Python program to write the data given below to a CSV file. ' (5)
Sl No. Title Author Available Count
I The Great Gatsby F. Scott Fitzgerald Y 20
2 hide and Prejudice Jane Austen Y l5
3 The Time Machine H.G. Wells N 0
b) Write a $thon program to input two matrices and perform the following (9)
operations using numpy and display the results:
t. Add the matrices
2. Subtract the matrices
3. Multiply the matrices
4. Find transpose of the matrices
* *!tt
Page 3of3