0% found this document useful (0 votes)
2 views3 pages

.Trashed 1751450465 Bsc Computer Science Cs Semester 5 2023 November Python Programming r Programming 2019 Pattern

This document is an examination paper for T.Y. B.Sc. (Computer Science) focusing on Python Programming, consisting of five questions. Candidates are required to answer a total of 5 questions, with varying marks assigned to each section. The paper includes topics such as list operations, functions, exception handling, and string manipulation in Python.

Uploaded by

Sushant D
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)
2 views3 pages

.Trashed 1751450465 Bsc Computer Science Cs Semester 5 2023 November Python Programming r Programming 2019 Pattern

This document is an examination paper for T.Y. B.Sc. (Computer Science) focusing on Python Programming, consisting of five questions. Candidates are required to answer a total of 5 questions, with varying marks assigned to each section. The paper includes topics such as list operations, functions, exception handling, and string manipulation in Python.

Uploaded by

Sushant D
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/ 3

Total No. of Questions : 5] SEAT No.

:
P6396 [Total No. of Pages : 3
[6155]-57
T.Y. B.Sc. (Computer Science)
CS-3510 : PYTHON PROGRAMMING
(Revised 2019 Pattern) (CBCS) (Semester - V)
Time : 2 Hours] [Max. Marks : 35
Instructions to the candidates:
1) All questions are compulsory.
2) Figures to the right indicate full marks.
3) Total number of questions are five.

Q1) Attempt any Eight of the following: [8×1=8]

a) What is indentation?

b) Write code to print the elements of the list 11 = [10, 20, 30, 40, 50]

c) What is a slice operator?

d) What is variable-length argument?

e) How to add multiple elements at the end of the list?

f) Explain the remove () method.

g) Write a lambda function to add 10 to a given integer.

h) How to raise an exception with arguments.

i) List the methods of re package.

j) What is a wb mode in file?

Q2) Attempt any four of the following: [4×2=8]

a) What is a package? Explain with example how to create a package.

b) What are the usage of tuples zip (), tuple(), count() and index() functions?

[6155]-57 1 P.T.O.
c) What is an anonymous function? How to create it? Explain with example.

d) Explain the following loops with example.


i) While
ii) For
e) How to perform input output operations? Explain with example.

Q3) Attempt any Two of the following: [2×4=8]


a) Write a program to accept a string from user and display the string in
reverse order eliminating the letter ‘s’ from the string.
b) Write a program to raise a user defined exception to check if age is less
that 18.
c) Write a Python program to check that a string contains only a certain set
of characters (in this case a-z, A-Z and 0-9).

Q4) Attempt any Two of the following: [2×4=8]


a) Write a Python program to add ‘ing’ at the end of a given string (length
should be at least 3). If the given string already ends with 'ing', add 'ly'
instead. If the string length of the given string is less than 3, leave it
unchanged.
b) Write a Python program to combine values in a list of dictionaries. Sample
data: [{'item': 'item 1', 'amount': 400}, {'item': 'item2', 'amount': 300},
{'item': 'item1', 'amount': 750}]
Expected Output: Counter ({'item1': 1150, 'item2': 300})
c) Write a Python program to extract year, month, date and time using
Lambda.

[6155]-57 2
Q5) Attempt any one of the following: [1×3=3]
a) Check1 = ['Learn', 'Quiz', 'Practice', 'Contribute']
Check2 = check1
Check3 = check1 [:]
Check2[0] = 'Code'
Check3[1] = 'Mcq'
Count = 0
For c in (check 1, check2 check3):
if c[0] == 'Code':
count + = 1
if c[1] == 'Mcq':
count + = 10
print (count)
b) Counter = {}
Def add To Counter (Country):
If country in counter:
Counter [country] + = 1
Else:
Counter [country] = 1
Add To Counter ('China')
Add To Counter ('Japan')
Add To Counter ('china')
Print (len(counter))



[6155]-57 3

You might also like