lOMoARcPSD|30613263
Python Question Bank
Introduction to python programming (Visvesvaraya Technological University)
Scan to open on Studocu
Studocu is not sponsored or endorsed by any college or university
Downloaded by Dr. Reshma M (
[email protected])
lOMoARcPSD|30613263
SJM Vidyapeetha®
S J M INSTITUTE OF TECHNOLOGY
(Recognized by AICTE, New Delhi and Affiliated to Visvesvaraya Technological University, Belagavi )
NH-4 Bypass, P.B.No:73, CHITRADURGA -577502, Karnataka State
NAAC Accredited with B++ Grade
Question Bank
Introduction to Python Programming (BPLCK205B)
MODULE-1
1 What are the features of Python?
2 Explain the order of precedence of operators used in Python.
3 Explain the most common data types used in Python with examples.
4 Explain string concatenation and replication with examples.
5 What is an identifier? What are the rules for an identifier? Give examples.
6 Explain print() and input() functions in Python with examples.
7 Explain if, if-else, if-elif statements with flowchart and examples in Python.
8 Explain while loop and for loop with examples in Python.
9 Explain break and continue statements with examples in Python.
10 Explain how functions are defined in Python. Write a program to find factorial of a given
number using functions.
11 Explain with examples, local and global scope of variables in Python.
12 a) Develop a program to read the student details like Name, USN, and Marks in three
subjects. Display the student details, total marks and percentage with suitable messages.
b) Develop a program to read the name and year of birth of a person. Display whether the
person is a senior citizen or not. (Lab)
13 a) Develop a program to generate Fibonacci sequence of length (N). Read N from the
console.
b) Write a function to calculate factorial of a number. Develop a program to compute
binomial coefficient (Given N and R) (Lab).
MODULE-2
14 What is a list? Lists are mutable, Justify the statements with example.
15 Explain the concept of list slicing and list traversing with examples.
16 Show with example, how one list containing another list can be accessed using multiple
indexes.
17 Demonstrate how to Change Values in a List using Indexes.
18 With an example how would you explain Negative indexing.
19 Demonstrate how to Remove values from Lists with del Statement.
20 Explain list Concatenation and list Replication with examples.
21 Explain with example, the in and not in Operators wrt lists.
22 Explain Augmented Assignment Operators.
23 What is a method? List and explain the 4 useful methods used with lists in Python
24 Read N numbers from the console and create a list.
Develop a program to print mean, variance and standard deviation with suitable messages.
(Lab)
25 Read a multi-digit number (as chars) from the Console. Develop a program to print the
frequency of each digit with suitable message. (Lab).
26 Read a multi-digit number (as chars) from the console. Develop a program to print the
frequency of each digit with suitable message. (Lab).
lOMoARcPSD|30613263
SJM Vidyapeetha®
S J M INSTITUTE OF TECHNOLOGY
(Recognized by AICTE, New Delhi and Affiliated to Visvesvaraya Technological University, Belagavi )
NH-4 Bypass, P.B.No:73, CHITRADURGA -577502, Karnataka State
NAAC Accredited with B++ Grade
MODULE-3
27 Explain indexing and slicing wrt to strings.
28 How in and not in operators are used with strings? Give examples.
29 Explain upper( ), lower( ), isupper( ), and islower( ) String Methods with examples.
30 Explain isX string methods used for strings with examples.
31 Explain join( ) and split( ) String Methods with examples.
32 Explain Justifying Text with rjust( ), ljust( ), and center( ) string methods with examples..
33 Explain Removing Whitespace with strip( ), rstrip( ), and lstrip( ) string methods with
examples.
34 Explain Copying and Pasting Strings with the pyperclip Module.
35 Explain the functions provided by os.path module with examples.
36 Explain the three steps to reading or writing files in Python.
37 How would you explain three os.path module that provides functions to check whether a
given path exists or whether it is a file or folder?
38 Explain in detail how to Save Variables with the shelve Module.
39 Show how Saving Variables with the pprint.pformat() Function.
40 Develop a program to print 10 most frequently appearing words in a text file. [Hint: Use
dictionary with distinct words and their frequency of occurrences. Sort the dictionary in the
reverse order of frequency and display dictionary slice of first 10 items] (Lab).
MODULE-4
41 How would you explain copying files and folders using shutil module
42 Explain with example how Moving and Renaming Files and Folders using shutil
module.
43 Explain with following with example.
1. Safe Deletes with the send2trash Module.
2. Permanently Deleting Files and Folders.
44 What is zip file? How would you explain reading zip file and Extracting from ZIP Files.
45 How would you explain Walking a Directory Tree with example?
46 Develop a program to backing Up a given Folder (Folder in a current working directory) into
a ZIP File by using relevant modules and suitable methods. (Lab).
47 Develop a program to sort the contents of a text file and write the sorted contents into a
separate text file. (Lab).
48 Write a function named DivExp which takes TWO parameters a, b and returns a value c
(c=a/b). (Lab).
MODULE-5
49 Define class? How do we define class? How to instantiate the class and members are
accessed?
50 What is pure function? Illustrate the same with example.
51 Explain the concept of polymorphism with suitable example.
52 Explain _init_ method and str method with example.
53 Discuss the type-based dispatch in python.
54 With general syntax explain Operator overloading with example code.
lOMoARcPSD|30613263
SJM Vidyapeetha®
S J M INSTITUTE OF TECHNOLOGY
(Recognized by AICTE, New Delhi and Affiliated to Visvesvaraya Technological University, Belagavi )
NH-4 Bypass, P.B.No:73, CHITRADURGA -577502, Karnataka State
NAAC Accredited with B++ Grade
55 Write short notes on.
1. Objects are mutable.
2. Class Attributes.
3. Printing objects
4. Modifiers
56 Define a function which takes TWO objects representing complex numbers and returns new
complex number with a addition of two complex numbers. (Lab).
57 Develop a program that uses class Student which prompts the user to enter marks in three
subjects and calculates total marks, percentage and displays the score card details. (Lab).
58 Write a program using function find_center() to compute center point of the
rectangle a function resize() to modify the size of rectangle.
Faculty Signature