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

Introduction To Python Programming 20ADO01

Python questions

Uploaded by

Saikrishna
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)
17 views

Introduction To Python Programming 20ADO01

Python questions

Uploaded by

Saikrishna
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/ 2

Code No.

: 20ADO01
CHAITANYA BHARATHI INSTITUTE OF TECHNOLOGY (Autonomous)
B.E. VII Sem (Main) Examination Nov – Dec 2023
Introduction to Python Programming
(Common to Civil, Mech & ECE)
Time: 3 Hours Max Marks: 60
Note: Answer ALL questions from Part-A & Part –B (Internal Choice) at one place in the
same order
Part - A
(5Q X 3M = 15 Marks)
M CO BT
1 What is the difference between interactive mode and script mode? (3) 1 1
2 Write a for loop that prints numbers from -17 to 0, using range function. (3) 2 3
3 What are the features of tuple data structure? (3) 3 1
4 Define namespace. How to create a namespace in python? (3) 4 2
5 List any three modules available in tkinter package with their purpose. (3) 5 2

Part – B
(5Q X 9M = 45 Marks)
M CO BT
6 (a) Write a Python program that reads four integers from user, prints them (5) 1 3
with a single print statement, without any space or newline
between/after the values.
(b) Explain about rules for identifiers with examples. (4) 1 2
(OR)
7 (a) Write a Python function that accepts a string and counts the number of (5) 1 3
upper and lower case letters.
(b) Explain the Programming Steps in Python with an example. (4) 1 2

8 (a) Write a python script to find second maximum of given four numbers (5) 2 3
without using built-in functions.
(b) Write a python script to print the following pattern for the given (4) 2 3
number of lines?
****
***
**
*
(OR)
9 (a) Write a python program to find second maximum from the given list (5) 2 3
of integers by comparing elements only once and without using built-
in methods.
(b) Write a python script to check whether the given number is prime or (4) 2 3
not.

10 (a) What is an exception? Explain how an exception can be handled in (5) 3 2


python with suitable examples.
(b) Explain the List Accessing Methods and List Comprehension. (4) 3 2
(OR)
Page 1 of 2
Code No.: 20ADO01
11 (a) What is a list in Python? How to create nested lists? Demonstrate how (5) 3 3
to create and print a 3-dimensional matrix with lists.
(b) Write a Python function that takes a list and returns a new list with (4) 3 3
distinct elements from the given list.

12 (a) Stack is a data structure where we can perform push (insert) and pop (5) 4 3
(delete) operations in Last-In First-Out (LIFO) manner. Write a Python
program to create a class representing this data structure which
contains methods for inserting and deleting elements.
(b) How a floating point number is represented internally? Discuss about (4) 4 2
any 2 issues present in floating point arithmetic with examples.
(OR)
13 (a) Write a Python program to create and display all combinations of (5) 4 3
letters, selecting each letter from a different key in a dictionary.
Sample data : {'1':['x','y'], '2':['a','b']}
Sample Output:
xa
xb
ya
yb
(b) Write an “abstract” class, Box, and use it to define some methods (4) 4 3
which any box object should have: add, for adding any number of
items to the box, empty, for taking all the items out of the box and
returning them as a list, and count, for counting the items which are
currently in the box. Write a simple Item class which has a name
attribute and a value attribute – you can assume that all the items you
will use will be Item objects. Now write two subclasses of Box which
use different underlying collections to store items: ListBox should use
a list and DictBox should use a dict.

14 (a) Write a python script to depict the usage of Separator widget in (5) 5 2
tkinter package.
(b) What is the use of turtle graphics? Write a sample program to illustrate (4) 5 3
it.
(OR)
15 (a) By using tkinter package write a basic web browser. It should have a (5) 5 3
Text widget where the user can enter a URL and a Canvas to display
the contents of the page.
(b) Write the syntax and usage of the following methods with respect to (4) 5 2
ttk module.
(i) Treeview (ii) Notebook (iii) Sizegrip
******

Page 2 of 2

You might also like