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

php 2.

The document outlines the examination instructions for a Programming with Python course, emphasizing keyword-based assessment rather than strict adherence to model answers. It includes guidelines for evaluating various answer types, such as figures and programming tasks, and notes the acceptance of bilingual responses. Additionally, it provides sample questions and marking schemes for the exam, covering topics like Python modes, operators, variables, classes, comments, and file handling.

Uploaded by

adifitness445
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)
9 views

php 2.

The document outlines the examination instructions for a Programming with Python course, emphasizing keyword-based assessment rather than strict adherence to model answers. It includes guidelines for evaluating various answer types, such as figures and programming tasks, and notes the acceptance of bilingual responses. Additionally, it provides sample questions and marking schemes for the exam, covering topics like Python modes, operators, variables, classes, comments, and file handling.

Uploaded by

adifitness445
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

SUMMER-2022 EXAMINATION

Subject Name: Programming with Python Model Answer Subject Code: 22616

Important Instructions to examiners:


1. The answers should be examined by key words and not as word-to-word as given in
the model answer scheme.
2. The model answer and the answer written by candidate may vary but the examiner
may try to assess the understanding level of the candidate.
3. The language errors such as grammatical, spelling errors should not be given more
Importance (Not applicable for subject English and Communication Skills.
4. While assessing figures, examiner may give credit for principal components
indicated in the figure. The figures drawn by candidate and model answer may vary.
The examiner may give credit for any equivalent figure drawn.
5. Credits may be given step wise for numerical problems. In some cases, the assumed
constant values may vary and there may be some difference in the candidate’s
answers and model answer.
6. In case of some questions credit may be given by judgement on part of examiner of
relevant answer based on candidate’s understanding.
7. For programming language papers, credit may be given to any other program based
on equivalent concept.
8. As per the policy decision of Maharashtra State Government, teaching in
English/Marathi and Bilingual (English + Marathi) medium is introduced at first year
of AICTE diploma Programme from academic year 2021-2022. Hence if the students
in first year (first and second semesters) write answers in Marathi or bilingual
language (English +Marathi), the Examiner shall consider the same and assess the
answer based on matching of concepts with model answer.

Q. Sub Answer Marking Scheme


No. Q. N.
1 Attempt Any FIVE of the following 10
a) Name different modes of Python 2M (1m each)
Python has two basic modes:
• Script (Normal Mode)
• Interactive Mode
b) List identity operators in python 2M (1m each)
Identity operators in Python are
• is
• is not
c) Give two differences between list and tuple 2M (1m for each
List Tuple difference, any 2
Lists are mutable Tuples are immutable difference)
Lists consume more memory Tuple consume less memory
as compared to the list
Lists have several built-in Tuple does not have many
methods built-in methods.
The unexpected changes and In tuple, it is hard to take
errors are more likely to occur place.

Page 1 of 23
The List has the variable The tuple has the fixed length
length
List operations are more error Tuples operations are safe
prone.
Lists can be used to store Tuples are used to store only
homogeneous and heterogeneous elements.
heterogeneous elements.
List is useful for insertion and Tuple is useful for readonly
deletion operations. operations like accessing
elements.
List iteration is slower and is Tuple iteration is faster.
time consuming.
d) Explain Local and Global variable 2M (1m each)
Local Variables: Local variables are those which are initialized
inside a function and belongs only to that particular function. It
cannot be accessed anywhere outside the function
Example:
def f():
# local variable
s = "I love Python Programming"
print(s)
# Driver code
f()
Output
I love Python Programming

Global Variables: The global variables are those which are defined
outside any function and which are accessible throughout the
program i.e. inside and outside of every function.
Example:
# This function uses global variable s
def f():
print("Inside Function", s)

# Global scope
s = "I love Python Programming"
f()
print("Outside Function", s)

Output:
Inside Function I love Python Programming
Outside Function I love Python Programming
e) Define class and object in python 2M (Any suitable
Class: A class is a user-defined blueprint or prototype from which definition: 1M
objects are created. Classes provide a means of bundling data Each)
and functionality together.

Object: An object is an instance of a class that has some


attributes and behavior. Objects can be used to access the
attributes of the class.

Page 2 of 23
f) How to give single and multiline comment in Python 2M (1m each)
Single line comment: Single-line comments are created simply by
beginning a line with the hash (#) character, and they are
automatically terminated by the end of line.
Example:
# print is a statement
print(‘Hello Python’)

Multi line comment: Python multi-line comment is a piece of text


enclosed in a delimiter (""") Triple quotation marks.
Example:
""" Multi-line comment used
print("Python Comments") """
or
To add a multiline comment you could insert a # for each line:
Example:
#This is a comment
#written in
#more than just one line
print("Hello, World!")
g) List different modes of opening file in Python 2M
Modes for opening file: (Any 2 names 2M)
• r: open an existing file for a read operation.
• w: open an existing file for a write operation. If the file
already contains some data then it will be overridden.
• a: open an existing file for append operation. It won’t
override existing data.
• r+: To read and write data into the file. The previous
data in the file will be overridden.
• w+: To write and read data. It will override existing data.
• a+: To append and read data from the file. It won’t
override existing data.

2 Attempt any THREE of the following 12


a) Write a program to print following 4M (for correct
1 program and
12 logic)
123
1234

for i in range(1,5):
for j in range(1,i+1):
print(j,end=' ')
print()
b) Explain four Buit-in tuple functions in python with example 4M ( 1M for each
function with
example)

Page 3 of 23

You might also like