Nothing Special   »   [go: up one dir, main page]

Python Programming

Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

PYTHON PROGRAMMING

Subject Code: CS721PE


Regulations : R16 - JNTUH
Class: IV Year B.Tech CSE I Semester

Department of Computer Science and Engineering


BHARAT INSTITUTE OF ENGINEERING AND
TECHNOLOGY Ibrahimpatnam - 501 510, Hyderabad
PYTHON PROGRAMMING (CS721PE)
COURSE PLANNER
I.COURSE OVERVIEW:
Python Programming is intended for software engineers, systems analysts, program
managers and user support personnel who wish to learn the Python programming language. This
Python for beginners training course leads the students from the basics of writing and running
Python scripts to more advanced features such as file operations, regular expressions, working
with binary data, and using the extensive functionality of Python modules. Extra emphasis is
placed on features unique to Python, such as tuples, array slices, and output formatting.
II.PRE-REQUISITES:
Experience with a high level language (C/C++, Java, MATLAB) is suggested. Prior
knowledge of a scripting language (Perl, UNIX/Linux shells) and Object-Oriented concepts is
helpful but not mandatory.
III. COURSE OBJECTIVIES:
• To be able to introduce core programming basics and program design with functions
using Python programming language.
• To understand a range of Object-Oriented Programming, as well as in-depth data and
information processing techniques.
• To understand the high-performance programs designed to strengthen the practical
expertise.

This course PYTHON PROGRAMMING is an essential part of any Computer-Science


education. To master the fundamentals of writing Python scripts, learn core Python scripting
elements such as variables and flow control structures, discover how to work with lists and
sequence data, write Python functions to facilitate code reuse ,use Python to read and write files,
make their code robust by handling errors and exceptions properly, work with the Python
standard library, explore Python's object-oriented features , search text using regular expressions
and finally working with GUI (Graphical User Interfaces)

S. No. Course Outcomes (CO)


After completing this course the student must demonstrate the knowledge and ability to:
Examine Python syntax and semantics and be fluent in the use of Python flow
CO1
control and functions.
CO2 Demonstrate proficiency in handling Strings and File Systems.
Create, run and manipulate Python Programs using core data structures like Lists,
CO3
Dictionaries and use Regular Expressions.
CO4 Interpret the concepts of Object-Oriented Programming as used in Python.
Implement exemplary applications related to Network Programming, Web Services
CO5
and Databases in Python.
V. How Program Outcomes are Assessed:
Proficiency
Program Outcomes (PO) Level
assessed by
PO1 Engineering knowledge: Apply the knowledge of
Assignments,
mathematics, science, engineering fundamentals, and an
2 Tutorials,
engineering specialization to the solution of complex
Mock Tests
engineering problems.
PO2 Problem analysis: Identify, formulate, review research
literature, and analyze complex engineering problems Assignments,
2
reaching substantiated conclusions using first principles of Tutorials
mathematics, natural sciences, and engineering sciences.
PO3 Design/development of solutions: Design solutions for
complex engineering problems and design system Assignments,
components or processes that meet the specified needs with 3 Tutorials,
appropriate consideration for the public health and safety, and Mock Tests
the cultural, societal, and environmental considerations.
PO4 Conduct investigations of complex problems: Use
Assignments,
research-based knowledge and research methods including
3 Tutorials,
design of experiments, analysis and interpretation of data,
Mock Tests
and synthesis of the information to provide valid conclusions.
PO5 Modern tool usage: Create, select, and apply appropriate
Assignments,
techniques, resources, and modern engineering and IT tools
2 Tutorials,
including prediction and modeling to complex engineering
Mock Tests
activities with an understanding of the limitations.
PO6 The engineer and society: Apply reasoning informed by the
Assignments,
contextual knowledge to assess societal, health, safety, legal
3 Tutorials,
and cultural issues and the consequent responsibilities
Mock Tests
relevant to the professional engineering practice.
PO7 Environment and sustainability: Understand the impact of
the professional engineering solutions in societal and
- -
environmental contexts, and demonstrate the knowledge of,
and need for sustainable development.
PO8 Ethics: Apply ethical principles and commit to professional
ethics and responsibilities and norms of the engineering - -
practice.
PO9 Individual and team work: Function effectively as an
individual, and as a member or leader in diverse teams, and in - -
multidisciplinary settings.
PO10 Communication: Communicate effectively on complex
engineering activities with the engineering community and
with society at large, such as, being able to comprehend and
- -
write effective reports and design documentation, make
effective presentations, and give and receive clear
instructions.
Proficiency
Program Outcomes (PO) Level
assessed by
PO11 Project management and finance: Demonstrate knowledge
and understanding of the engineering and management Assignments,
principles and apply these to one’s own work, as a member 2 Tutorials,
and leader in a team, to manage projects and in Mock Tests
multidisciplinary environments.
PO12 Life-long learning: Recognize the need for, and have the
preparation and ability to engage in independent and life-long - -
learning in the broadest context of technological change.
VI.HOW PROGRAM SPECIFIC OUTCOMES ARE ASSESSED:
Proficiency
Program Specific Outcomes (PSO) Level
assessed by
PSO1 Foundation of mathematical concepts: To use
Assignments,
mathematical methodologies to crack problem using
2 Tutorials,
suitable mathematical analysis, data structure and suitable
Mock Tests
algorithm.
PSO2 Foundation of Computer System: The ability to interpret
the fundamental concepts and methodology of computer Assignments,
2
systems. Students can understand the functionality of Tutorials
hardware and software aspects of computer systems.
PSO3 Foundations of Software development: The ability to
grasp the software development lifecycle and
methodologies of software systems. Possess competent Assignments,
skills and knowledge of software design process. 3 Tutorials,
Familiarity and practical proficiency with a broad area of Mock Tests
programming concepts and provide new ideas and
innovations towards research.
1: Slight 2: Moderate
(Low) (Medium) 3: Substantial (High) - : None

VII. SYLLABUS:
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 - Introduction to Numbers, Integers, Floating Point Real Numbers, Complex Numbers,
Operators, Built-in Functions, Related Modules
Sequences - Strings, Lists, and Tuples, Mapping and Set
Types UNIT - II
FILES: File Objects, File Built-in Function [ open() ], File Built-in Methods, File Built-in
Attributes, Standard Files, Command-line Arguments, File System, File Execution, Persistent
Storage Modules, Related Modules
Exceptions: Exceptions in Python, Detecting and Handling Exceptions, Context Management,
*Exceptions as Strings, Raising Exceptions, Assertions, Standard Exceptions, *Creating
Exceptions, Why Exceptions (Now)?, Why Exceptions at All?, Exceptions and the sys Module,
Related Modules
Modules: Modules and Files, Namespaces, Importing Modules, Importing Module Attributes,
Module Built-in Functions, Packages, Other Features of Modules
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
UNIT - IV
GUI Programming: Introduction, Tkinter and Python Programming, Brief Tour of Other GUIs,
Related Modules and Other GUIs
WEB Programming: Introduction, Wed Surfing with Python, Creating Simple Web Clients,
Advanced Web Clients, CGI-Helping Servers Process Client Data, Building CGI Application
Advanced CGI, Web (HTTP) Servers
UNIT – V
Database Programming: Introduction, Python Database App lication Programmer’s
Interface (DB-API), Object Relational Managers (ORMs), Related Modules
Textbook
1. Core Python Programming, Wesley J. Chun, Second Edition, Pearson.
VIII. LESSON PLAN:

Teachingmethodo

References
Week No

logy
SNO

Topic to be covered Learning Objectives

UNIT-I
Introduction to python Explain python programming Chalk and
1 programming introduction Talk
Define basics in python Chalk and
Talk &
2 Python Basics PPT
1 Understand objects in python Chalk and
3 Objects- Python Objects Talk
T1
Illustrate standard data types Chalk and
4 Standard Types Talk
Other Built-in Types, Define internal types Chalk and
5 Internal Types Talk
Standard Type Operators, Explain Standard Type Chalk and
2 Standard Type Built-in Operators, Standard Type Built- Talk
6 Functions in Functions
Categorizing the Standard Categorizing the Standard Chalk and
7 Types,Unsupported Types Types,Unsupported Types Talk
Numbers - Introduction to Explain Numbers , Integers Chalk and
8 Numbers, Integers Talk
Floating Point Real Discuss Floating Point Real Chalk and
9 Numbers, Complex Numbers Numbers, Complex Numbers Talk
Operators, Built-in Discuss Operators, Built-in Chalk and
10 Functions, Related Modules Functions, Related Modules Talk
Sequences - Strings Explain Sequences - Strings Chalk and
Talk&
11 PPT
Lists, and Tuples Describe Lists, and Tuples Chalk and
Talk&
12 PPT
Mapping and Set Types Understand Mapping and Set Chalk and
Types Talk&
3
13 PPT
UNIT-II
Chalk and
Understand FILES: File Talk&
14 FILES: File Objects Objects PPT
Chalk and
File Built-in Function [ Describe File Built-in Function Talk&
15 open() ] [ open() ] PPT
Chalk and
Talk&
16 File Built-in Methods Define File Built-in Methods PPT
Chalk and
File Built-in Attributes, Explain File Built-in Attributes, Talk&
17 Standard Files Standard Files PPT
Chalk and
Analyze Command-line Talk& T1
18 Command-line Arguments Arguments PPT
Chalk and
Describe File System, File
File System, File Execution Talk&
4 Execution
19 PPT
Chalk and
Distinguish Persistent Storage Talk&
20 Persistent Storage Modules Modules PPT
Chalk and
Talk&
21 MOCK TEST I PPT
Related Modules Exceptions: Related Modules Exceptions: Chalk and
Exceptions in Python, Exceptions in Python, Talk
Detecting and Handling Detecting and Handling
22 Exceptions Exceptions
Chalk and
23 Context Management, Context Management, Talk
*Exceptions as Strings, *Exceptions as Strings, Raising Chalk and
24 Raising Exceptions Exceptions Talk
Assertions, Standard Assertions, Standard Chalk and
25 Exceptions Exceptions Talk
5 *Creating Exceptions, Why *Creating Exceptions, Why Chalk and
Exceptions? Why Exceptions Exceptions? Why Exceptions at Talk
26 at All? All?
Chalk and
27 BRIDGE CLASS 1 Talk
Exceptions and the sys Define Exceptions and the sys Chalk and
28 Module Module Talk
Related Modules Modules: Understand Related Modules Chalk and
29 Modules and Files Modules: Modules and Files Talk
Namespaces, Importing Exaplin Namespaces, Importing Chalk and
30 Modules Modules Talk
Understand Importing Module Chalk and
31 6 Importing Module Attributes Attributes Talk
Chalk and
32 BRIDGE CLASS 2 Talk
Module Built-in Functions, Apply Module Built-in Chalk and
Packages, Other Features of Functions, Packages, Other Talk
33 Modules Features of Modules
UNIT III
Regular Expressions: Explain Regular Expressions: Chalk and
34 Introduction Introduction Talk
Special Symbols and Understand Special Symbols Chalk and
35 Characters and Characters Talk
Res and Python Exaplain Res and Python Chalk and
7
Multithreaded Programming: Multithreaded Programming: Talk
36 Introduction Introduction
Distinguish between Threads Chalk and
37 Threads and Processes and Processes Talk
Chalk and T1
38 BRIDGE CLASS 3 Talk
8 MID 1 EXAMS
Chalk and
39 Python Exaplin Python Talk
Threads and the Global Understand Threads and the Chalk and
40 Interpreter Lock Global Interpreter Lock Talk
9
Chalk and
41 Thread Module Apply Thread Module Talk
Threading Module, Related Discuss Threading Module, Chalk and
42 Modules Related Modules Talk
Chalk and
43 BRIDGE CLASS 4 Talk
UNIT IV
GUI Programming: Explain GUI Programming: Chalk and
44 Introduction Introduction Talk,PPT
GUI Programming: Explain GUI Programming: Chalk and
45 Introduction Introduction Talk,PPT
10 Tkinter and Python Understand Tkinter and Python Chalk and
46 Programming Programming Talk,PPT
Tkinter and Python Understand Tkinter and Python Chalk and
47 Programming Programming Talk,PPT
Define Brief Tour of Other Chalk and
48 Brief Tour of Other GUIs GUIs Talk,PPT
Chalk and
49 BRIDGE CLASS 5 Talk,PPT
Define Brief Tour of Other Chalk and
50 Brief Tour of Other GUIs GUIs Talk,PPT
Related Modules and Other Understand Related Modules Chalk and
11 GUIs WEB Programming: and Other GUIs WEB Talk,PPT
51 Introduction Programming: Introduction
WEB Programming: Describe WEB Programming: Chalk and
52 Introduction Introduction Talk,PPT
Chalk and
T1
53 WEB Programming: Describe WEB Programming: Talk,PPT
Discuss Wed Surfing with Chalk and
54 Wed Surfing with Python Python Talk,PPT
Chalk and
55 BRIDGE CLASS 6 Talk,PPT
Creating Simple Web Clients Apply Creating Simple Web Chalk and
12
56 Clients Talk,PPT
Creating Simple Web Clients Apply Creating Simple Web Chalk and
57 Clients Talk,PPT
Advanced Web Clients Elaborate Advanced Web Chalk and
58 Clients Talk,PPT
CGI-Helping Servers Explain CGI-Helping Servers Chalk and
59 Process Client Data Process Client Data Talk,PPT
MOCK TEST II Chalk and
60 Talk,PPT
Building CGI Application Building CGI Application Chalk and
13
61 Advanced CGI Advanced CGI Talk,PPT
Web (HTTP) Servers Web (HTTP) Servers Chalk and
62 Talk,PPT
Revision Revision Chalk and
63 Talk,PPT
UNIT V T1
Chalk and
64 BRIDGE CLASS 7
Talk,PPT
DatabaseProgramming: Explain Database Chalk and
65
Introduction, Programming: Introduction, Talk,PPT
Chalk and
66
14 Database Programming Exaplin Database Programming Talk,PPT
Python Database Discuss Python Database Chalk and
67 Application Programmer’s Application Programmer’s Talk,PPT
Interface Interface
Chalk and
68
BRIDGE CLASS 8 Talk,PPT
Python Database Define Python Database Chalk and
69 Application Programmer’s Application Programmer’s Talk,PPT
Interface Interface
Python Database define Python Database Chalk and
70 Application Programmer’s Application Programmer’s Talk,PPT
Interface Interface
15
Chalk and
71
(DB-API) Understand (DB-API) Talk,PPT
Chalk and
72
(DB-API) Undersatnd (DB-API) Talk,PPT
Object Relational Managers Exaplain Object Relational Chalk and
73
(ORMs) Managers (ORMs) Talk,PPT
Object Relational Managers Explain Object Relational Chalk and
74
(ORMs) Managers (ORMs) Talk,PPT
Chalk and
75
Related Modules Understand Related Modules Talk,PPT
Chalk and
76
16 Related Modules Understand Related Modules Talk,PPT
Chalk and
77
BRIDGE CLASS 9 Talk,PPT
Chalk and
78
BRIDGE CLASS 10 Talk,PPT

17 MID II
Textbook
1. Core Python Programming, Wesley J. Chun, Second Edition, Pearson.
IX.MAPPING COURSE OUTCOMES LEADING TO THE ACHIEVEMENT
PROGRAM OUTCOMES AND PROGRAM SPECIFIC OUTCOMES:
Program Specific
Program Outcomes (PO)
Outcomes

Outcomes (PSO)
Course

PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2 PSO3
CO1 3 2 2 3 2 2 - - - - - 2 2 2 1

CO2 3 2 2 2 2 2 - - - - - 1 1 2 1

CO3 3 3 3 3 2 2 - - - - - 1 1 2 1

CO4 2 2 3 2 3 3 - - - - - 2 1 2 2

CO5 1 2 2 3 2 2 - - - - - 1 2 2 2

AVG 2 2 2 3 2 2 - - - - - 1 1 2 1

X. QUESTION BANK
DESCRIPTIVE QUESTIONS:
UNIT-I
Short Answer Questions-
S.NO QUESTION BLOOMS Taxonomy
1. Explain the difference between compiled and interpreted L2: UNDERSTAND
2. What are mutable and immutable types? L1: REMEMBER
3. What happens if a semicolon (;) is placed at the end of a Python L1: REMEMBER
4. Define dictionary in Python L1: REMEMBER
5. Explain the features of tuple data structure L2: UNDERSTAND
Long Answer Questions-
S.NO QUESTION BLOOMS Taxonomy
1. Explain about the need for learning python programming and L2: UNDERSTAND
2. Write in brief about the applications of Python. Give L2: UNDERSTAND
3. Explain the following operators in python with appropriate L2: UNDERSTAND
4. Explain about methods in Lists of Python with appropriate L2: UNDERSTAND
5. Give a comparison between lists, tuples, dictionaries and sets. L5: EVALUATE
UNIT-2
Short Answer Questions
S.NO QUESTION BLOOMS Taxonomy
1. Define File Objects? L1: REMEMBER
2. What is meant Exceptions as Strings? L1: REMEMBER
3. Define File Built-in Function [ open() ]? L1: REMEMBER
4. Can a Python function return multiple values? If yes, how it L2: UNDERSTAND
5. List out different File Built-in Methods L2: UNDERSTAND
Long Answer Questions-
S.NO QUESTION BLOOMS Taxonomy
1. What type of parameter passing is used in Python? Justify your L2: UNDERSTAND
2. Write a Python program that overloads + operator, to add two L2: UNDERSTAND
3. What are the two ways of importing a module? Which one is L2: UNDERSTAND
4. Explain in brief about Packages? L2: UNDERSTAND
5. Explain how to implement inheritance in Python. L2: UNDERSTAND
UNIT-3
Short Answer Questions-
S.NO QUESTION BLOOMS Taxonomy
1. Describe the terms Threads in python? L2: UNDERSTAND
2. Describe Special Symbols and Characters? L2: UNDERSTAND
3. Describe Terms Processes in python? L2: UNDERSTAND
4. Define Threading Module? L2: UNDERSTAND
5. Define Regular Expressions? L2: UNDERSTAND
Long Answer Questions-
S.NO QUESTION BLOOMS Taxonomy
1. Explain the methods that are used to synchronize threads? L2: UNDERSTAND
2. What are regular expressions? How to find whether an email L2: UNDERSTAND
3. What is multithreading? Discuss about starting a new thread. L2: UNDERSTAND
4. Explain in detail about Global Interpreter Lock with example? L2: UNDERSTAND
5. Explain in detail about Res and Python Multithreaded L2: UNDERSTAND
UNIT-4
Short Answer Questions-
S.NO QUESTION BLOOMS Taxonomy
1. Describe Building CGI Application. L2: UNDERSTAND
2. Define CGI-Helping Servers Process Client Data. L2: UNDERSTAND
3. What is tkinter TK ()? L2: UNDERSTAND
4. What is the best GUI for Python. L2: UNDERSTAND
5. How tkinter applications can be freezed? L2: UNDERSTAND
Long Answer Questions-
S.NO QUESTION BLOOMS Taxonomy
1. Explain about Radio button widget in tkinter. How to create L2: UNDERSTAND
2. Write a Python program that creates a GUI with a textbox, Ok L2: UNDERSTAND
3. Explain in detail about Web (HTTP) Servers. L2: UNDERSTAND
4. Write a program for basic web browser using Tkinter which L3: APPLY
5. Explain with an example about Wed Surfing with Python? L2: UNDERSTAND
UNIT-5
Short Answer Questions-
S.NO QUESTION BLOOMS Taxonomy
1. Define usage of following Type Object. L1: REMEMBER
2. What is meant by frameworks? L2: UNDERSTAND
3. Define Databases and Python Adapters L1: REMEMBER
4. What is database schema? L2: UNDERSTAND
5. What is the use of cursor.getrowid() method . L2: UNDERSTAND
Long Answer Questions-
S.NO QUESTION BLOOMS Taxonomy
1. Write the syntax to open a database in python? L2: UNDERSTAND
2. Write the syntax to execute database queries to perform the L2: UNDERSTAND
3. Explain in detail about Object Relational Managers? L2: UNDERSTAND
4. Discuss about Python Database Application Programmer's L2: UNDERSTAND
5. Explain following connection objects. L2: UNDERSTAND
OBJECTIVE QUESTIONS
UNIT 1
1. What Is The Default Return Value For A Function That Does Not Return Any
Value Explicitly?

2. Which Of The Following Items Are Present In The Function Header?


A. function name B. function name and parameter list
C. parameter list D. return value
3.What Will Be The Output Of The Following Code Snippet?
a=[1,2,3,4,5,6,7,8,9]
print(a[::2])
A. [1,2] B. [8,9] C. [1,3,5,7,9] D. [1,2,3]
4. What Will Be The Output Of The Following Code Snippet?
a=[1,2,3,4,5]
print(a[3:0:-1])
A. Syntax error . [4, 3, 2] C. [4, 3] D. [4, 3, 2, 1]
5. What Will Be The Output Of The Following
Code? class Test:
def __init__(self, s):
self.s = s
def print(self):
print(s)
a = Test("Python
Class") a.print()
A. The program gives an error because there is no constructor for class Test.
B. Signature for the print method is incorrect, so an error is thrown.
C. The correct output is .
D. The above code will execute correctly on changing print(s) to print(self.s).
Q-6What Will Be The Output Of The Following Code?
class Test:
def __init__(self, s):
self.s = s
def print(self):
print(self.s)
msg = Test()
msg.print()
A. The program has an error because class Test does not have a constructor.
B. The above code produces an error because the definition of print(s) does not include
. C. It executes successfully but prints nothing.
D. The program has an error because of the constructor call is made without an argument.
7 . Wagner–Fischer is a ____________ algorithm. (Dynamic programming)
8. Wagner–Fischer algorithm is used to find ____________ (Edit distance between
two strings)
9. What is the edit distance between the strings “abcd” and “acbd” when the allowed
operations are insertion, deletion and substitution?__________(2)
10.What will be the output?______________________ (2, 4)
1. >>>t=(1,2,4,3)
2. >>>t[1:3]
UNIT 2
1.To open a file c:\scores.txt for reading, we use
a) infile = open(“c:\scores.txt”, “r”) b) infile = open(“c:\\scores.txt”, “r”)
c) infile = open(file = “c:\scores.txt”, “r”) d) infile = open(file = “c:\\scores.txt”, “r”)
2.What is the output?
1. f = None
2. for i in range (5):
3. with open("data.txt", "w") as f:
4. if i > 2:
5. break
6. print(f.closed)
a)True b)False c)None d) Error
3.Can one block of except statements handle multiple exception?
a) yes, like except TypeError, SyntaxError [,…].
b) yes, like except [TypeError, SyntaxError].
c) no
d) none of the mentioned
4.Is the following code valid?
try:
# Do something
except:
# Do something
finally:
# Do something
a) no, there is no such thing as finally b) no, finally cannot be used with except
c) no, finally must come before except d) yes
5. All modular designs are because of a top-down design process? True or False?
a) True b) False
6. The readlines() method returnsa list of______ Answer: Lines
7.Program code making use of a given module is called a ______ of the module. Answer:Client
8.______ is a string literal denoted by triple quotes for providing the specifications of certain
program elements. Answer:Docstring
9._______________________ exceptions are raised as a result of an error in opening a particular
file. Answer: IOError
10.Methods of a class that provide access to private members of the class are called as ______
and ______ Answer:getters/setters
UNIT III
1. Which module in Python supports regular expressions?
a) re b) regex c) pyregex d) none of the mentioned
2. Which of the following creates a pattern object?
a) re.create(str) b) re.regex(str) c) re.compile(str) d) re.assemble(str)
3. What does the function re.match do?
a) matches a pattern at the start of the string b) matches a pattern at any position in the string
c) such a function does not exist d) none of the mentioned 4. Which of the
following functions clears the regular expression cache?
a) re.sub() b) re.pos() c) re.purge() d) re.subn()
5 What is the output of the line of code shown below?
re.split('\W+', 'Hello, hello, hello.')
a) [‘Hello’, ‘hello’, ‘hello.’] b) [‘Hello, ‘hello’, ‘hello’]
c) [‘Hello’, ‘hello’, ‘hello’, ‘.’] d) [‘Hello’, ‘hello’, ‘hello’, ”]
6. The character Dot (that is, ‘.’) in the default mode, matches any character other than
_____________ (newline)
7.The expression a{5} will match _____________ characters with the previous regular
expression.( exactly 5)
8. __________ functions matches a pattern at any position in the string(re.search)

9. In the functions re.search.start(group) and re.search.end(group), if the argument groups not


specified, it defaults to __________(Zero)
10.__________ functions does not accept any argument(re.purge)
UNIT IV
1. How do you create a window??
a) window = newWindow() b) window = Window()
c) window = Frame() d) window = Tk()
2. How do you create a frame?
a) frame = newWindow() b) frame = Window()
c) frame = Frame() d) frame = Tk()
3. How do you create an event loop??
a) window.loop() b) window.main() c) window.mainloop() d) window.eventloop()
4. How do you create a canvas under parent frame1 with background color white and
foregroung color green?
a) Canvas(frame1, bg = "white", fg = "green")
b) Canvas(frame1, bg = "white", fg = "green", command = processEvent)
c) Canvas(frame1, bg = "white", command = processEvent)
d) Canvas(frame1, fg = "green", command = processEvent)
5. To display an error dialog named "Variable is not assigned", use __________
a) tkinter.messagebox.showinfo("showinfo", "Variable is not assigned")
b) tkinter.messagebox.showwarning("showwarning", "Variable is not assigned")
c) tkinter.messagebox.showerror("showerror", "Variable is not assigned")
d) tkinter.messagebox.askyesno("ashyesno", "Variable is not assigned")
6. grid() method_________________________________________
7. w = Canvas(__________________) Answer : master, option=value
8. Listbox)______________Answer : offers a list to the user from which the user can accept
any number of options.
9. CGI stands for___________________________
10. Module used for GUI and web programming_________________

1. Which method is used to retrieve the executed database function or stored procedure result in
Python
a)cursor.stored_results()b)cursor.get_results()c)cursor.fetch_results()
2. Which method of cursor class is used to get the number of rows affected after any of
the insert/update/delete database operation executed from Python
a) cursor.rowcount b)cursor.getaffectedcount c)cursor.rowscount
3. Which method is used to Commit pending transaction to the database in Python?
a)connection.commit()b.cursor.commit()
4.Mandatory arguments required to connect any database from
Python a)Username, Password, Hostname, Database Name, Port.
b)Username, Password, Hostname
c) Username, Password, Hostname, Database Name
5.Exception raised when the relational integrity of the database is affected in Python
a)IntegrityFailError b)IntegrityError c)IntegrityViolationError
6.ORMs stands _______________________(Object relation models)
7.DB-API stands for_____________________
8.Relational databases are the most widely used type of database, storing information as
tables containing a number of rows.(TRUE/FALSE)
9._____________method of cursor class is used to fetch limited rows from the table
(cursor.fetchmany(SIZE))
10_____________method of cursor class is used to get the number of rows affected after any of
the insert/update/delete database operation executed from Python (cursor.rowcount)
GATE QUESTIONS
Not Related
XI.WEBSITES:
https://www.python.org/
https://pythonprogramming.net/
https://www.edureka.co/blog/python-programming-language
https://www.programiz.com
XII.EXPERT DETAILS
1. Wesley J. Chun
2. https://www.innoappstech.com/?utm_medium=nancy&utm_source=top+python+programme
rs++/+quora
3. https://www.valuecoders.com/?utm_medium=nancy&utm_source=top+python+programmers
++/+quora
4. https://www.pixelcrayons.com/?utm_medium=nancy&utm_source=top+python+programmer
s++/+quora
5. Guido van Rossum
XIII.JOURNALS
1. Programming with Python DOI: 10.1109/MITP.2005.120 Publisher: IEEE
2. Python Power DOI: 10.1109/MCSE.2014.26 Publisher: IEEE
3. Exploration of teaching method of Python Programming based on the case of technical
problem DOI: 10.1109/ICCSE.2017.8085563 Publisher: IEEE
XIV.LIST OF TOPICS FOR STUDENTS’ SEMINARS
1. Python Basics
2. Lists, and Tuples
FILES:
Exceptions in Python, Detecting and Handling Exceptions
GUI Programming
WEB Programming:
3. Creating Simple Web Clients
4. Python Database Application Programmer’s Interface

XV.CASE STUDIES / PROJECTS


Dice Rolling Simulator
Guess the Number
TextBased Adventure Game
Mad Libs generator
Hangman

You might also like