You are on page 1of 1

COMPUTER SCIENCE & ENGINEERING

OPEN ELECTIVE - I
PYTHON PROGRAMMING [CSE 4309]
23.06.2020

Q1A. Write single python statement to do each of the following:


a) Define a constructor with one argument length for a class named Square
b) Given a file object fobject, change its current file position to 10 bytes from the end of
the file.
c) Give the regular expression pattern using raw strings to search for a single
backslash followed by the letters max in a given string.
(3M)

Q1B. Write a python program to create a GUI with a grid layout of 2x2 as shown in Figure
below. The topmost row of grids should contain buttons while the lowermost grids contain
labels. The buttons should be named as “ONE” and “TWO”. The labels should contain the
text “HELLO” and “WORLD”. (2M)

Q2A. Assume that the file “Sample.txt” has several lines with each line containing phone
number. A phone number begins with two-digit country code followed by hyphen followed
by ten digits. Write a program in python to read the above file and print all the lines
containing Indian phone numbers (prefix +91). A sample input and expected output is
shown below: (3M)

Q2B. Give the steps of creating a GUI application using tkinter in Python. (2M)

Q3A. Define a class Student consisting of instance variables (private) { name, age and
gender }, a method { printData() } and constructor to initialize its instance variables using
default arguments. Derive a class StudentResult from Student. The class StudentResult
consists of an instance variable (private) {grade}, a method { printResult() } and a
constructor. Create an instance of StudentResult class and display the student basic
information along with result. (3M)

Q3B. Given a text file “Sample.txt”, write a python script to read and display every line in the
file and print the count of total number of lines in the file. (2M)

You might also like