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

Python Programming Descriptive QBank CIE-I April 2024 Lastupdated 23-04-2024 2PM

This file consists of python programming description

Uploaded by

pallavi.baj05
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Python Programming Descriptive QBank CIE-I April 2024 Lastupdated 23-04-2024 2PM

This file consists of python programming description

Uploaded by

pallavi.baj05
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Department of Computer Science and Engineering (Artificial Intelligence & Machine Learning)

Python Programming – II Year B.Tech II Semester


Course Instructor: Prof.B.Sreenivasu, 9502251564, 9550411738
Descriptive Question Bank for CIE-I, April,2024
----------------------------------------------------------------------------------------------------------------------------------
UNIT-I:
Python Basics: Objects- Python Objects, Standard Types, Other Built-in Types, Internal Types,
Standard Type Operators, Standard Type Built-in Functions, Categorizing the Standard Types,
Unsupported Types
Numbers: Integers, Floating Point Real Numbers, Complex Numbers, Operators, Built-in Functions,
Related Modules
Sequences - Strings, Lists, and Tuples, Mapping and Set Types
----------------------------------------------------------------------------------------------------------------------------------
1. a) List built-in data types of Python?
b) What are the sequences in Python.
2. a) Explain the features of Python Programming in detail.
b) Write a Python program to print all prime numbers in a given interval (use break).
3. a) Discuss about logical operators in Python with examples.
b) What is the need of Dictionaries?
4. What do you understand by mutable and immutable objects in python. Explain in details
with suitable programming exercises.
5. a) Write a Program to Check is a nested list is a subset of another nested list.
b) How to create user defined function? Explain with suitable examples.
6. Rohan is a mathematics enthusiast who has a particular fondness for numbers. His favorite
numbers are those positive numbers whose only lucky digits in the decimal notation are 4
and 7. For example, numbers like 47, 744, and 4 are considered to be lucky, while numbers
like 5,17, and 467 are considered unlucky. Write a python program to find whether input
number is lucky number or not.
7. a) Write a Python program to count vowels in input string.
b) Write a function called is_sorted that takes a list as a parameter and returns True if the list
is sorted in ascending order and False otherwise.
8. Explain use of Built-in functions (BIFs) or Built-in Methods (BIMs) ord( ) and chr( ) with an
examples.
9. a) Write a short note on control statements in Python.
b) What is the difference between indexing and slicing?
10. When Snigdha was walking through the market, she unexpectedly came across a sign stating
that everyone whose birthdate falls on a leap year will receive free food. Although having
Python Programming by Prof.B.Sreenivasu Sreyas Institute of Engineering and Technology (Autonomous), Hyderabad Page 1 of 4
free food is not a wonderful opportunity Snigdha has no idea how to tell if the year, she was
born was a leap year or not. Write a Python to solve above mentioned task.
11. Ram is a student who often gets confused with lowercase and uppercase letters. He has
decided to write an algorithm to resolve this issue. Given a string, you are required to
determine whether it should be converted to all uppercase or all lowercase, depending on
the count of uppercase and lowercase letters in the string. Write a Python program to Return
the corrected string. If the given string has more uppercase letters than lowercase letters,
return it in all uppercase. Otherwise, return it in all lowercase.
12. What is a List? Write a Python code to create a List and perform the following commands on
list object.
i) append ii) print iii) insert iv) remove v) sort vi) pop vii) reverse
13. a) What are the various types of Numbers supported by Python? Explain each with an
example.
b) What is range data type in python? Explain.
14. What are various operations that can be performed on sets. Explain with suitable examples.
15. Write a Python program to print the Fibonacci sequence using while loop.
16. Write a Python program to input string and count lower case alphabetic character, upper
case alphabetic character, digits, white space characters and special characters.
17. What are the different ways to access contents of list. Explain with suitable examples.
18. Write a Python program to create (develop) a user defined function called palindrome that
takes a string argument and returns True if it is a palindrome and False Otherwise.
19. a) Explain built-in data types of python.
b) What are the sequences in Python. Explain with suitable examples.
20. Print following Floyd’s triangle pattern using for loop.
1
23
456
7 8 9 10
11 12 13 14 15
21. a) Write a program to enter any character. Check whether the entered character is in the lower
case. If it is in the lower case, then covert it into upper case & if it is an uppercase character
convert into the lowercase.
b) Explain string slicing in python with examples.
22. What are the Mathematical Set operations in Python. Explain with examples.
23. Write a python program to solve following task. The students of University College have
subscriptions to English and French newspapers. Some students have subscribed only to
English, some have subscribed only to French, and some have subscribed to both
Python Programming by Prof.B.Sreenivasu Sreyas Institute of Engineering and Technology (Autonomous), Hyderabad Page 2 of 4
newspapers. You are given two sets of student roll numbers. One set has subscribed to the
English newspaper, one set has subscribed to the French newspaper. Your task is to find the
total number of students who have subscribed to both newspapers.
24. Write a python program to read dictionary values from the user. Create a function called
‘invert_dict’ to invert its content i.e., keys should be values and values should be keys. (use
dictionary comprehension)
----------------------------------------------------------------------------------------------------------------------------------
UNIT-II:
FILES: File Objects, File Built-in Function, File, File Built-in Attributes, Standard Files, Command-
line Arguments.
Exceptions: Exceptions in Python, Detecting and Handling Exceptions, Context Management,
*Exceptions as Strings, Raising Exceptions, Assertions, Standard Exceptions, *Creating Exceptions.
Modules: Importing Modules, Importing Module Attributes, Module Built-in Functions, Packages.
----------------------------------------------------------------------------------------------------------------------------------
1. Write file access modes, all built-in functions of files. Demonstrate with a program.
2. Explain purpose of file built-in functions in python seek(), tell(), truncate() methods with
Programs.
3. Create a python program that reads the file line by line and prints count of number of lines.
4. What are the File built-in attributes and write python program to read values of all file built-
in attributes.
5. Write a Python Program that reads data from a file and write into other file but in reverse
order.
6. Write a program with command line argument to count the length of the command line
arguments.
7. Implement the custom exception (User defined exception). Create an exception called
‘myindexerrror’. What will be the output of the program if the user inputs 3 and if the user
inputs 6. When list l1=[100,200,300,400].
8. Write a Python Program to demonstrate use of python keyword ‘assert’ and ‘raise’.
9. Create a user defined module (custom module) that holds the functions for performing
arithmetic operations.
10. Explain sys module and command line arguments.
11. Write Python Program to Count number of lines in a file.
12. Illustrate on how to raise exception (use python keyword raise) with suitable examples.
13. Write a program to print sum of all given inputs using command line arguments.
14. Write Python program to create user defined exception (using exception class).
15. Explain about standard exceptions in python.
16. Write a program to illustrate “FileNotFoundError” exception.
Python Programming by Prof.B.Sreenivasu Sreyas Institute of Engineering and Technology (Autonomous), Hyderabad Page 3 of 4
17. Discuss how module attributes can be accessed in python with suitable examples.
18. What is the purpose of a python keyword assert in exceptions. Explain with suitable
examples.
19. a) Explain the concept of context management in Python exception handling.
b) Write a python program for handling FileNotFoundError Exception.
20. Create python script that handles multiple exceptions with separate except blocks.
----------------------------------------------------------------------------------------------------------------------------------
UNIT-III:
Regular Expressions: Introduction, Special Symbols and Characters, Res and Python
Multithreaded Programming: Introduction, Threads and Processes, Python, Threads, and the
Global Interpreter Lock, Thread Module, Threading Module, Related Modules.
----------------------------------------------------------------------------------------------------------------------------------
1. a) Describe the significance of Special symbols and characters.
b) Describe all the Regular Expressions functions with suitable programs and Meta characters
in Python.
2. Consider following python code snippet: What would be the output:
import re
#Split the string at every white-space character
string = "Python and Java are most popular object oriented programming languages"
regex_pattern=r”\s”
result = re.split(regex_pattern, string)
print(result)
3. What are regular expressions? How to validate whether an email-id and Phone number
entered by user are valid or not using Python ‘re’ module.
4. What is regex special sequences in Python, and how are they employed in pattern matching?
Provide examples illustrating the application of special sequences.
5. Define regular expressions.
6. Explain in-detail about RegEx special sequences and sets in RegEx.
7. Write a python program to remove all white spaces from a string.
8. Python program to print words that starts with “na” and ends with “ra” using regular
expression.
9. Describe the significance of regex meta-characters in Python and provide examples
demonstrating the functionality of characters such as . (dot), * (zero or more occurrences),
and + (one or more occurrences).
10. Discuss the functionality of RegEx functions such as re.match(), re.search(), re.findall(), and
re.sub() in Python. Provide examples illustrating their usage.
----------------------------------------------------------------------------------------------------------------------------------
Python Programming by Prof.B.Sreenivasu Sreyas Institute of Engineering and Technology (Autonomous), Hyderabad Page 4 of 4

You might also like