0% found this document useful (0 votes)
5 views2 pages

Model Question Paper Python

This document is a model question paper for the Introduction to Python Programming course at The National Institute of Engineering, Mysuru. It includes various programming tasks and theoretical questions covering topics such as data types, exception handling, file operations, and object-oriented programming. The paper is structured into sections with specific questions aimed at assessing students' understanding and practical skills in Python programming.

Uploaded by

nishangowda21
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)
5 views2 pages

Model Question Paper Python

This document is a model question paper for the Introduction to Python Programming course at The National Institute of Engineering, Mysuru. It includes various programming tasks and theoretical questions covering topics such as data types, exception handling, file operations, and object-oriented programming. The paper is structured into sections with specific questions aimed at assessing students' understanding and practical skills in Python programming.

Uploaded by

nishangowda21
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/ 2

THE NATIONAL INSTITUTE OF ENGINEERING, MYSURU – 8

(An Autonomous Institute Affiliated to VTU, Belagavi)

Model Question Paper


BPLCK205B Introduction to Python Programming
Time: 3 Hrs Max. Marks:100
Note: Answer all the questions.

Q. No. Cognt. COs Questions Marks


Level
1.a L2 CO1 Write a Python program to read a number from the key board and 7
check whether the number is a positive, negative or zero and print the
same.
1b L2 CO1 Write the output of following Python code snippets (No errors in the 6
code):

test="Pythontutor"
print(type(test))
a=10
b=3
print(a/b)
print(a//b)
print(a**b)
print(test*b)
z = a*5*b**2+a%3+ b//3
print(z)

c L2 CO1 Write a Python program to find the prime factor for 60 7

2 a) L2 CO1 Explain global and local scope with examples 7

b) L2 CO1 Explain how exceptions are handled in python with an example.


6

c) L3 CO2 Illustrate the methods of the list data type in python with suitable code 7
snippets for each

3.a L3 CO2 Discuss any 3 dictionary methods in python with examples and output 7

b L3 CO2 Read a multi-digit number (as chars) from the console. Develop a 7
program to print the frequency of each digit with suitable message.
c L3 CO2 Write a program to check whether a given string is palindrome or not 6
using string slicing
OR
3.d) L3 CO3 Python program to find the sum of 5 values in a dictionary with output 7
e L3 CO3 Explain string methods join() split() and strip() with syntax and 7
examples

f L2 CO3 Interpret the following code and write the output of the following code 6
snippet

Str1 ="Python Programming"


Str2="Hello World"
print(String[-2])
print(String[2:5])
print(String[1:9:3])
print(String[::-1])
print(String[-6:-1])
print(String.split())

4a) L2 CO3 Explain the following with its syntax 6


i. Get to know the current working directory.
ii. Creates a new directory at the specified path.
iii. Change the current working directory.
iv. Remove a directory
v. List all the files present in the current working directory.
b L3 CO3 Explain the following operation of files with an example code. 8

i. Open the file in both read and write mode.


ii. Write 2 lines of text into the file.
iii. Read the first line of the file.
iv. Read the first 10 characters of the file.

c L3 CO3 Write a python program to open a file named ‘sample.txt’ in read mode 6
and display the contents in another file ‘output.txt’
OR
4.d L2 CO3 Discuss three key functions available in the ZipFile module. 6
e L3 CO3 Illustrate the functions of shutil module with its syntax 8

f L3 CO3 Write a Python program to walk through all the files and subfolders of a 6
given directory .
5 a. L4 CO4 Write a python code to copy the contents of one object to other 6
object .Demonstrate both shallow copying and deep copying of objects
b L4 CO4 Illustrate the need of the __init__ and __str__ method . 6
c L4 CO4 Consider a Rectangle class and create Two Rectangle objects. write a 8
python program to check whether the area of the first Rectangle is
greater than the second by overloading ‘>’ operator
---***---

You might also like