0% found this document useful (0 votes)
67 views

Python PYQ assignment (1)

ppytthon

Uploaded by

pateg48332
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views

Python PYQ assignment (1)

ppytthon

Uploaded by

pateg48332
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

M. Q.

53220202 |
kam Roll N.
Ploen ortte o r Bn Roh No.)
END TERM DXAMINATION
JANUARY-FeBAUART 2023
THIRD 8EMEATER (BCA] Programming
Paper Code: BCAT-211 Buhject: Baslcs of Python
Maxlmum Marke: 75
Tme: 3Hours
Note: Atempt 1 whteh ls oompulsory.
oe questtons tn all incudtng Q.No.unlt.
Select one questton from each

Ansuer any N the following: (Sa8-26)


Q1 Python?
a) Explain the key features of exarmple.
b Explain Mutable and Immutable Data types with
&Con sider a list Le |10, 20, 30, 40]. Find the output of following
statcments.
wA. LJO] = L;O] + 2
L=L+ 2 a
C. L=L2
t 1]-50
Explain the following functions with example.
update) ii) copy)
Explain the Dynamic Typing feature of Python with example.
AWrite the difference between indexing and slicing with example.
UNIT-I

Q2 Explain the following terms: (3%)


Pass e Continue
Write a python script to print Fibonacci series for first 20 elements.(4)
Explain Entry - Controlled loops in Python -with the help of
progams. (5)
OR
What is the difference between interactive mode and script mode in
Q3 a)
pyhon? (3)
b Write a program that reads a string and check whether it is a
Palindrome or not. (5)
c Explain the following functions with example. (4Y)
1. lstrip) 2. swapcase) 3. iaspace)
UNIT-II

Q4 a Whal is Tuple? How to define and acces8 the eloments of Tuple?


Explain it with a code. (6)
P.T.0.
(2-)
b) What is the output of the following code snippets?
1. tl (3) (4)
(4,3,6)
t3 tl + 2
prin(t3)
2. d dict)
d['le'] 's
d['right'] 'e'
print(d[le'] and d|'right']or d['right'|and d['left')
prin(d[le]and dl'right']and d'right| and d[left )and dend')
How are Dictionaries different from list? (2%)
OR
Q5 What is Dictionary? What are the different ways to create
Dictionary? (5)
b Explain the following methods of Lists with example: (4)
A extend) Ainsert)
Given a tuple namely City storing cities names (tokoyo, 'Delhi,
'Seoul', Jaipur, 'Paris, 'Luxembourg, 'Berlin', 'London', 'Moscow)
as elements. Write a program to print names of the citics as well as
their index in the index range 2 to 6, both inclusive. (3-)
UNIT-II
Q6 What is function? Explain the different types of arguments i
function in Python. Ilustrate with the help of programs. (6a]
b Predict the output of the following code snippet: (2)
def add(a,b,c):
print(x*ytz)
c add(6,16,26)
Write a program to find factorial of a number using recursion. (4)
OR
Q7 a) What is the difference between Package and Module? What are the
different ways to import a modulec in a program? (5)
b) Write a program that reads a number, then converts it into octal
and hexadecimal equivalent using built-in functions of Python.
(34>)
) Differentiate between local and global variables in python with the
help of a program. (4)

P.T.0.
(-3-]

UNIT-IV
Q8 a) Explain the
(i) read(n) following built-in
(i) seek(0
methods of fle. (6)
(ijwritelines)
(iv) tell)
b) List the
c) advantages
Explain following
the
of NumPy Arrays
over nested python list.
1. barh) functions with respèct to Matplotlib. (3%)
(3)
2. legend)
Q9 OR
.Explain the different file opening modes with
Explain the following function with respect toexample. (8)
reshape) NumPy (4)
(Please wrte your Rxam Roll No.)
Exum Noll Na. .....'"..

END TERM EXAMINATION


TIRID 8EMEATER (BCA)
Paper Code: BCAT-211
Suhject:
JANUARY-2024
Baslc of Python Programumlng
Time: 3 Hours
Note: Attempt five questions tn all Maxtmum Marks :75
including ).no. 1 whlch ts compulory
Select one question from each unlt.
Write slhort notea On the
(a)
Elaborate Iython following:
is inter (Any Flve) (5x5-25)
(b) How unary prcted oa wcllaa integrated
(c) operator
Explain the use of _initdifferent from binaryopcrator? Give prograrn rning latiguaqe ?
(d) mcthod in cxarnple oi each.
(c) Differentiate betwecn list and tuple?python programming?
Explain the use of pandas library with an
Justify the significance cxamplc?
of sclf keyword? Givc
an cxaiple?
Q2 UNIT-I
[a)
Explain while loop and for loop with an
them. cxample. Elaborate difference tetween
Explain membership operator, identity
Cxamplc? operator, escape sequence, sicing (4.5) with an
Q3 (a) (8)
Perform following slicing opcration on
string(2:15:2],
string|-3:- 16:-2,
stringPYTHON PROGRAMMING":
(b) Write a program tostring|:13, in right6:], string(: -2, string(3:14:3})
print starsstring| triangle pattern (value enter by user? (6]
(6.5)
UNIT-I
Q4 (a)
(b) Differentiates betwcen
Explain tuple, list, sets,mutable and immutable objects with
dictionary in python? Each examples?
with example. (4.5)
Q5 (a) (8)
Explain list methods- append, extend,
example of cach? emove, index, pop, insert, sort? Gve
(b) Explain dictionary methods- len, stt, clear, (6.5)
each. copy, update, get? Give an eampie of
UNIT IT (6)
Q6 Explain the concept of class, objecis, functions, data
Explain call by Value and call by referencc? member with hclp of program? Also
(12.5)
Q7 Explain the following terms with examples:
Scope and lifetime of a function. (12.5)
(ü) Importing modules
(i) Formal, Actual, Default, keyword arguments
(iv) Concept of modules
UNIT-IV

Q8 (a) Elaborate the importance of pip command to install any library in python? (4.5)
(b) Byusing NumPy library in program, perform he following operations:
Creation of 1D array, Re-shaping of an Array, Aray Slcng Axsregate
Operations. (3)
(4.3)
Q9 (a) Explain file modes of file handling? Give cxAmple of cach?
(6) Explain the use of NunPy, Pandas, Matplotlib in python progranming? Give
(8)
example of each?
write your Enrolment No.) Enrolment
(Please
No

MAHARAJASURAJMAL INSTITUTE
MID- TERM EXAMINATION (for BCA3A-3B-Morn.)
BCA THIRD SEMESTER November 2023

Paper Code: BCA- 211 Paper Name: Basics of Python


Programming
Time: 2 Hours Maximum Marks:60

Note: Q. 1 is compulsory.
Attempt any 3 from the rest. Each question carries 15 marks.

Q.1 Attempt any 5 questions. Each question carries 3 marks.


(a) List down the key features of Python programming language.
(b) Explain the dynamic typing feature of Python.
(c) What is the difference between indexing and slicing in Python?
(d) Differentiate between sort) and sorted() for lists.
(e) Differentiate between copy() and deepcopy() for list.
() What is the difference between interactive mode and script mode in
Python?
(g) How do write a multiline statement in Python?

Q.2 (a) Explain the following list methods with example. 5


a) append () b) extend () c) clear () d) count ()
e) reverse ()
(b) What is list comprehension? What are its components/parts? Write a
program to create a list with elements 1, 2, 3, 4 and 5. Display even
elements
of the list using list comprehension.
5

(c) Explain the difference between any() and all()


functions of list. Explain with
example. 5
the elements of
Q.3 (a)Write a program which inputs a list of numbers and swaps
ONLY if the sum of 1st Half is
1st Half of the list with the 2nd Haf of the list
greater than 2nd Half of the list.
40, 50, 60]
Sample Input Data for the list is [ 100, 200, 300, 5
Output is [40, 50, 60, 100, 200, 300] proper
pass and break staternents. Write
(b) Explain the need for continue,
code to explain the same.
5

Write a program that accepts numbers from the user and display the sum
(c)
of all even numbers from the ones
entered. The loop should continue till the
User enters a zero.
5

methods with examples. Describe


Q.4 (a) Explain the use of join() and split() string 5
with an example "how strings are immutable".
checks if it is a palindrome or not.
(b)Write aprogram that reads a string and 5

isasci() for strings. 5


(c) Differentiate between isalnum(), isalpha() and

from Lists. Discuss the utility and


Q.5 (a) What is Tuple? How are Tuples different
5
significance of Tuples.
Make use of a list/tuple/dictionary
(b) Discuss zip() function with an example.
5
to explain.
OR
can you merge two
What is the difference between dictionary and list? How
dictionaries? What is the difference between del and clear() ?
pop()) 5
(c) Write code to rename a key of a dictionary (hint: use

You might also like