Python 1
Python 1
Python 1
:
PA-2556 [Total No. of Pages : 6
[5948]-201
M.C.A. - I (Management )
IT - 21 : PYTHON PROGRAMMING
(2020 Pattern) (Semester - II)
Time : 2½ Hours] [Max. Marks : 50
Instructions to the candidates:
1) All questions are compulsory.
2) Figures to the right indicate full marks.
3) Answer all sub questions at one place.
[5948]-201 2
m) When will the else part of the try-except-else be executed?
i) When an exception occurs
ii) Always
ii) always
o) Which of the following is not a valid attribute of the file object file-handler.
p) Which of the following command is used in mango shell to show all the
databases.
q) The function that returns its arguments with a modified shape and the
method that modifies the arry itself respectively in Numpy are
[5948]-201 3
s) Which of the following statement is false?
i) ndarray is also known as the axis array
ii) in numpy, dimensions are called axes
iii) numpy main object is the homogeneous multidimensional array
iv) ndarry dataitemsize is the buffer containing the actual elements of
the array
t) The method used in pandas to return top 5 rows
i) top ( ) ii) top - rows (5)
iii) row (5) iv) head ( )
Q2) a) Write a program that accept the string from user and display the same
string after removing vowels from it. [3]
b) Explain possitional and keyword arguments in function. Use suitable
example. [3]
c) Describe instance variable, static variable and local variables in python
object oriented programming with example. [4]
OR
a) Compare List and tuple with suitable example. [3]
b) Explain lambda with example. [3]
c) Create class called, library with data attributes like Acc-number publisher,
title and author, the methods of the class should include [4]
i) Read ( ) - Acc- number, title, author, publisher.
ii) Compute ( ) - to accept the number of day late, calculate and display
the fine charged at the rate of Rupees 5/- per day.
iii) Display the data
Q3) a) Develop a program to print the number of lines, words and characters
present in the given file? Accept the file name from user. Handle necessary
exceptions. [2]
b) Illustrate CRUD operations in MongoDB with example [3]
c) Compare SQL Database with No SQL Database. [2]
d) Write aprogram to check whether entered string & number is palindrome
or not. [3]
OR
[5948]-201 4
a) Develop a pythan program to remove the comment character from all the
lines in the given file. Accept the file name from user [2]
b) Write a pythan program to perform following operations. on MongoDB
Database. [5]
i) Create collection “EMP” with fields:
Emp-name, Emp- mobile, Emp, sal, Age
ii) Insert 5 documents.
iii) Find the employees getting salary between 5000 to 10000.
iv) Update mobile number for the employee named as “Riddhi”
v) Display all employees in the order of “Age”
c) Write a pythan program to find the factorial of a given number using
recursion [3]
[5948]-201 5
a) Write a program for synchronization of threads using RLOCK. Accept
the two numbers from user and calculate factorial of both numbers
simultaneonly [4]
b) Write a pythan program [4]
i) To remove all leading ‘zeros’ from an IP address
ii) To find all 5 character long words in a string Accept string from
user.
c) Explain decorators in pythan with suitable example [2]
Q5) a) Explain numpy integer indexing, array indexing. boolean array indexing
and slicing with example. [4]
b) Draw bar graph using matplotlib and decorate it by adding various elements
[2]
c) Prepare the pandas dataframe from csv file. [2]
perform following operations.
i) Fill all ‘NaN’ values with the mean of respective column.
ii) Display last 5 rows.
d) Explain constructors in pythan with example. [2]
OR
a) Write a program to illustrate numpy array attributes/functions. [4]
i) ndarray. shape
ii) np. zeros ( )
iii) np. eye ( )
iv) np. random. random ( ) [4]
b) Read data from csv five and create dataframe. Perform following
operations.
i) Display list of all columns.
ii) Display data with last three rows and first three columns [2]
c) Draw line graph using matplot lib and decorate it by adding various
elements. Use suitable data.
d) Explain multiple inheritance in python with suitable example. [2]
[5948]-201 6