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

Python Programming Exam Guidelines

The document outlines an examination format for a Python programming course, detailing the structure, instructions, and types of questions to be answered. It includes sections for multiple-choice questions, programming tasks, and theoretical explanations, with specific marks allocated for each section. The exam prohibits electronic devices and requires answers to be presented clearly with appropriate sketches where necessary.

Uploaded by

ag0517786
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 views3 pages

Python Programming Exam Guidelines

The document outlines an examination format for a Python programming course, detailing the structure, instructions, and types of questions to be answered. It includes sections for multiple-choice questions, programming tasks, and theoretical explanations, with specific marks allocated for each section. The exam prohibits electronic devices and requires answers to be presented clearly with appropriate sketches where necessary.

Uploaded by

ag0517786
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

22616

21222
3 Hours / 70 Marks Scat No.
15 minutes extra for each hour

Instructions — (1) All Questions are Compulsory.

(2) Answer each next main Question on a new page.


(3) Illustrate your answers with neat sketches wherever
necessary.
(4) Figures to the right indicate full marks.

(5) Assume suitable data, if necessary.


(6) Mobile Phone, Pager and any other Electronic
Communication devices are not permissible in
Examination Hall.

Marks

1. Attempt any FIVE of the following: 10

a) Name different modes of python.

b) List identity operators in python.


c) Give two differences between list and tuple.

d) Explain Local and Global variable.

e) Define class and object in python.

f) How to give single and multiline comment in python.

g) List different modes of opening file in python.

PTO
22616 [2]
Marks
Attempt any THREE of the following: 12

a) Write a program to print following:


1
1 2
1 2 3
1 2 3 4
Explain four Buit-in tuple functions python with example.
Explain how to use user defined function in python with
example.
Write a program to create class EMPLOYEE with ID and
NAME and display its contents.

Attempt any THREE of the following: 12


List Data types used m python. Explain any two with
example.
Explain membership and assignment operators with example.
Explain indexing and slicing in list with example.
Write a program for importing module for addition and
substraction of two numbers.

Attempt any THREE of the following: 12

a) Write a program to create dictionary of students that


includes their ROLL NO. and NAME.
i) Add three students in above dictionary
i) Update name = ‘Shreyas’ of ROLL NO = 2
iii) Delete information of ROLL NO = 1
Explain decision making statements If-else, if-elif-else with
example.
Explain use of format () method with example.
Explain building blocks of python.
Write a program illustrating use of user defined package in
python.
22616 [3]
Marks
Attempt any TWO of the following: 12
a) Write the output of the following:

) >>>a=1[251,3,609 7]
>>>a[2: 6] =[2 4,9 0]
>>> print (a)

ii) >>> b = [“Hello” , “Good”]


>>> b. append (“python”)
>>> print (b)

iif) >>>t = [3,5,6,7]


>>> print (t; [2])
>>> print (t; [-1])
>>> print (t; [2:])
>>> print (t; [:])

b) Explain method overloading in python with example.


) Write a program to open a file in write mode and append
some contents at the end of file.

Attempt any TWO of the following: 12


Explain package Numpy with example.
Write a program to implement the concept of inheritance in
python.
Explain Try-except block used in exception handling in
python with example.

Common questions

Powered by AI

Tuples and dictionaries in Python serve different purposes. Tuples are ordered, immutable sequences mainly used for storing collections of items where the order is significant and immutability offers performance benefits. In contrast, dictionaries store key-value pairs that allow for fast retrieval based on the key and are mutable. When choosing between the two, one must consider the need for ordering, immutability, and the requirement for fast access or updates. Dictionaries are preferable for tasks involving dynamic modifications and retrieval operations, while tuples are suitable for static collections.

Identity operators in Python, 'is' and 'is not', are used to compare the memory locations of two objects, rather than their values. This can be more efficient than comparing equality (using '=='), especially for large or complex data structures. By evaluating object identity, Python doesn't need to compare the internal data, which can save processing time and resources. This is particularly useful when checking if two variables point to the same object in memory.

Exception handling using try-except blocks allows a program to respond to and recover from unexpected errors without crashing. By anticipating potential points of failure and providing code to handle exceptions, programs can maintain functionality even in adverse conditions. This results in a more resilient user experience as the program can continue operating or gracefully notify the user of any issues without abrupt termination, thus contributing to robust program design.

Local variables are preferred when the data needs to be encapsulated within a specific function or block, ensuring that changes to the variable don't affect other parts of the program. They help avoid unintended interactions between different functions and keep the code modular and easier to understand. This use also enhances code reusability and debugging since local variables are confined to their scope and won't interfere with other parts of the program. Global variables, while accessible throughout the program, can lead to complex interactions and are harder to track and debug.

User-defined packages in Python allow programmers to organize and modularize code, making it easier to manage and maintain, especially in large-scale projects. They facilitate code reuse across different parts of a project or even in different projects, ensure namespace separation, and improve readability and structure. Using packages, developers can separate concerns effectively, thus enhancing collaboration in team environments and aiding in efficient debugging and testing processes.

The format() method in Python offers flexibility in string formatting, allowing for complex replacement and formatting tasks to be handled easily. It enables embedding expressions inside string literals, hence reducing cluttered code. However, it may be less efficient for very simple string replacements as compared to f-strings in versions of Python 3.6 and above, which provide a more concise and readable way to format strings. Additionally, format() expressions can become unwieldy and hard to read if used excessively on a single line.

Tuples are used in Python for grouping data. They are created by placing a sequence of items separated by commas within parentheses. Built-in functions include len(), which returns the number of elements; max() and min(), which return the maximum and minimum values, respectively; and sum(), which calculates the sum of tuple items. These functions are useful in scenarios where the data sequence is immutable, for example, when representing a fixed collection of static data such as geographic coordinates or RGB color values, ensuring data integrity by preventing modifications.

Indexing and slicing are fundamental for accessing and manipulating data in Python lists. Indexing allows accessing individual list elements by their position, whereas slicing enables extracting a subset of the list by specifying a start and end index. This functionality greatly enhances data manipulation capabilities, facilitating operations like data analysis, subset selection, and batch processing without altering the original data structure. These operations are critical in managing and reorganizing data efficiently, especially in data-intensive applications and comprehensive data analysis tasks.

Lists in Python are mutable, which means their elements can be changed after creation, whereas tuples are immutable and do not allow modification of their elements. This affects their usage as lists are more suitable for situations where the data is expected to change, whereas tuples are used for fixed data where integrity is important. The immutability of tuples also makes them slightly faster and less memory-consuming than lists.

Method overloading refers to defining multiple methods in the same class with the same name but different parameters. Python does not support traditional method overloading; instead, default parameters or variable-length arguments are used. Method overriding, however, occurs when a subclass provides a specific implementation of a method already defined in its superclass. This allows polymorphism, where a subclass can modify or enhance the behavior of the inherited method.

You might also like