0% found this document useful (0 votes)
10 views6 pages

Python Programming Exam Paper 3529

This document is a question paper for a B.Sc. Computer Science course, covering various topics in Python programming. It includes multiple sections with questions on data types, functions, control statements, and exception handling, along with practical coding tasks. The paper is structured with compulsory and optional questions, and provides instructions for candidates regarding the examination format.

Uploaded by

weebtrue
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)
10 views6 pages

Python Programming Exam Paper 3529

This document is a question paper for a B.Sc. Computer Science course, covering various topics in Python programming. It includes multiple sections with questions on data types, functions, control statements, and exception handling, along with practical coding tasks. The paper is structured with compulsory and optional questions, and provides instructions for candidates regarding the examination format.

Uploaded by

weebtrue
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

3529 12 [This question paper contains

for i in ranget I, 21):

if i % 3 == 0:
Sr. No. of Question Paper : 3529
print(f''Hello", end=' ')
Unique Paper Code 2344001103
elif i % 5 == 0: '
Name of the Paper
print(f'Buddy", end=' ')

elif i % 15 == 0:
Name of the Course' [Link]. {ii) Computer Science
print(f''HelloBuddy", end=' ') GE (NEP-UGCF-2022)

else: Semester V

print(i, end=' ') "l '•Duration; 3 Hours


Maximum Marks : 90
~1
(c) Create python
... functions, such as generate_squares Instructions for Candidates
and generate_cubes to create: (5)
1. Write your Roll No. 9n the top immediately on receipt
(i) List A to store the squares of numbers of this question paper ..
from 1 to 10.
2. The paper has 2 sections, Section A is compulsory.

(ii) List B to store the cubes of numbers from


3. Attempt any four· questions from Section B.
1 to 1 O.
4. Parts of a question must be answered together.

(2000) ., ~.
P.T.O .
3529 2
3529 11
Section A
(ii) If the % ·is between 45% and 59%, display
(Compulsory) - "!Ind Div".

(iii) If the % is between 3.5% and 44%,_ display


I. (i) Explain the difference between
mutable· and
"IIIrd Div".
immutable data types in Python. Provide an
example of each type and ' describe how they (iv) If the % is less than 35%, display "Fail".

behave when modified, (3) Ensure that the program uses proper if-

(ii) Give the diff~rence between add(} and update() else statements to 'determine the division
based on the calculated percentage.
methods of python SET with an example?
- . (J) -·· t' _i,~ ·(b) Explain 'in detail how exceptions are managed in
t 't; python, with an example. {5)
(iii) .Give the output of following code?·
(3)
(c) Write a python function, such as calculate_factorial,
(a) print("Hello" * 3)
with a while loop to print the factorial of a number.

. (b) print(sum([i for i in range(l 0) if i % 2=0])) (5)

'l. (a) Explai.n the control statements supported by python,


(iv) Write a python program using a function, such
with suitable examples. (5)
as largst_element, to find the largest element in
;:i, list. (3) (b) Convert the following (or loop into while loop.
(5) \

. :' '
/
P.T.O .
'~._,
10· 3529
(b) Write ·python .[Link] a menu-driven program- that {3)
prompts the user to enter two different numbers
a = [l, 2, 3]
and then allows the user to choose an arithmetic I
f

operation ( addition, subtraction, multiplication, ' ,


" b = [1, 2, 3]
or division) to perform based on. the. selected
print(a == b)
option. (5)
' ' • J..,

print(a is b)
(c) Write a program to add N natural numbers and
display their sum. (5)
(vi) What is the output .of the code given below :.
I

(3)
6. (a) Write a python program to read the marks of .5
def calculate surnra, b):
subjects through the keyboard. Calculate the
return a+ b J

aggregate and percentage of marks obtained by


' X = 5
the student. Assuming the maximum marks that
,
can be obtained in each subject are 100, the y=7

program should display the following based on the result = calculate_sum(x, y)


conditions : (5) print(result)-

(i) If the % is greater. .than or· equal to 60%,


(vii) • Write a python program that. accepts a list of
display "1st Div".
integers and returns a new list containing only
the even numbers from the original list. (3)

P.T.O.
. 3529 4 3529 9
(viii) How to create a dictionary in Python? Give an
(b) Evaluate the following expressions and justify your
example.
(3) answers:
(5)

(ix) Differentiate between append() and extend() (i) 7 * 2· - 5 ** 2 Ii 4 + 8


methods with an example of each. (3)
(ii) l O < 5 or 7 < 12 and not 18' > 3

(x) Write the output of the code given below: (3)


(iii) float(6 - int(56.4) % 2)
try:
(iv) 9. & -11
a == [l, 2, 3]
(v) 'hello' < 'hi' or 'I am fine' > 'I am not
print(a[5])
fine'

except IndexError:
(c) Write a python function is___palindrome(s) that
print("Index out of range!") checks if a given string is a palindrome, ignoring

finally: spaces, punctuation, and capitalization. (5.)

print("Execution complete.")
5. (a) Define [Link] function called first_five_multiples
that accepts a positive integer K and returns a list

containing its first five multiples. For example, the


first five multiples of 3 are 3, 6, 9, 12, .and 15.

(5)

/ (

·P.T.O.
3529 ·8 3529 5
(ii) def evaluate_expression_) (Z):
Section B

Z=Z+5
2. (a) Considerthe SET 'A' and SET 'B' (5)
def evaluate_ exp_ression_2(Z)!

print("HeUo") A = {l, 2, 3}

return_ Z B = {3, 4, 5}

return Z . Write the output of following :

value= 10
(i) print (A I ·B)
print( evaluate, expression_ 1 (value))
(ii) print (A_& B)

(c) Write a python function, with appropriate :'.l.


(iii) print (A - B)
comments, that takes name and age of a person
.as inputs and displays an appropriate message (iv) print (A " B)

whether the person is eligible to vote or not.


(v) print(B - A)
Minimum age for voting being 18 years. (5)

(b) Write a python program to display the Fibonacci


4. (a) Write a Python function calc_exp(base, exp) that sequence up to a specified number of terms.
computes the exponent of a number, i.e., calculates (5)
base=r and the functi?n should take two arguments.

(5)

P.T.O.

J
3529 /·, 7 .J
352-9 ·• 6
(c) Write a program us ing a function, such as (v) Convert the tuple into a list, modify the
findjluplicates, to display all duplicate items from list, and then co~vert it back into a tuple.

(5) Display the modified tuple.


the list-

Lstl = [10, 20, 60, 30, 20, 40, 30, 60, 70, 80]. (b) Give the output of following codes : (5)

(i) def evaluatejexpressionj l I}:


.3. (a) Write a python program that performs the·

following operations orr a tuple : (5) global x

(i) Create a tuple with at least 6 elements, x=x-5

(ii) Access and print the third elernenr of the'·-• .,.I 1 def evaluate_expression_2():
~
tuple.
global x

(iii) Find and display the index of a specific r \


return x + 3
element (choose any element from the

tuple). return evaluate_expression_2.()

(iv) Concatenate the tuple with another tuple X = 10


containing 3 elements and display the
printfevaluate_expr.ession_ 1 ())
result.

P.T.0.
I '

/,Jf,',-(

You might also like