Sei sulla pagina 1di 5

PYTHON APPLICATION PROGRAMMING (15CS664)

QUESTION BANK

Module 1

1. Describe the hardware architecture of a computer.


2. What is a program? Briefly discuss building blocks of a program.
3. Bring out the difference between an Interpreter and a Compiler.
4. What are various ways in which a Python program can be executed? Discuss.
5. What are the rules for naming variables in Python?
6. Write a short note on:
i) Comments in Python ii) ** and // operators
iii) Short-circuit evaluation iv) input() Function
v) Boolean values vi) Python keywords
vii) Types of Errors viii) Precedence of Operators
ix) Built-in Functions x) Random Numbers
xi) Math functions
7. When is a nested condition used? Discuss with an example.
8. Discuss exception handling in Python with an example.
9. What are fruitful functions and void functions? Give examples.
10. Explain the working of python user defined functions along with its syntax.
11. List the uses of functions in Python.

Module 2

1. Discuss looping constructs in Python.


2. In what situations, break and continue statements were used? Discuss with examples.
3. Explain different types of loop patterns in Python with suitable code.
4. How do you compare two strings in Python? Illustrate with example.
5. Discuss various built-in string functions.
6. Explain .format() with suitable examples.
7. What is a file handler? Discuss its usage in file handling.
8. Explain open() function with syntax and example.
9. Discuss pros and cons of read() function on files.
10. Discuss write() function on files with syntax and example.
11. What is the common run-time error faced while opening a file? How do you handle it?
Explain with example.
12. What is the need of close() function?
Module 3
Lists
1. Define list. How do you create an empty list? Give example.
2. Discuss different ways of traversing a list.
3. Explain + and * operations on list objects with suitable examples.
4. Discuss various built-in methods in lists.
5. What are the different ways of deleting elements from a list? Discuss with suitable
functions.
6. How do you convert a list into a string and vice-versa? Illustrate with examples.
7. Write a short note on:
a. Parsing lines
b. Object Aliasing
8. Write the differences between
a. sort() and sorted()
b. b) append() and extend()
c. c) join() and split()
9. When do we encounter TypeError, ValueError and IndexError?
10. What are identical and equivalent objects? How are they identified? give examples.
11. Consider the list scores = [5, 4, 7, 3, 6, 2, 1] and write the python code to perform the
following operations:
i) Insert an element 9 at the beginning of the list.
ii) Insert an element 8 at the index position 3 of the list.
iii) Insert an element 7 at the end of the list.
iv) Delete all the elements of the list.
v) Delete an element at the index position 3.
vi) Delete an element at the beginning of the list.

Dictionary and Tuples


12. Define a dictionary type in Python. Give example.
13. Explain get() function in dictionary with suitable code snippet.
14. Discuss the dictionary methods keys() and items() with suitable programming examples.
15. Explain various steps to be followed while debugging a program that uses large datasets.
16. Briefly discuss key-value pair relationship in dictionaries.
17. Define a tuple. Give an example to illustrate creation of a tuple.
18. What is mutable and immutable objects? Give examples.
19. Explain List of Tuples and Tuple of Lists.
20. How do you create an empty tuple and a single element tuple?
21. Explain DSU pattern with respect to tuples. Give example
22. Store the following data pairs in a list, a tuple, and a dictionary:
India 23. 91
USA 24. 1
UK 25. 41
Japan 26. 9
23. How do you create a tuple using a string and using a list? Explain with example.
24. Explain the concept of tuple-comparison. How tuple-comparison is implemented in sort()
function? Discuss.
25. Write a short note on:
a. Tuple assignment
b. Dictionaries and Tuples
26. How tuples can be used as a key for dictionaries? Discuss with example.
27. Discuss pros and cons of various sequences like lists, strings and tuples.
28. How do you debug a program containing multiple data structures with possibility of shape
errors? Discuss the steps involved.

Regular Expressions
29. What is the need of regular expressions in programming? Explain.
30. Discuss any 5 meta characters used in regular expressions with suitable example.
31. Discuss search() and findall() functions of re module.
32. What is the need of escape characters in regular expressions? Give suitable code snippet.

Module 4
1. Define class and object. Given an example for creating a class and an object of that class.
2. What are attributes? Explain with an example and respective object diagram.
3. Write a program to create a class called Point with two attributes x and y. Write following
functions and demonstrate the working of these functions by creating suitable objects.
a. To read attribute values
b. To display point as an ordered pair
c. To find distance between two points
4. Write a program to create a class called Rectangle with the help of a corner point, width
and height. Write following functions and demonstrate their working:
a. To find and display center of rectangle
b. To display point as an ordered pair
c. To resize the rectangle
5. Differentiate copy.copy() and copy.deepcopy() with suitable examples.
6. Discuss the methods isinstance(), hasattr() and vars() with suitable examples.
7. Differentiate pure functions and modifiers with suitable examples
8. Explain assert statement. Illustrate the situation of getting AssertionError exception.
9. List out the object oriented characteristics possessed by Python.
10. Differentiate methods and functions.
11. Discuss the significance of init () method in Python with a proper example code snippet.
12. Briefly discuss self keyword in Python.
13. What does str () method do in Python? Illustrate with a code snippet.
14. Discuss operator overloading. Mention any five operators with respective special functions
to be overloaded in Python.
15. Write a program to add two point objects by overloading + operator. Overload str () to
display point as an ordered pair.
16. Write a program to create a class Time to represent time in HH:MM:SS format. Perform
following operations:
a. Overload + to add two time objects
b. Overload + to add a numeric value to a time object (commutative)
c. Overload str () to display time in appropriate format
17. What is a Docstring? Why are they written?
18. What do you mean by “instance as returning value”? Explain with an example.
19. Justify the statement “Objects are mutable”.
20. What is an embedded object? Give an example.
21. When do we encounter AttributeError?
22. How do you find the memory address of an instance of a class?

Module 5
1. Write a note on HTTP.
2. Define socket. Explain relationship between user program and socket with a neat diagram.
3. Write a socket-based program to extract the data from a given webpage.
4. Write a socket-based program to retrieve image form the given webpage.
5. What is urllib? How is it different from socket?
6. Write a program to retrieve data from a webpage using urllib and to count the frequency of
words in that page.
7. Write a program to download an image from a given website using urllib.
8. How do you parse HTML using regular expressions? Write a program to illustrate the
same.
9. How do you parse HTML using BeautifulSoup? Write a program to illustrate the same.
10. Write a program to extract various parts of anchor tag using BeautifulSoup.
11. Briefly discuss XML and its tree representation with example.
12. Write a program to extract data from XML string.
13. How do you extract data from XML when XML document is containing multiple nodes?
Illustrate with a program.
14. Discuss the concept of JSON.
15. Write a program to parse data in JSON format.
16. What do you mean by API? Explain with suitable SOA diagram.
17. Write a program to extract location information using Google geocoding API.
18. Write a note on OAuth.
19. Discuss the concept of databases.
20. What are the important data types supported by SQLite?
21. How do you create a database table? Give a code snippet.
22. Explain the working of database cursor with suitable diagram.
23. Write a program to create a database StudentDB with attributes Name and Age. Insert n
records into the table and display the same.
24. What are different types of keys used in RDBMS? Explain.
25. Write a note on data modelling.
26. How do you join multiple tables? Illustrate with a program.
27. What is web scraping? Give an example.
28. Define a Port. What is the port number used in socket programming with HTTP?
29. What is a web service? Name the two formats that are used to exchange data in web.
30. Define a database.
31. What is a database management system? Give examples.
32. Explain the following database concept
a. Field b. record c. Primary Key d. table
33. What is SQL? Explain the following SQL statements
a. CREATE TABLE
b. INSERT
c. SELECT
d. DELETE
e. UPDATE

Potrebbero piacerti anche