Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
51 views

TYBSC (CS) - 3510 Python Programming

Uploaded by

purkarpranjal12
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)
51 views

TYBSC (CS) - 3510 Python Programming

Uploaded by

purkarpranjal12
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.

38
P-1306 [Total No. of Pages : 3

ic-
tat
[6055]-307

2s
T.Y.B.Sc.

5:1
31 1
1
0:3
COMPUTER SCIENCE

6/2 02
CS-3510: Python Programming
1
02
8 2 P0

(2019 Pattern) (CBCS) (Semester - V)


A
2/0
8.7 CA

Time : 2 Hours] [Max. Marks : 35

38
Instructions to the candidates :
7.3

ic-
1) All questions are compulsory.

tat
2) Figures to the right indicate full marks.

2s
.24

3) Total number of questions are five.

5:1
49

11
0:3
02

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


31
01
02

a) How are comments written in Python?


6/2
AP

b) Give the use of index() in string.


2/0
CA
82

c) Explain the range() function and its parameters.

38
7.3

-
d) How to create a void function in Python? tic
8.7

sta
.24

e) What is the difference between pop() and del in list.


:12
49

11
:35

f) Compare list and tuple (any two points).


02
10

g) What does the following functions return - clock() and gmtime().


23
1
8 2 P0
/20

h) List the syntax for handling exception.


06
A
2/
CA

i) List any two functions in math module.


7.3

j) Explain the function enumerate().


8.7
.24

P.T.O.
49
Q2) Attempt any Four of the following: [4 × 2 = 8]

38
a) Which methods are used to read from a file? Explain any two with example.

ic-
b) What are the usage of dictionary copy(), gets(), items() and keys()

tat
methods?

2s
c) Explain union and intersection with example.

5:1
31 1
d) Explain the following statement

1
0:3
6/2 02
i) if b) if else c) break d) continue
e)
1
List features of Python.
02
8 2 P0
A

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


2/0
8.7 CA

a) Write a program to get a single string from two given strings, separated

38
by space and swap the first two characters of each string
7.3

ic-
Sample input: ‘abc’, ‘pqr’

tat
Output: pqc abr

2s
.24

b) Write a program to display power of 2 upto a given number using


5:1
49

11
anonymous function
0:3
02

Example
31
01

N=2
02

2 raised to 0 is 1
6/2
AP
2/0

2 raised to 1 is 2
CA
82

2 raised to 2 is 4

38
7.3

c) Write a program to read an entire text file.


-
tic
8.7

sta
.24

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


:12
49

a) Write a python program to Count Vowels and Consonants in a String.


11
:35

b) Write a Python script to print a dictionary where the keys are numbers
02
10

between 1 and 15 (both included) and the values are the square of the
23
1

keys.
8 2 P0
/20

Sample Dictionary
06
A

{1: 1, 2:4, 3:9, 4: 16, 5:25, 6:36, 7:49, 8:64, 9:81, 10: 100, 11: 121, 12: 144,
2/
CA

13: 169, 14: 196, 15: 225}


c) Write a Python function that accepts a string and counts the number of
7.3

upper and lower case letters.


8.7
.24
49

[6055]-307 2
Q5) Attempt any one of the following : [1 × 3 = 3]

38
a)

ic-
a = True

tat
b = False

2s
5:1
c = False

31 1
1
0:3
if not a or b:

6/2 02
print (1)
1
02
8 2 P0
elif not a or not b and c:
print (2)
A
2/0
8.7 CA

elif not a or b or not b and a:

38
print (3)
7.3

ic-
else:

tat
2s
.24

print (4)

5:1
49

b) def f 1(x, 1=[ ]):


11
0:3
for i in range(x):
02
31

1.append(i*i)
01
02

print(1)
6/2
AP

f1 (2)
2/0
CA

f1 (3,[3,2,1])
82

38
f1 (3)
7.3

-
tic
8.7

sta


.24

:12
49

11
:35
02
10
23
1
8 2 P0
/20
06
A
2/
CA
7.3
8.7
.24
49

[6055]-307 3

You might also like