Download as odt, pdf, or txt
Download as odt, pdf, or txt
You are on page 1of 5

Q1.

Attempt any three of the following:

a. Explain the features of Python Programming.


b. What is variable? What are the rules and conventions for declaring a variable?
c. Explain if—else statement with an example.
d. Write a Python program to print factorial of a number. Take input form user.
e. Explain continue statement with an example.
f. Write a Python program to calculate area of triangle and circle and print the result. Take
input from user.

Q2. Attempt any three of the following:

a. Define function. Write syntax to define function. Give example of function definition.
b. What is actual and formal parameter? Explain the difference along with an example.
c. Write a Python program to calculate factorial of given number using recursive function.
d. Discuss the difference between local and global variable.
e. Explain any five basic operation performed on String.
f. Write a Python program to check whether a string is palindrome.

Q3. Attempt any three of the following:

a. What is lists? How to define and access the elements of list?


b. Write a program to input any two tuples and interchange the tuple values.
c. Explain the directory methods in Python.
d. How to create dictionary in Python? Give example.
e. Explain different modes of opening a file.
f. Write a Python program to accept an integer number and use try/except to catch the
exception if a floating point number is entered.

Q4. Attempt any three of the following:

a. What is regular expression? What are different types of regular expression?


b. Explain math module with its any five function.
c. List and explain build in class attributes with example.
d. How to import a module? Explain time module.
e. What is multi-threading? How to create a thread?
f. Design a class that store the information of student and display the same.
Q 5. Attempt any three of the following:

a. Write a Python code to create the following GUI:

o Option 1
o Option 2
o Option 3

b. explain the layout manager in details.


c. write a source code in python create a login screen.

Ch. 1. Introduction to python

1. Why Python is famous? Discuss its features and the domains where it can be used for problem
solving.
2. Discuss any two reasons why people use Python.
3. Python code execution is slower in comparison to C or C++. State True or False and justify.
4. Explain working on Python Virtual machine with suitable diagram.
5. What are Frozen Binaries?
6. What is Integrated Development Environment? Name any two Python IDEs.

Ch. 2. Data Types

1. How append() and extend() are different with reference to list in Python?
2. Differentiate between filter and map in Python using example.
3. Match the pair
Collection Type Description
a. List a. unordered and unindexed.

b. Tuple b. unordered, changeable and indexed

c. Set c. ordered and changeable


d. Dictionary d. ordered and unchangeable.

4. Explain List Comprehension with suitable example.


5. What is String formatting expression? Explain with two suitable examples. i.e. ‘...%s...’ %
(values)
6. Explain List Data Structure. Name any four operations and give suitable example that changes
list in place.
Ans: append, extend, remove, pop, del, sort, reverse
7. Compare List vs Dictionary.
8. Compare Tuple vs List.
9. Explain sequence unpacking wit suitable example.
10. Write a short note on
a. Set
b. Tuple
c. List
d. Dictionary
11. How sorted() can be used with list in Python? Give an example

Control flow, functions, Modules and packages

1. Explain in brief following statements with suitable example.


a. yield
b. import
c. pass
d. del
e. with/as

2. Discuss any 3 forms of Assignment statement.


a. Tuple assignment - spam, ham = 'yum', 'YUM'
b. List assignment - [spam, ham] = ['yum', 'YUM']
c. Sequence assignment - a, b, c, d = 'spam'
d. Extended sequence unpacking - a, *b = 'spam'
e. Multiple-target assignment - spam = ham = 'lunch'
f. Augmented assignment - spams += 42

3. What is an Extended sequence. Give example.


4. Discuss variable naming convention followed in Python.
5. Explain in brief following functions. Example expected.
a. map
b. join
c. range
d. filter
e. reduce

6. Write short note about pass, break and continue. Give example for each of them.
7. Write a program which showcase use of list comprehension with map and without map.
8. How map can be used in Python program? Explain with a suitable example.
9. Write a Python program to find reverse of given number using user defined function.
10. Find output
l=[(x, y) for x in [1,2,3] for y in [3,1,4] if x != y]
print l
11. Write list comprehensions for [3]
a. Write div(n) function which returns sum of positive divisors of given number
b. return a string with vowels removed
c. Finding intersection from two lists
d. x is an alphabet in word ‘MATHEMATICS’, x is a vowel e.
e. Take two list of same length as input and return a dictionary with one as keys and other
as values

Functions and module packages

12. Explain with suitable example different parameter passing techniques in Python.
13. Describe concept of variable length of parameter with suitable example.
14. Explain how pass by reference is achieved in Python.
15. What are scope rules for variables in Python?
16. What is lambda function?
17. Explain Generators with suitable example.
18. Write a note on Modules and Packages. Explain with suitable example
19. Short note on
a. Factory functions
b. Function annotation
20. Python Functions are objects. Justify.

Data Structures

1. Explain Set data structure. Discuss any three mathematical operations supported on set with suitable
example.
2. What is dictionary in Python? Explain with an example.
3. Explain how stack and queues are implemented in Python.
4. Differentiate between tuples and sets based on their mutability, orderedness and uses.
5. How can all keys and values of a dictionary be traversed? Explain with an example.
Ch5. File operations
1. Give the syntax and significance of raw_input() and input() methods.
2. Explain any two file reading operations.
3. What is Object Serialization? Explain use of pickle module in serialization. Code snippet
expected.
4. Explain concept logging. How it is implemented in Python. Code snippet expected.
5. What is ConfigParser.
6. File Program
a. Write a Python program to count the frequency of each word in a file and display the
word and its frequency as output.
b. Write a program which implements following
– SaveList() function to save list contents in a text file.
– LoadList() function which loads saved list content and prints length of the list on
screen.
c. Write a Python program to read a random line from a file and print on screen.
d. Write a Python program to remove newline characters from a file.
e. Read a text file in Python and print no. of lines and no. of unique words.
7. Directory Program
8. Write a Python program to read a text file and do following:
a. Print no. of words
b. Print no. Statements

Regular Expressions [3 +2]

1. Compare re.search() vs re.match() [2 Marks]


2. Explain following operations with suitable example
a. match()
b. findall()
c. Search()
d. Sub()
e. Finditer()
3. Explain any three optional flag values used in regular expression. [3 Marks]
4. Discuss any three methods implemented on regular expression object. [3 Marks]
5. Write a regular expression pattern for
a. Extracting emailed
b. Starts with digits followed by a space and then any characters.
6. Write a code snippet which uses regular expression to print first word of the string. [2 marks]
7. Write a code snippet which uses regular expression to print only those words from a string
which start with a vowel.
8. With the help of relevant example, explain any three metacharacters used in regular
expressions.
9. Write a python program to retrieve strings starting with m and having 5 characters.

You might also like