[go: up one dir, main page]

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

KPR Institute of Engineering and Technology

The document outlines the examination regulations for the B.E. / B.Tech. degree in Python Programming at KPR Institute of Engineering and Technology for the November/December 2023 semester. It includes details on the structure of the exam, with sections for multiple-choice questions, short answer questions, and long answer questions. The content covers various Python programming concepts, data types, error handling, and the use of libraries like NumPy and Pandas.

Uploaded by

24ad124
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)
7 views2 pages

KPR Institute of Engineering and Technology

The document outlines the examination regulations for the B.E. / B.Tech. degree in Python Programming at KPR Institute of Engineering and Technology for the November/December 2023 semester. It includes details on the structure of the exam, with sections for multiple-choice questions, short answer questions, and long answer questions. The content covers various Python programming concepts, data types, error handling, and the use of libraries like NumPy and Pandas.

Uploaded by

24ad124
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

Regulations: R2021 Reg.

No: …………………

KPR INSTITUTE OF ENGINEERING AND TECHNOLOGY


(Autonomous Institution Affiliated to Anna University, Chennai)
Avinashi Road, Arasur, Coimbatore - 641 407.

B.E. / B.Tech. DEGREE EXAMINATIONS NOV / DEC 2023


II Semester
Common to all Branches
U21CSG02 - Python Programming

Duration: Three Hours Maximum: 100 Marks


PART – A (10 x 1 = 10 Marks)
Q.No. M RBT CO
Answer All Questions
Which line of code produces an error?
1 1 U CO1
A) “one” + “2” B) ‘5’ + 6 C) 3 + 4 D) “7” + ‘eight’
The input() function takes user’s input as a
2 1 R CO1
A) integer B) float C) string D) character
How many lines will be printed by this code?
while(False):
3 1 U CO2
Print(“Hello”)
A) 1 B) 0 C) 10 D) countless
If number of arguments in function definition and function call does not match,
4 then which type of error is returned? 1 R CO2
A) NameError B) ImportError C) TypeError D)NumberError
Which data structure does not allow duplicate values?
5 1 R CO3
A) List B) Dictionary C) Tuple D) Set
If List = [1,2,3,4,5] and we write List[3] = List[1], then what will be List[3]?
6 1 U CO3
A) 1 B) 3 C) 2 D) 4
Which exception is raised when two or more data types are mixed without
7 coercion? 1 R CO4
A) TypeError B) AttributeError C) ValueError D) NameError
If a file opened in ‘w’ mode does not exist, then
A) nothing will happen
8 B) file will be created 1 U CO4
C) data will be written to a file that has name similar to the specified name
D) error will be generated
What is the default data type of NumPy arrays?
9 1 R CO5
A) int32 B) float64 C) object D) int64
What will be the output of the following code?
import pandas as pnd
10 1 U CO5
pnd.Series([1,2], index= ['a','b','c'])
A) SyntaxError B) ValueError C) IndexError D)AttributeError

PART – B (10 x 2 = 20 Marks)


Q.No. M RBT CO
Answer All Questions
11 Identify the operator(s) and operand(s) in the following expression: sum = a + b. 2 U CO1
Are comments executable statements in a Python program? How comments are
12 2 U CO1
included in a Python program?
13 State the two types of iterative statements supported by Python. 2 R CO2
14 Write a program that uses lambda functions to multiply two numbers. 2 U CO2
Page 1/2
If str = “Welcome to the world of Python Programming”, identify an instruction to
15 2 U CO3
print the ninth character of the string.
16 In python, how the values stored in a dictionary are accessed? 2 R CO3
17 Give the syntax for opening a file to write in binary mode. 2 R CO4
18 Differentiate error and exception. 2 U CO4
19 How to create 3D arrays in NumPy? 2 R CO5
20 Specify the different ways in which a series in Pandas are created. 2 U CO5
PART – C (5 x 14 = 70 Marks)
Q.No. M RBT CO
Answer All Questions
i. Explain about the various data types available in Python. 7 U CO1
21 a) Develop a program that prompts the user to enter his first name and last name
ii. 7 U CO1
and then display a message “Greetings!!First Name Last Name”.
(Or)
i. Describe in detail about the principles of debugging in Python. 7 U CO1
21 b)
ii. Develop a program to print the digit at one’s place of a number. 7 U CO1
Develop a program that prompts user to enter a character (O,A,B,C,F). Then
i. using if-elif-else construct display Outstanding, Very Good, Good, Average and 7 Ap CO2
22 a)
Fail respectively.
ii. Explain the utility of pass and continue statement with the help of an example. 7 U CO2
(Or)
i. Develop a program to print the Fibonacci series using recursion. 7 Ap CO2
22 b) With the help of an example, explain the concept of accessibility of variables
ii. 7 U CO2
in nested functions.
Define string slicing in python programming. Apply string slicing concepts in the
given string to determine its output.
s = "Welcome to Python Programming Class"
• print("s1 = ", s[:6])
• print("s2 = ", s[0:0])
23 a) 14 Ap CO3
• print("s3 = ", s[2:13])
• print("s4 = ", s[-4:-1])
• print("s5 = ", s[1:20:2])
• print("s6 = ", s[ :-1])
• print("s7 = ", s[:])
(Or)
Develop a program that displays a dictionary of products purchased and their
23 b) 14 Ap CO3
MRPs. Calculate the bill and display to the customer.
24 a) What is an exception? Elaborate exception handling in Python. 14 U CO4
(Or)
Elaborate the various access modes for opening a file and present an outline of the
24 b) 14 U CO4
same using suitable examples.
Define python pandas. Describe with suitable examples about the following:
25 a) I) How to add a row to a Pandas DataFrame 14 U CO5
II) How to add a column to a Pandas DataFrame
(Or)
Demonstrate with suitable examples on how to find the data type of the elements
25 b) stored in the NumPy arrays. Explain why NumPy arrays are better than Python’s 14 U CO5
lists.

Page 2/2

You might also like