Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
5 views

Python Programming 18ITO02

Python questions

Uploaded by

Saikrishna
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Python Programming 18ITO02

Python questions

Uploaded by

Saikrishna
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Code No.

: 18ITO02
CHAITANYA BHARATHI INSTITUTE OF TECHNOLOGY (Autonomous)
B.E. (ECE) VII Sem (Main) Examination December 2021
Python Programming
Time: 3 Hours Max Marks: 70
Note: Answer all questions from Part - A and Part – B at one place in the same order.

Part – A (20 Marks)


M CO BT
1 What is the syntax for the range function? Give the code snippet to (2) 1 1
display the even numbers between 1 to 30 using range function.
2 Explain how short-circuit evaluation works with the ‘and’ and ‘or’ (2) 1 2
operators.
3 Define global variables and give example. (2) 2 1
4 Differentiate between keyword arguments and positional arguments. (2) 2 3
5 Explain serializing objects. (2) 3 2
6 Compare and contrast lists and tuples data structures. (2) 3 2
7 “One of the benefits of OOP is object reusability”. Justify this (2) 4 4
statement.
8 Differentiate between match() and search() functions in regular (2) 4 4
expressions.
9 How to create radio button. (2) 5 1
10 Explain line and scatter plot. (2) 5 2

Part – B (50 Marks)


M CO BT
11 (a) What is IDLE? Explain in detail how to write a python program (5) 1 2
in IDLE.
(b) Demonstrate string comparison with examples (5) 1 2
(OR)
12 (a) When to prefer if-elif-else statement over nested if-else? Write a (5) 1 3
program for simple calculator using if-elif-else statement.
(b) Explain in detail repetition structures in python (5) 1 2

13 (a) Assume you have a module called fact_fib, consists of two (5) 2 3
functions called fact() and fib(). Write a program to calculate the
factorial of given number by importing only fact() from the
above module.
(b) Explain opening and closing files. (5) 2 2
(OR)
14 (a) Where are random numbers useful? Explian the following (5) 2 2
functions
(i) randrange() ii) random() iii) uniform()
(b) Assume you have two files containing sorted numbers. Write a (5) 2 3
program to merge these two files into third file which must be in
sorted order.
Page 1 of 2
Code No.: 18ITO02

15 (a) Discuss any five list methods along with examples (5) 3 2
(b) Write a program to check whether sub string is exiting in main (5) 3 3
string or not. If the sub string does not exist print the same
message. If the sub string exists, then:
i. If it is alphanumeric, print that it is alphanumeric
ii. If it is in lowercase convert into uppercase and vice versa.
(OR)
16 (a) Write a program that reads the contents of a text file and display (5) 3 3
the count of individual words. The program should create a
dictionary in which the keys are the individual words found in
the file and the values are the number of times each word
appears.
(b) Explain the following set operations using examples (5) 3 2
i) union ii) intersection
iii) difference iv) symmetric difference

17 (a) Design a class that holds the following personal data: name, (5) 4 3
address, age, and phone number. Write appropriate accessor and
mutator methods. Write a program that creates three instances of
the class. One instance should hold your information, and the
other two should hold your friends’ or family members’
information.
(b) Explain about handling multiple exceptions with an example. (5) 4 2
(OR)
18 (a) Differentiate between procedure and object oriented (5) 4 4
programming.
(b) Briefly explain special characters in regular expressions with (5) 4 2
examples.

19 (a) Briefly describe each of the following tkinter widgets: (5) 5 2


i) Label ii) Entry iii) Button iv) Frame v) Canvas
(b) Discuss in detail plotting data contained in files with (5) 5 2
example.
(OR)
20 (a) Write a GUI program that converts Celsius temperatures to (5) 5 3
Fahrenheit temperatures. The user should be able to enter a
Celsius temperature, click a button, and then see the equivalent
Fahrenheit temperature. Note: F= (9/ 5)* C+ 32
(b) Explain in details box plot, bar plots, Histograms. (5) 5 2
******

Page 2 of 2

You might also like