Python Programming
Instructions:
- The marks are indicated in the right-hand margin.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
-
Python uses __________ to define blocks of code
-
The operator used for exponentiation is
-
The default step value in slicing is
-
Strings in Python are
-
Negative indexing begins from
-
Dictionaries store data in the form of
-
The function used to combine two sequences into pairs is
-
Pickle module is mainly used for
-
CSV stands for
-
Python is known as a __________ typed language.
-
Explain the different features of Python Programming language. What are the different arithmetic operators in Python? Explain their precedence and associativity.
[7] -
What are the basic data types in Python? How does Python decide the type of any variable? How a float is converted to an integer? Explain.
[7]
-
Evaluate the importance of user-defined functions in Python. Compare them with built-in functions and discuss situations where each should be preferred.
[7] -
Assess the significance of string slicing, indexing and formatting in Python. Demonstrate the output of the following statements and justify your answers.
s = "Programming" print(s[2:8]) print(s[-5:]) print(s[::-1])
[7]
-
Differentiate between Lists, Tuples and Sets on the basis of syntax, mutability, indexing, performance and applications. Support your comparison with suitable examples.
[7] -
Construct a Python program that creates a dictionary containing employee ID, employee name and salary. Display all records and update the salary of a given employee using suitable dictionary methods.
[7]
-
Write a python program to find Greatest Common Divisor of two numbers.
[7] -
Illustrate with suitable examples the following list methods in Python:
[7]
(i) insert (ii) append (iii) pop (iv) extend
-
Write the differences between the
[7]if,if-elseandif-elif-elsestatements in Python. Provide code examples to demonstrate the usage and scenarios where each statement is preferred. -
Explain the utility of
[7]breakandcontinuestatement with an example.
-
What is dictionary and how it is created in Python? What is meant by key-value pairs in a dictionary? How does
[7]deloperation work on dictionaries? Give an example. -
Write a python program to read two numbers. Then find out whether the first number is a multiple of the second number.
[7]
-
Design a Python program to create a text file, write the details of ten students into it, and subsequently read the stored data. Discuss the sequence of file operations involved in the program.
[7] -
Justify the significance of the
[7]osandos.pathmodules in Python. Demonstrate the use of suitable functions to create directories, determine file paths and verify file existence.
Dynamic and Strongly Typed Language
Type Conversion
Scope and Lifetime of Variables
CSV File Handling
