0% found this document useful (0 votes)
60 views6 pages

Question Bank

The document is a question bank for the subject 'Introduction to Python Programming' at Vidya Vikas Institute of Engineering & Technology, Mysuru. It includes various questions and programming tasks across multiple modules, covering topics such as control flow statements, functions, data structures, string handling, file operations, and object-oriented programming. Each module contains questions with specified marks, focusing on practical programming skills and theoretical understanding of Python.

Uploaded by

aqsaasheik727
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)
60 views6 pages

Question Bank

The document is a question bank for the subject 'Introduction to Python Programming' at Vidya Vikas Institute of Engineering & Technology, Mysuru. It includes various questions and programming tasks across multiple modules, covering topics such as control flow statements, functions, data structures, string handling, file operations, and object-oriented programming. Each module contains questions with specified marks, focusing on practical programming skills and theoretical understanding of Python.

Uploaded by

aqsaasheik727
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/ 6

VIDYA VIKAS INSTITUTE OF ENGINEERING & TECHNOLOGY

MYSURU
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
QUESTION BANK
Subject: Introduction to Python Programming
Subject Code: BPLCK205B

Q.no Module : 1 Marks


1 a) With Python programming examples to each, explain the syntax and 08
control flow diagrams of break and continue statements.
b) Explain TWO ways of importing modules into application in Python
with syntax and suitable programming examples. 06
c) Write a function to calculate factorial of a number. Develop a
program to compute binomialcoefficient (Given N and R) 06
2 a) Explain looping control statements in Python with a syntax and 06
example to each. 04
b) Develop a Python program to generate Fibonacci sequence of length
(N). Read N from the console.
c) Write a function named DivExp which takes TWO parameters a, b 06
and returns a value c (c=a/b). Write suitable assertion for a>0 in
function DivExp and raise an exception for when b=0. Develop a
Python program which reads two values from the console and calls a
function DivExp.
d) Explain FOUR scope rules of variables in Python. 04
3 a) What is the need for role of precedence? Illustrate the rules of 06
precedence in Python with example.
b) Explain the local and global scope with suitable examples. 06
c) Develop a program to generate Fibonacci sequence of length (N).
Read N from the console 08
4 a) What are functions? Explain Python function with parameters and 07
return statements.
b) Define exception handling. How exceptions are handled in python? 07
Write a program to solve divide by zero exception.
c) Develop a python program to calculate the area of rectangle and
triangle print the result. 06
5 a) Explain Local and global variable and scope of variable in python. 07
b) List and explain with example different comparison and Boolean 08
operators
c) Write a python program to generate Fibonacci sequence of length 'n'. 05
6 a) List and explain with syntax and example the flow control statement 10
in python.
b) Demonstrate with example print(), input() and string replication 06
function in python.
c) Develop a program to read the name and year of birth of a person.
Display weather person is senior citizen or not? 04
7 a) Explain string concatenation and string replication operation with an 06
example.
b) Illustrate the use of break and continue with example. 08
c) Write a Python program to check whether the given number is
positive, negative or zero. 06
VIDYA VIKAS INSTITUTE OF ENGINEERING & TECHNOLOGY
MYSURU
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
QUESTION BANK
Subject: Introduction to Python Programming
Subject Code: BPLCK205B

8 a) What are functions in Python and how they are defined and used to 06
modularize code?
b) Explain the local and global scope with local and global variables. 08
c) Write a program to generate Fibonacci sequence of length (N). Read 06
from console.
9 a) Demonstrate with example print(), input() and format (). 05
b) Explain conditional branching statements with syntax and write a
suitable 7 program for the same. 07
c) Write a python program to check whether a given number is
Armstrong or not. [Hint-An Armstrong number is any number of n 08
digits which is equal to the sum of n" power of digits in the number.
For example, 371 is an Armstrong number since 3*3+73+1*3=371]
10 a) Write a python program to guess the secret number between 1 to 25 08
within 5 guess if the number is same then it is right guess else wrong
guess. 06
b) What are user defined function? How can we pass the arguments to
the functions? Explain with suitable example
c) What are comparison and Boolean operators? List all the comparison 06
and Boolean operators in python.

Q no Module 2 Marks
1 a) Explain with a programming example to each: 06
(i) get()
(ii) setdefault()
b) suitable Python programs with nested lists to explain 08
copy.copy( ) and copy.deepcopy( ) methods.
c) Explain append() and index() functions with respect to lists in
Python. 06
2 a) Explain different ways to delete an element from a list with 10
suitable Python syntax and programming examples.
b) Read a multi-digit number (as chars) from the console. Develop a
program to print the frequency of each digit with suitable message. 06
c) Tuples are immutable. Explain with Python programming
example.
04
3 a) What is a list? Explain append(), insert(),and remove methods with 10
examples.
b) Explain the methods of list data types in python for the following
operations with suitable code snipper for each 10
i) Adding values to list
ii) Remaining value from list
iii) Finding a value in a list
VIDYA VIKAS INSTITUTE OF ENGINEERING & TECHNOLOGY
MYSURU
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
QUESTION BANK
Subject: Introduction to Python Programming
Subject Code: BPLCK205B

iv) Sorting the value in a list


v) Reversing a value in list
4 a) Explain get(), item(), keys() and values() methods of dictionary in 08
python.
b) How is tuple different from list? Which function is used to convert 07
list to tuple?
c) Differentiate between list and dictionary. 05
5 a) What are lost in python and how they are used to store and 06
manipulate collection of data?
b) Explain any four built-in methods available for working with lists? 08
c) Read N numbers from console and create a list.Develop a program
to print the mean of numbers? 06
6 a) Differentiate between lists and dictionary? 06
b) Explain with examples keys(),values(),and items() method? 08
c) Write a program to add elements into dictionaries using while
loop. 06
7 a) What are lists in Python and how they used to store and manipulate 06
collections of data.
b) Explain any four built-in methods available for working with lists. 08
c) Read N numbers from console and create a list. Develop a program
to print the mean of number
06
8 a) Differentiate between lists and dictionary. 06
b) Explain with example keep(), values() and items() methods. 08
c) Write a program to add elements into dictionary using while loop 06
9 a) Explain the methods of list data types in python for the following 08
operation with suitable code snippets for each.
i) Adding values to a list
ii) Removing values from a list
iii) Finding a value in a list
iv) sorting the values in a list
b) Explain the concept of list slicing and list traversing with an 06
example.
c) What is a dictionary? Write a python program to count occurrences
of characters in a string and print the count. 06
10 a) Write a python program that find the missing number from the 10
given a list n-1 numbers ranging from to n. There are no
duplicates (Hint-eg: Input 1 2 4 6 3 7 8, output:5
b) How is triple different from list()? Explain with example the 06
function used to convert list into triple and triple into list.
c) Explain insert() and remove() methods of list with example 04
VIDYA VIKAS INSTITUTE OF ENGINEERING & TECHNOLOGY
MYSURU
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
QUESTION BANK
Subject: Introduction to Python Programming
Subject Code: BPLCK205B

Q no Module 3 Marks
1 a) Explain Python string handling methods with examples: 10
split(),endswith(), ljust(), center(), lstrip()
b) xplain Python string handling methods with examples: join(),
startswith(),rjust(),strip(), rstrip() 10
2 a) Explain any five built-in methods available for working with 10
strings along with example.
b) Explain the syntax and example various string methods. 07
3 a) Write any five built-in methods available for working with strings 10
along with example.
b) Write a program to make a new string with all the consonant
eliminated from the string read from the user.[Hint:For
example,Input:Hello,have a good day. Output:Hll hv gd dy] 07
c) Write a python program that accept a sentence and find a number
of words,digits,upper case letter and lower case letters. 07
4 Explain the file reading and writing process with suitable python program.
5 With code snippet explain saving variables using shelve module and
print() and print.format() functions.
6 Write a python code to implement multiclip board project in python.
7 Write a python program that accepts a sentence and find the number of
words, digits, upper case letters and lower case letters.
8 Write a program to make a new string with all the consonants eliminated
from the string read from the user[Hint: input - Hello, have a good day,
output - Hll, hv gd dy ]
9 Differentiate between absolute and relative path in specifying file paths.

Q no Module 4 Marks
1. a) What is meant by compressing Files? Explain reading, extracting 10
and creating ZIP files with an example
b) Define assertions. What does an assert statement in python 5
consists of? 5
c) How does OS.walk() work in python?
2. a) Discuss the basicConfig() method to configure the lagging with an 7
example
b) Write a program to depict Raising Exception 7
c) Explain the functions of Shutil module with example. 6
3. a) Explain the functions of shutil module with examples. 10
b) What is meant by compressing files? Explain reading, extracting 10
and creating ZIP files with code snippet
4. a) Explain the buttons in the Debug control window 10
b) Write a note on raising exception. 10
5. a) Explain the functions of shutil module with example 10
VIDYA VIKAS INSTITUTE OF ENGINEERING & TECHNOLOGY
MYSURU
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
QUESTION BANK
Subject: Introduction to Python Programming
Subject Code: BPLCK205B

b) What is meant by compressing files? Explain reading, extracting 10


and creating zip files with code snippet.
6. a) Explain the following file operation in python with example 6
(i) Copying files and folders
(ii) Moving files and folders
(iii)Permanently deleting files and folders
b) Define assertions. What does an assert statement in python 7
consists of? Give an example
c) Develop a program to sort contents of a text file and write the 7
forted content into a separate file.
7. a) List out the benefits of compressing file? Also explain reading of a 8
zip file with an example
b) List out the differences between shutil.copy() and shutil.copytree() 6
method
c) Briefly explain assertions and raising a exception 6
8. a) List out the benefits of using logging module with an example 4
b) Develop a program with a function named DivExp which takes 8
two parameters a,b and returns a value C(C=a/b).Write suitable
assertion for a>0 in function DivExp and raise an exception for
when b=0.Develop a suitable program which leads two values
from the console and calls a function DivExp
c) Explain permanent delete and safe delete eith a suitable with 8
python programming example to each.
9. a) Develop a program to backing Up a given Folder(Folder in a 10
current working directory)into a ZIP File by using relevant
modules and suitable methods.
b) Explain the role of Assertions in Python with a suitable program 10
10. a) Explain the functions with examples: 6
(i) shutil.copytree()
(ii) shutil.move()
(iii)Shutil.rmtree()
b) Develop a Python program to traverse the current directory by 6
listing sub-folders and files.
c) Explain the support for Logging with logging module in python 8

Q no Module 5 Marks
1. Differentiate between class, static and instance method. 6

2. Define class and objects in python. Create a class called employee and 9
initialize it with employee id and name . Design method to:
I. Set age- to assign age to the employee
VIDYA VIKAS INSTITUTE OF ENGINEERING & TECHNOLOGY
MYSURU
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
QUESTION BANK
Subject: Introduction to Python Programming
Subject Code: BPLCK205B

II. Set salary - to assign salary to the employee


III. Display - to display all information of the employee.
3. Explain __init__ and __str__ method with an example. 12
4. Discuss operator overloading. Discuss any five operators with respective 10
special functions to be overloaded in python.
5. Write a program to explain pure functions and modifiers in python. 10
6. List and explain any four object oriented characteristics possessed by the 8
python.
7. Explain operator overloading and polymorphism with example. 8
8. Discuss type based dispatch in python. 6
9. How class can be instantiated in python? Write a python program to 6
instances as return values to define a class RECTANGLE with member
width, height, cornerX, cornerY and member function to find center area
and perimeter of a rectangle.
10. Write a program to implement polymorphism in python using method 7
overriding.

********

You might also like