0% found this document useful (0 votes)
8 views

QB_Slow_Learners

The document outlines a comprehensive question bank for an Introduction to Python Programming course, divided into five modules covering topics such as Python basics, functions, dictionaries, file handling, and object-oriented programming. Each module includes theoretical questions and practical laboratory programs designed to enhance students' understanding and application of Python concepts. The course is coordinated by Dr. Sreenivasa B R at Bapuji Institute of Engineering and Technology, Davanagere.
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)
8 views

QB_Slow_Learners

The document outlines a comprehensive question bank for an Introduction to Python Programming course, divided into five modules covering topics such as Python basics, functions, dictionaries, file handling, and object-oriented programming. Each module includes theoretical questions and practical laboratory programs designed to enhance students' understanding and application of Python concepts. The course is coordinated by Dr. Sreenivasa B R at Bapuji Institute of Engineering and Technology, Davanagere.
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/ 5

Bapuji Educational Association®

Bapuji Institute of Engineering and Technology, Davanagere


An Autonomous Institute Affiliated to VTU
Introduction to Python Programming (24CSPLC15B/24CSPLC25B)

Module -1: Question Bank


Chapters: Python Basics and Flow Control
Sl. Question RBT COs
No
1. List and explain math operators used in Python. Explain the need for precedence and L2 1
associativity in Python with suitable examples.

What do the following expressions evaluate to?


i. (5-1) * ( (7+1) / (3-1)) ii. (5 > 4) and (3 == 5)
iii. (5 > 4) or (3 == 5) iv. not ( (5 > 4) or (3 == 5) )

2. With syntax and examples, explain print ( ), input ( ), len ( ), and string replication functions L2 1
3. What are variables? Explain the rules to be followed while defining a variable with valid and L2 1
invalid examples.
4. Demonstrate different types of operators available in Python with proper examples. L2 1
5. Explain if, elif, and else statements in Python with syntax, flowchart and program snippets. L2 2

6. Explain looping control statements with syntax, flow diagrams and program snippets. L2 2

7. Demonstrate the working of break and continue statements with programming examples for L2 2
each.
8. Explain different ways of importing modules into applications in Python with syntax and L2 2
suitable programming examples.
Laboratory Programs
9. Write a function to calculate the factorial of a number. Develop a Python program to compute L2 2
the binomial coefficient. Read N and R from the console.
10. Develop a program to read a person's name and year of birth and print whether the person is a L2 2
senior citizen or not.
11. Develop a program to generate a Fibonacci square of length (N). Read N from the console. L2 2

Course Instructor Course Coordinator DAAC Coordinator HOD

Dr. Sreenivasa B R, Professor, Dept of CS&D, BIET, Davangere.


Bapuji Educational Association®
Bapuji Institute of Engineering and Technology, Davanagere
An Autonomous Institute Affiliated to VTU
Introduction to Python Programming (24CSPLC15B/24CSPLC25B)

Module -2: Question Bank


Chapters: Functions and Lists
Sl. Question RBT COs
No
1. Explain the local and global scope with suitable examples L2 1
2. What are user-defined functions? How can we pass parameters in user-defined functions? L2 2
Explain with a suitable example.
3. Demonstrate Python functions with parameters, return values and return statements. L2
4. Define exception handling. How are exceptions handled in Python? Write a function named L2 2
DivExp, which takes TWO parameters, a and b and returns a value c (c=a/b). Write a suitable
assertion for a>0 in the function DivExp and raise an exception for when b=0. Develop a
Python program that reads two values from the console and calls a function DivExp.
5. Illustrate negative indexing, slicing, index( ), append ( ), remove( ), insert( ) , reverse() and L2 3
sort( ) with suitable examples.
6. Differentiate tuples and lists with proper examples. L2 3

7. Demonstrate the copy modules’ copy( ) and deepcopy( ) functions with suitable examples. L2 3

8. How is a tuple different from a list, and which functions are used to convert a list to a tuple L2 3
and vice versa?
Laboratory Programs
9. Read N numbers from the console and create a list. Develop a program to compute and print L2 3
mean, variance and standard deviation with suitable messages.
10. Develop a Python program to swap cases of a given string (Input: Java Output: jAVA) L2 3

11. Read a multi-digit number (as chars) from the console. Develop a program to print the L2 3
frequency of each digit with a suitable message.
12. Write a Python program to print even and odd numbers separately using step size in range ().

Course Instructor Course Coordinator DAAC Coordinator HOD

Dr. Sreenivasa B R, Professor, Dept of CS&D, BIET, Davangere.


Bapuji Educational Association®
Bapuji Institute of Engineering and Technology, Davanagere
An Autonomous Institute Affiliated to VTU
Introduction to Python Programming (24CSPLC15B/24CSPLC25B)

Module -3: Question Bank


Chapters: Dictionaries and Manipulating Strings
Sl. Question RBT COs
No
1. Explain the following methods with suitable examples: L2 3
i. keys () ii. values () iii. items ()
2. Demonstrate the working of get() and setdefault() methods L3 3
3. Differentiate lists and dictionaries with suitable examples. L3 3
4. Demonstrate in and not in operators with strings. L3 3
For a=[‘hello’, ‘how’, [1,2,3], [[10,20,30]]], What is the output of the following statement?

(i) print(a[ : : ] ) (ii) print(a[-3][0]) (iii) print(a[2][ : -1]) (iv) print(a[0][ : : -1]).
5. Demonstrate the working of the following string methods L2 3
i. upper( ) ii. lower( ) iii. isupper( ) iv. islower( )
6. Demonstrate the working of isX string methods. L2 3

7. Demonstrate the working of the following string methods L2 3


i. startswith() ii.endswith() iii.join() iv. split()
8. Explain the different string methods used to remove whitespaces in Python. L2 3

Laboratory Programs
9. Develop a Python program to count the frequency of characters using the module PPrint L3 3
(Pretty Printing).
10. Develop a program to print t h e 10 most frequently appearing words in a text file. [Hint: L2 3
Use a dictionary with distinct words and their frequency of occurrences. Sort the dictionary
in the reverse order offrequency and display the dictionary slice of the first 10 items]
11. Develop a program to sort the contents of a text file and write the sorted contents into a separate L2 3
text file. [Hint: Use string methods strip(), len(), list methods sort(), append(), and file methods
open(), readlines(), and write()].

Course Instructor Course Coordinator DAAC Coordinator HOD

Dr. Sreenivasa B R, Professor, Dept of CS&D, BIET, Davangere.


Bapuji Educational Association®
Bapuji Institute of Engineering and Technology, Davanagere
An Autonomous Institute Affiliated to VTU
Introduction to Python Programming (24CSPLC15B/24CSPLC25B)

Module -4: Question Bank


Chapters: Reading & Writing Files and Working with Excel Spreadsheets
Sl. Question RBT COs
No
1. Explain the concept of file handling. Illustrate with examples opening a file with the open( ) L2 3
function, reading a file with the read( ) function and writing to files with the write( ).
2. Explain the concept of file path. Discuss absolute and relative file paths with suitable L3 3
examples.
3. Explain the saving variables with the shelve Module and pprint.pfromat() function. L3 3
4. Demonstrate how os.path module works with filenames and file paths. L3 3
5. Demonstrate the following operations in Excel spreadsheets with proper examples. L3 3
i. How to convert from column letters to numbers.
ii. Getting Rows and Columns from the Sheets
6. Demonstrate the following operations in Excel spreadsheets with proper examples. L3 3
i. Creating and Saving Excel Documents
ii. Creating and Removing Sheets
7. L2 3

8. L2 3

Laboratory Programs
9. Develop a Python program to find the file size and folder contents in a given input file. L3 3

10. Develop a program to update cells in a spreadsheet of produce sales. L2 3

11. Implement a Python program to perform the following operations on an Excel spreadsheet: L3 3
i. Reading the first 5 rows of all columns
ii. Appending a new row / new column
iii. Delete row/column
iv. To perform aggregate functions

Course Instructor Course Coordinator DAAC Coordinator HOD

Dr. Sreenivasa B R, Professor, Dept of CS&D, BIET, Davangere.


Bapuji Educational Association®
Bapuji Institute of Engineering and Technology, Davanagere
An Autonomous Institute Affiliated to VTU
Introduction to Python Programming (24CSPLC15B/24CSPLC25B)

Module -5: Question Bank


Chapters: Classes and Objects, Classes and Methods, Classes and Methods
Sl. Question RBT COs
No
1. What is a class? How to define a class in Python? How to initiate a class and how the class L2 3
members are accessed.?
2. Define class and object, construct the class rectangle and initialize it with height=100, L3 3
width=200, and starting point as (x=0.0, y=0.0). Write a program to display the center point
coordinates of a rectangle.
3. Write a P ython program to express instances as return values to define a class RECTANGLE L3 3
with members width, height, corner_x. corner_y and member function: to find center, area
and perimeter of a rectangle
4. What is a pure function? Write a Python program to find the duration of an event if the start
and end time are given by defining class TIME.
5. What are Polymorphisms? Demonstrate polymorphism with functions to find a histogram L3 3
to count the number of times each letter appears in a word and in a sentence.
6. Explain the concept of inheritance with an example.

7. Discuss operator overloading. Mention any five operators with respective special functions to L3 5
be overloaded in Python
What is operator overloading? Write Python code to overload “+”, “_“ and “*” operators
by providing the methods _ _add_ _, _ _sub_ _ and _ _mul_ _ .

8. Define pure function and modifier. Demonstrate the role of pure functions and modifiers in L3 5
application development with suitable Python programs.
9. Define instantiation. Describe __init__and __ str__ methods with suitable programming L2 4
examples.
Laboratory Programs
10. Define a function that takes TWO objects representing complex numbers and returns new L3 3
complex numbers by adding two complex numbers. Define a suitable class ‘Complex’ to
represent the complex number.
Develop a program to read N (N >=2) complex numbers and to compute the addition of N
complex numbers.
11. Develop a program that uses class Student, which prompts the user to enter marks in three L2 3
subjects and calculates total marks, percentage and displays the scorecard details.
[Hint: Use a list to store the marks in three subjects and total marks. Use init () method to
initialize name, USN and the lists to store marks and total, Use getMarks() method to read
marks into the list, and display() method to display the scorecard details.]

Course Instructor Course Coordinator DAAC Coordinator HOD

Dr. Sreenivasa B R, Professor, Dept of CS&D, BIET, Davangere.

You might also like