0% found this document useful (0 votes)
6 views4 pages

Cst362 Programming in Python, May 2023

This document outlines the syllabus and examination structure for the Sixth Semester B.Tech Degree Supplementary Examination in Programming in Python at APJ Abdul Kalam Technological University. It includes various questions divided into two parts, covering topics such as Python programming concepts, GUI programming, file handling, and data structures. The examination consists of multiple-choice questions and programming tasks that assess the students' understanding and application of Python programming.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
6 views4 pages

Cst362 Programming in Python, May 2023

This document outlines the syllabus and examination structure for the Sixth Semester B.Tech Degree Supplementary Examination in Programming in Python at APJ Abdul Kalam Technological University. It includes various questions divided into two parts, covering topics such as Python programming concepts, GUI programming, file handling, and data structures. The examination consists of multiple-choice questions and programming tasks that assess the students' understanding and application of Python programming.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 4

D 0300csr3620s2203

Reg No.:

APJ ABDUL ICALAM TECHNOLOGICAL UNIV


Sixth Semester B.Tech Degree Supplementary Examination May 2023 (

Course Code: CST362


Course Name: PROGRAMMING IN PYTHON
Max. Marks: 100 Duration: 3 Hours

PART A
Answer oll questions, each carries 3 morks. Marks

What is the output of the following Python code. Justifo your answer. (3)
x: tabcdt
for i in range(len(x)):
print(i)

Write the syntax and semantics of the multiway-ifstatement. (3)


Explain the concepts namespace, scope, and lifetime in the case of Pyhon (3)
programming language.
What are mutable and immutable properties in the case of Python data (3)
structures? Give one example each for mutable and immutable data structures in

$rthon.
5 What are the attributes of a turtle object? (3)
6 What are the advantages of GUI based programs over terminal based programs. (3)
7 What is meant by abstraction mechanism in programming? Give one example (3)
abstraction mechanism in Pvthon.
8 Explain the terms accessors and mutators with regard to Python class definition. (3)
9 Write a Python code that checks to sed if a file with the given pathname exists (3)
on the disk, before attempting to open a file for input.
l0 What is Flask in Python? What are its basic components? (3)
PART B
Answer onefull question from eoch module, each carries 14 marks.
Module I
ll a) 2 (7)
Write a Python program to find the roots of a quadratic equation, ax * bx * c:
0 . Consider the cases of both real and imaginary roots.

Page 1of4
0300csr3620s2203

b) Write a Python program to check whether a number is Armstrong number or not. (7)
t,h
An Armstrong number is an n-digit number that is equal to the sum of the n

powers of its digits.

3334444
Examples:153:l +5 +3 ,1634: I +6 +3 +4
OR
12 a) Write a Python program to display the sum of odd numbers between a (7)

programmer specified upper and lower limit.

b) (7)

d* * l*r_t_-t+{+{+
'r"'21.';l! '4!
Given the value of x, write a Python program to evaluate the following series upto
n terns:
Module II
13 a) Write a Python program to implement Caesar cipher encryption and decryption (7)
on a string of lowercase letters. Take distance value and the string as input. (Hint:

Caesar cipher encryption strategy replaces each character in the plaintext with the

character that occurs a given distance away in the sequence.

Encryption:Eg. input: 3, "invade", Eg. output: "lqydgh"


Decryption: Eg. input: 3, "lqydgh", Eg. output: "invade")
r b) Write a Python code segment that opens a file for input and prints the number of (7)
four-letter words in the file.
OR
14 a) Write a Python program to create a set of functions that compute the mean, (7)
' median and mode of a set of numb-ers* Each function should expect a list of
numbers as an argument and return a single number. Each function should return
0 if the list is empty. Include a main function that tests the three functions with a
given list.
( Hint: Mean: Mean is the average value of a list of numbers.

Median: If the number of values in a list is odd, the median of the


list is the value at the midpoint when the set of numbers is sorted; otherwise, the
median is the average of the two values surrounding the midpoint.
Mode: The rnode of a list of values is the value that occurs most frequently)

Page2of 4
.J

0300csT362052203

b) Write a Python program to check whether a list contains a sublist. (7)


Eg. Input I : my_list : f3,\5,2,7,8], sub_list : f2,71
output l: True
input 2: my_list :13,4,5,2,7,8] , sub_list: f5,7f
output 2: False
Module III
- 15 a) Write a Python program to draw a hexagon and to fill it with red colour. Explain (7)
the turtle methods used in it.
b) Write a python program to convert a colour image to black and white image. (7)
Explain the image methods used in it.
OR
16 a) Write a GUl-based program that allows the user to convert amount in Indian (10)

Rupees to amount in Euro.

The interface should have labeled entry fields for these two values. These
components should be arranged in a grid where the labels occupy the first row
and the corresponding fields occupy the second row.

At start-up, the Rupees field should contain 0.0, and the Euro field should contain
0.0. The third row in the window contains two command buffons, labeled R->E
and E->R. When the user presses the first buffon, the program should use the data

in the Rupee field to compute the amount in Euro, which should then be output
to the Euro field. The second button should perform the inverse function.
t b) What are the attributes of a window? How the affribute's value can be changed? (4)
Module IV
17 a) Write a Python program to define a class Rectangle with parameters height, width (7)
and member functions to find area, and perimeter of it.
ft
b) Illustrate how inheritance and polymoiphiin can be implemented in Python. (7)
OR
l8 a) Create a Student class and initialize it with name and roll number. (7)
Make methods to :

l. Display - Display all informations ofthe student.

2. setAge - Assign age to student


3. setTestMarks - Assign marks of a test to the student.
b) What are exceptions? How does Python catch it? Illustrate the usage. (7)

Page 3of4
a

0300csT362052203

Module V
lg a) Consider the followintwo-dimensional array name d arr2d (g)
fll,2,3l,
14,5,6f,
[7,9,9])
Write the output of following Python Numpy expressions:
l. an2dl:21
2. an2df:2,l:)
3. an2dll,:21
4. an2df:Z,1:l = 0
b) Write Python program to write the following University topper data of CSE (6)
branch to a CSV file.

Reg. No. Name Sernester College CGPA


ABCI"23 Ganesh Kumar S8 ABC 9.8
ECH265 John Mathew S7 ECH 9.9
FET345 Reena K S6 FET 9.7
GMT734 AdiI M S5 GMT 9.75

OR
| 20 a) Write a Pandas program to read a CSV file named 'Diamond.csv' with fields (4)
carat, cttt, color, clarity, depth, and price and to print the following:
l. Number of rows and columns
2. First five rows
fl
b) Temperature('c) on different dates is+tured in a csv file as (10)
'Weather_data.csv' with the fields date, temperature and humidity.
l.Draw a plot of the weather report with date as the x-axis and temperature as
the y-axis.

- 2. .Draw a scatter plot of the weather report with date as the x-axis and humidity
as the y-axis.
Give appropriate titles and labels in the plot.
{.***

Page 4of 4

You might also like