0% found this document useful (0 votes)
7 views2 pages

Python Programming

This document outlines the structure and content of the Term End Examination for the M.C.A. (Semester-II) course on Python Programming, held in July 2022. It includes instructions for candidates, a variety of questions covering Python concepts, and options for solving different questions. The exam consists of multiple-choice questions, programming tasks, and theoretical questions related to Python programming principles.

Uploaded by

shivanikhatik
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)
7 views2 pages

Python Programming

This document outlines the structure and content of the Term End Examination for the M.C.A. (Semester-II) course on Python Programming, held in July 2022. It includes instructions for candidates, a variety of questions covering Python concepts, and options for solving different questions. The exam consists of multiple-choice questions, programming tasks, and theoretical questions related to Python programming principles.

Uploaded by

shivanikhatik
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

Total No.

of Questions: 9] Seat No:

TERM END EXAMINATION (JULY 2022)


M.C.A. (Semester- II)
IT-21: Python Programming (2020 CBCS Pattern)

Time: 3.00 Hours] [Max. Marks : 50

Instructions to the candidates:

1) Questions Q.1 is compulsory.


2) Solve Q.2 or Q.3, Q.4 or Q.5, Q.6 or Q.7, Q.8 or Q.9.
3) Neat diagrams must be drawn wherever necessary.

A
4) Assume suitable data wherever necessary.

Q1) Answer any Ten out of Fithteen from the following. (1 Marks Each)

M
1. Is Python case sensitive when dealing with identifiers?
a) yes b) no c) machine dependent d) none of the mentioned

2. Which of the following is invalid?


a) _a = 1 b) __a = 1 c) __str__ = 1 d) none of the mentioned

3. Which of the following is an invalid statement?

IB
a) abc = 1,000,000 b) a b c = 1000 2000 3000 c) a,b,c = 1000, 2000, 3000 d) a_b_c = 1,000,000

4. What is the result of cmp(3, 1)?


a) 1 b) 0 c) True d) False
S
5. Which of the following statements create a dictionary?
a) d = {} b) d = {“john”:40, “peter”:45} c) d = {40:”john”, 45:”peter”} d) All of the mentioned
N

6. Which of the following is a Python tuple?


a) [1, 2, 3] b) (1, 2, 3) c) {1, 2, 3} d) {}
RE

7. What is the output of “hello”+1+2+3 ?


A. hello123 B. hello C. Error D. hello6

8. _____ is used to create an object.


a) class b) constructor c) User-defined functions d) In-built functions

9. _____ represents an entity in the real world with its identity and behavior.
PI

a) A method b) An object c) A class d) An operator

10. Which block lets you test a block of code for errors?
A. try B. except C. finally D. None of the above

11. Which of the following does not correctly create an object instance?
A. puppy = Dog("Jamie") B. dog = Dog("Jamie")
C. jamie = Dog() D. pupper = new Dog("Jamie")

12. _________ is not a keyword, but by convention it is used to refer to the current instance (object) of a class.
A. class B. def C. self D. init
13. Which of the following is the correct way to define an initializer method?
A. def __init__(title, author):
B. def __init__(self, title, author):
C. def __init__():
D. __init__(self, title, author):

14. Which of the following is required to create a new instance of the class?
A. A constructor B. A class C. A value-returning method D. A None method

15. Which of these about a set is not true?


a) Mutable data type b) Allows duplicate values c) Data type with unordered values d) Immutable data
type

Q2) A) What is a function? Explain code reuse. Explain with example (6 Marks)

A
B) Explain Lambda function with an example (4 Marks)
OR
Q3. A) Differentiate between Local & Global variables. Write a python program to demonstrate the difference

M
between local and global variables. (5 Marks)
B) Explain keyword arguments in python. Write a python program to demonstrate keyword arguments. (5 Marks)

Q4. A) Write a python program using a function to find the greatest of three numbers by passing numbers as
arguments.

IB
Q5. A) What will be the output of the following statement
S = “Welcome to Python”.
OR
(5 Marks)
B) Write a python program to find whether a given character is present in a string or not. In case it is present print
the index at which it is present. Do not use the built in string method. (5 Marks)

(5 Marks)
S
i) Print (s[1:9])
ii) Print (s[4: ])
iii) Print (s[ :6])
N
iv) Print (“Come” not in str)
v) Print (s[1: –1])

B) Write a python program to check whether a given string starts with a specified character. (5 Marks)
RE

Q6. A) Justify the statement “Inheritance helps to make reusable code” (5 Marks)
B)Write a python program that uses class to store exam numbers and marks of four subjects. Use a list to store the
marks of four subjects. (5 Marks)
OR
Q7. A) Explain following Terms : (4 Marks)
PI

i) Data Abstraction & Encapsulation


ii) Polymorphism
B) Write a python program to create a class car with two attributes: name & cost. Create two objects and display
information. (6 Marks)

Q8. A) Why do we need files? Explain relative and absolute path in files. (4 Marks)
B) Describe the need for catching exceptions using try and except statements. (6 Marks)
OR
Q9. A) Differentiate between text and binary files. Explain any 4 access modes used in python. (4 Marks)
B) Explain about the different types of Exceptions in Python. (6 Marks)
*********

You might also like