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

Python Application Programming (15CS664) : Question Bank For The Subject

This document contains a question bank for the subject "Python Application Programming" divided into two modules. Module 1 contains 33 questions related to object-oriented programming concepts in Python like classes, objects, methods, inheritance, operator overloading etc. Module 2 contains 30 questions related to web scraping, APIs, databases and socket programming in Python. The document also lists 3 assignments to be submitted by students before a specified date, involving errors in Python, conditional statements, regular expressions, dictionaries and classes.

Uploaded by

Heena
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)
97 views3 pages

Python Application Programming (15CS664) : Question Bank For The Subject

This document contains a question bank for the subject "Python Application Programming" divided into two modules. Module 1 contains 33 questions related to object-oriented programming concepts in Python like classes, objects, methods, inheritance, operator overloading etc. Module 2 contains 30 questions related to web scraping, APIs, databases and socket programming in Python. The document also lists 3 assignments to be submitted by students before a specified date, involving errors in Python, conditional statements, regular expressions, dictionaries and classes.

Uploaded by

Heena
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
You are on page 1/ 3

Question Bank for the subject

Python Application Programming (15CS664)

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
Assignments (To be submitted on or before 22nd May 2018)
Assignment 1:
1. Mention with an example three types of general errors in python.
2. Describe with syntax conditional execution and alternative execution.
3. Differentiate chained and Nested conditionals.
Assignment 2:

1. Write a program which repeatedly reads numbers until the user enters “done”. Once
“done” is entered, print out the total, count, and average of the numbers. If the user enters
anything other than a number, detect their mistake using try and except and print an error
message and skip to the next number.
2. Mention the regular expression for the following pattern
a. Starts with a number followed by minimum of six characters
b. Having only alphabets and ending with rns
c. Having four spaces , followed by special characters
d. Beginning with (( and having multiple characters
3. List the salient features of Dictionaries over Lists. Explain how in operator work with
dictionaries with an example.
Assignment 3:

1. Write a short note on:


a. Deep copy b. Shallow copy c. isinstance() d. hasattr()
2. Write a definition for a class named Circle with attributes center and radius, where center
is a Point object and radius is a number.
a. Instantiate a Circle object that represents a circle with its center at (150, 100) and
radius 75.
b. Write a function named point_in_circle that takes a Circle and a Point and returns
True if the Point lies in or on the boundary of the circle.
c. Write a function named rect_in_circle that takes a Circle and a Rectangle and
returns True if the Rectangle lies entirely in or on the boundary of the circle.
d. Write a function named rect_circle_overlap that takes a Circle and a Rectangle
and returns True if any of the corners of the Rectangle fall inside the circle. Or as
a more challenging version, return True if any part of the Rectangle falls inside
the circle.

ALL THE BEST FOR EXAMS!!

You might also like