JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD B.Tech II Year PYTHON PROGRAMMING Previous Question Paper (March - 2022 - R18)
Answer any five questions. All questions carry equal marks.
Main
Summarize the built-in functions in Python with appropriate examples.
Answer
Python provides a comprehensive set of built-in functions that are always available for use without needing to import any modules. These functions perform common tasks such as type conversion, mathematical operations, and sequence manipulation.
- Type Conversion Functions: Used to change data types. Examples include
int()
,float()
,str()
, andlist()
. Example: int('10') converts a string to an integer. - Mathematical Functions: Functions like
abs()
(absolute value),max()
(maximum value),min()
(minimum value), andpow()
(exponentiation). Example: max(1, 5, 3) returns 5. - Input/Output Functions:
print()
displays output to the console, whileinput()
captures user input as a string. - Sequence/Collection Functions:
len()
returns the length of an object,sum()
calculates the total of an iterable, andsorted()
returns a new sorted list. Example: len([1, 2, 3]) returns 3. - Utility Functions:
type()
returns the data type of an object, andid()
returns the unique memory address of an object.
Compare Lists and Tuples with an example.
Answer
Lists and Tuples are both sequence data types in Python, but they differ significantly in mutability and performance.
| Feature | List | Tuple |
|---|---|---|
| Mutability | Mutable (can be modified) | Immutable (cannot be modified) |
| Syntax | Square brackets [] | Parentheses () |
| Performance | Slower | Faster |
| Methods | Many (append, remove, pop) | Few (count, index) |
Example:
# List: Mutable my_list = [1, 2, 3] my_list[0] = 10 # Valid # Tuple: Immutable my_tuple = (1, 2, 3) # my_tuple[0] = 10 # Raises TypeError
List out and explain various types of operators used in Python.
Answer
Sign in to view the complete answer paper.
Differentiate between List Slicing and List Mutability with examples.
Answer
Sign in to view the complete answer paper.
How to create a module? Give an example.
Answer
Sign in to view the complete answer paper.
Illustrate how to handle an exceptions in python.
Answer
Sign in to view the complete answer paper.
How to create a text file and write content in to the text file? Explain with a python script.
Answer
Sign in to view the complete answer paper.
What are the various file opening modes in python?
Answer
Sign in to view the complete answer paper.
Discuss about various types of regular expressions in python.
Answer
Sign in to view the complete answer paper.
Write about Global Interpreter Lock.
Answer
Sign in to view the complete answer paper.
Discuss about all the methods in Thread module.
Answer
Sign in to view the complete answer paper.
Write a python script for Inter process communication.
Answer
Sign in to view the complete answer paper.
How to build a CGI application in Python?
Answer
Sign in to view the complete answer paper.
Write a program to demonstrate a group of check button widgets.
Answer
Sign in to view the complete answer paper.
Write a python script to create a table, insert and display data from the database.
Answer
Sign in to view the complete answer paper.
Explain various keys and constraints used in SQLite while creating relations.
Answer
Sign in to view the complete answer paper.