Nagarjuna College of Information Technology Full Marks:
Shankhamul -09, Lalitpur
Set 60
A Pre-Board Examination 2081 Pass
BIM / Fifth Semester / IT 243: Programming with Python Marks: 30
Candidates are required to give their answer in their own words.
Group "A"
Brief Answer Questions:
Attempt all questions. [10 ×1 = 10]
1. How child class is created in python?
2. How block is defined in Python?
3. Write a command to create virtual environment.
4. List any two ways to create an array using numpy.
5. How do you check the data type of a variable in Python?
6. In MVT pattern what does the T represent?
7. Write the syntax of while loop in Python.
8. How negative index is used to access string characters?
9. What is frozen set in Python?
10. What is the use of raise keyword?
Group "B"
Short Answer Questions:
Attempt any Five questions. [5 ×3 = 15]
11. Write a program to create a numpy array of type unsigned int16 and print the following attributes:
The shape of an array.
Array dimensions.
The Length of each element of the array in bytes.
12. Write a program using matplotlib to plot a simple line graph and add appropriate x and y axis labels.
13. What is lambda function? Write a program to demonstrate lamda function in Python?
14. Write a program find factorial of given number using recursive function.
15. Write a program to overload less than operator (<).
16. Write program demonstrate match-case statements in python.
Group "C"
Long Answer Questions:
Attempt any Three questions. [3×5=15]
17. Create a GUI application with a window having a button and a Label. When user clicks on button, the label
should be change as "you have just clicked on button" using event handling.
18. What is operator overloading? Write a program to overload any one unary operator and any one binary
operator.
19. How multiple inheritance and multilevel inheritance are different? Write a program to demonstrate dynamic
polymorphism in Python.
20. Discuss about instance method, class method and static method in python with suitable programming example.
Group "D"
Comprehensive Questions:
Attempt all questions. [2×10 = 20]
21. Explain the steps for connecting to a relational database through a python program. Assume you have a
database table, employees (eid, name, address, phone_number, designation, department, salary). Write a
python program to perform following tasks:
Insert a record in the employees table.
Display the name and salary of employees who belongs to specific department (example: IT).
Update the salary of all employees after raising salary by 5%
22. Write the differences between abstract class and normal class in Python. List any six operations that can be
performed in python lists with suitable examples for each.
Nagarjuna College of Information Technology Full Marks:
Shankhamul -09, Lalitpur
Set 60
B Pre-Board Examination 2081 Pass
BIM / Fifth Semester / IT 243: Programming with Python Marks: 30
Candidates are required to give their answer in their own words.
Group "A"
Brief Answer Questions:
Attempt all questions. [10 ×1 = 10]
1. What is marker in matplotlib?
2. List any two ways to write Comment in Python.
3. Why MRO is important?
4. What is exception in Python?
5. How do you convert a string to float in Python?
6. How GET and POST request are different?
7. What is the use of id () function?
8. List any four statistical functions available in numpy.
9. Write a method to overload plus operator in Python.
10. Write a function to read csv file using pandas.
Group "B"
Short Answer Questions:
Attempt any Five questions. [5 ×3 = 15]
11. Write a program to Create a DataFrame 'df' on your own with at least 3 columns and 7 rows and display the
first 3 rows.
12. List any three file opening modes in python with their descriptions.
13. Write a program to create a dictionary and perform membership test on that dictionary.
14. Write a program having function that displays all odd numbers between 31 and 311 in descending order.
15. Write a program to take a number and display whether the number is single digit, double digit, triple digit or
multi-digit numbers using if-elif-else statements
16. Explain list comprehension in python with example.
Group "C"
Long Answer Questions:
Attempt any Three questions. [3×5= 15]
17. How method overloading and method overriding are different? Write a program that demonstrates method
overriding in Python.
18. Why *args and **kwargs arguments are used in Python function? Explain with suitable programming
example.
19. Explain exception handling in Python with important keywords used. Write a program having custom
exception class and demonstrate exception handling.
20. Write a program to connect to a database and insert a record into the table. Make assumption about database
and table on your own.
Group "D"
Comprehensive Questions:
Attempt all questions. [2×10 = 20]
21. Explain about event handling in Python GUI application with proper steps and syntax. Write a program to
create a simple calculator app which takes two numbers from text field and an operator from a combobox.
When a button is clicked, the result of arithmetic operation as per the symbol chosen should be displayed in a
label below the button.
22. Explain the important properties (at least three for each) of list, tuple, and dictionary and set in Python. List
any five operations that can be performed in python sets with suitable examples for each.