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

PYTHON 2023-24 Even Sem

This document is an examination paper for a BTech course on Python Programming, covering various topics including operators, string manipulation, functions, file handling, and data structures. It consists of multiple sections with questions requiring brief answers, programming tasks, and explanations of concepts. The exam is scheduled for 3 hours and carries a total of 70 marks.

Uploaded by

kishan96560
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)
77 views2 pages

PYTHON 2023-24 Even Sem

This document is an examination paper for a BTech course on Python Programming, covering various topics including operators, string manipulation, functions, file handling, and data structures. It consists of multiple sections with questions requiring brief answers, programming tasks, and explanations of concepts. The exam is scheduled for 3 hours and carries a total of 70 marks.

Uploaded by

kishan96560
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

Printed Page: 1 of 2

Subject Code: BCC402


0Roll No: 0 0 0 0 0 0 0 0 0 0 0 0 0

BTECH
(SEM IV) THEORY EXAMINATION 2023-24
PYTHON PROGRAMMING
TIME: 3 HRS M.MARKS: 70

Note: 1. Attempt all Sections. If require any missing data; then choose suitably.

SECTION A

1. Attempt all questions in brief. 2 x 7 = 14


a. Give difference between = = and is operator.
b. How we print the character of a given ASCII value in Python?
c. Can you use else with a for loop? If so, when is it executed?
d. What will be the output of the following Python code?
l= [1, 0, 0, 2, ' hi', ' ', []]
print(list(filter(bool, l))
e. Describe the purpose of the split() method in string manipulation.
f. What does the readline() function return when it reaches the end of a file?
g. Which function is used to create identity matrix in NumPy?

4
19
SECTION B
92

5.
_2

2. Attempt any three of the following: 7 x 3 = 21

.6
P2

a. Explain the concept of dynamic typing in Python with an example.

40
b. Explain how to define a list in Python. Write a Python program to remove
4E

.2
duplicates from a list and print the resulting list.
15
P2

c. Explain the concept of functions in Python. Write a function that takes a list of
|1
Q

numbers and returns the sum of all the numbers in the list.
PM

d. Write a Python program to read a file named “ABC.txt” and count the number
of lines, words, and characters in the file.
e. Explain the basic usage of matplotlib for plotting graphs. Write a Python
02

program to plot a simple line graph showing the relationship between x = [1, 2,
:
40

3, 4, 5] and y = [1, 4, 9, 16, 25].


1:

SECTION C
24

3. Attempt any one part of the following: 7x1=7


20

(a) Explain for and while loops used in Python with appropriate example.
g-

(b) Write a Python Program to find the LCM of two numbers.


Au

4. Attempt any one part of the following: 7x1=7


7-

(a) Write a program takes two strings and checks common letters in both the
|0

strings.
Enter first string: Hari
Enter second string: Hale
The common letters are:
H
a
(b) Write a Python Program to find the sum all the items in a dictionary.
For example if d={'A':100,'B':540,'C':239}then output should be 879.
1|Page
QP24EP2_292 | 07-Aug-2024 1:40:02 PM | 115.240.65.194
Printed Page: 2 of 2
Subject Code: BCC402
0Roll No: 0 0 0 0 0 0 0 0 0 0 0 0 0

BTECH
(SEM IV) THEORY EXAMINATION 2023-24
PYTHON PROGRAMMING
TIME: 3 HRS M.MARKS: 70

5. Attempt any one part of the following: 7x1=7


(a) Explain the concept of a set in Python and its characteristics. How elements are
added or removed in set.
(b) Explain how lambda functions can be used within a list comprehension. Write a
Python program that uses a lambda function within a list comprehension to
convert a list of temperatures in Celsius to Fahrenheit.
6. Attempt any one part of the following: 7x1=7
(a) Explain different file opening modes also write a Python Program to read a file
and capitalize the first letter of every word in the file.
(b) What do you mean by generators in Python? How it is created in Python?
7. Attempt any one part of the following: 7x1=7
(a) Describe how to generate random numbers using NumPy. Write a Python
program to create an array of 5 random integers between 10 and 50.
(b) Explain the concept of DataFrame in pandas. Write a Python program to create

4
a DataFrame from a dictionary and print it.

19
92

5.
_2

.6
P2

40
4E

.2
15
P2

|1
Q

PM
:02
40
1:
24
20
g-
Au
7-
|0

2|Page
QP24EP2_292 | 07-Aug-2024 1:40:02 PM | 115.240.65.194

You might also like