0% found this document useful (0 votes)
7 views21 pages

Python Course File

The Python Programming course (CS702OE) provides an overview of Python as an interpreted, object-oriented language suitable for rapid application development and scripting. It covers essential topics such as syntax, data structures, file handling, object-oriented programming, and web services, aimed at software engineers and analysts. The course includes practical applications and assessments aligned with program outcomes and specific outcomes in computer science education.

Uploaded by

Bhuvnesh Sharma
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)
7 views21 pages

Python Course File

The Python Programming course (CS702OE) provides an overview of Python as an interpreted, object-oriented language suitable for rapid application development and scripting. It covers essential topics such as syntax, data structures, file handling, object-oriented programming, and web services, aimed at software engineers and analysts. The course includes practical applications and assessments aligned with program outcomes and specific outcomes in computer science education.

Uploaded by

Bhuvnesh Sharma
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/ 21

Open Elective II: PYTHON PROGRAMMING (CS702OE)

COURSE PLANNER

I. COURSE OVERVIEW:

Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-
level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for
Rapid Application Development, as well as for use as a scripting or glue language to connect existing
components together. Python's simple, easy to learn syntax emphasizes readability and therefore reduces the
cost of program maintenance. Python supports modules and packages, which encourages program modularity
and code reuse. The Python interpreter and the extensive standard library are available in source or binary
form without charge for all major platforms, and can be freely distributed. Debugging Python programs is
easy: a bug or bad input will never cause a segmentation fault. Instead, when the interpreter discovers an
error, it raises an exception. When the program doesn't catch the exception, the interpreter prints a stack trace.
On the other hand, often the quickest way to debug a program is to add a few print statements to the source:
the fast edit-test-debug cycle makes this simple approach very effective.

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.

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)

II. PRE-REQUISITES:

III. COURSE OBJECTIVIES:

1.Learn Syntax and Semantics and create Functions in Python.


2.Handle Strings and Files in Python.
3.Understand Lists, Dictionaries and Regular expressions in Python.
4. Implement Object Oriented Programming concepts in Python.
5. Build Web Services and introduction to Network and Database Programming in Python.

83
IV.COURSE LEARNING COUCOMES (CLOs):

At the end of the course, the student will POs / PSOs


CLO Code
have the ability to: Levels mapped
PO1, PO2,
Examine Python syntax and semantics and
Level 4: Analyzing PO3,
CS311PC.01 CLO1 be fluent in the use of Python flow control
PSO1,
and functions
PSO2
PO1, PO2,
Demonstrate proficiency in handling Level 2 : PO3, PO4,
CS311PC.02 CLO2 Understanding
Strings and File Systems PSO1,
PSO2
Create, run and manipulate Python PO1, PO2,
Programs using core data structures like Level 6 : Creating PO3, PO4,
CS311PC.03 CLO3
Lists, Dictionaries and use Regular PSO1,
Expressions. PSO2
PO1, PO2,
Level 2 : PO3, PO4,
Interpret the concepts of Object-Oriented
CS311PC.04 CLO4 Understanding PO5,
Programming as used in Python.
PSO1,
PSO2
PO1, PO2,
Implement exemplary applications related PO3, PO4,
CS311PC.05 CLO5 to Network Programming, Web Services Level 6 : Creating PO5,
and Databases in Python. PSO1,
PSO2

V. HOW PROGRAM OUTCOMES ARE ASSESSED:

Proficiency
Program Outcomes (POs) Level
assessed by
PO1 Engineering knowledge: Apply the knowledge of mathematics, Presentation on
2
science, engineeringfundamentals, and an engineering real-world
specialization to the solution of complex engineering problems. problems
PO2 Problem analysis: Identify, formulate, review research
literature, and analyze complexengineering problems reaching 2
Assignments
substantiated conclusions using first principles of mathematics,
natural sciences, and engineering sciences.
PO3 Design/development of solutions: Design solutions for complex
engineering problems anddesign system components or
3
processes that meet the specified needs with appropriate Assignments
consideration for the public health and safety, and the cultural,
societal, and environmental considerations.
PO4 Conduct investigations of complex problems: Use research- 3 Mini/Major
based knowledge and researchmethods including design of Projects
84
Proficiency
Program Outcomes (POs) Level
assessed by
experiments, analysis and interpretation of data, and synthesis of
the information to provide valid conclusions.
PO5 Modern tool usage: Create, select, and apply appropriate
techniques, resources, and modernengineering and IT tools 2 Mini/Major
including prediction and modeling to complex engineering Projects
activities with an understanding of the limitations.
PO6 The engineer and society: Apply reasoning informed by the
contextual knowledge to assesssocietal, health, safety, legal and
- --
cultural issues and the consequent responsibilities relevant to the
professional engineering practice.
PO7 Environment and sustainability: Understand the impact of the
professional engineering solutionsin 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 ofthe engineering practice.
PO9 Individual and team work: Function effectively as an
individual, and as a member or leader indiverse teams, and in - --
multidisciplinary settings.
PO10 Communication: Communicate effectively on complex
engineering activities with the engineeringcommunity 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.
PO11 Project management and finance: Demonstrate knowledge and
understanding of theengineering and management principles and
2 --
team, to manage projects and in multidisciplinary environments.
PO12 Life-long learning: Recognize the need for, and have the
preparation and ability to engage inindependent and life-long - -
learning in the broadest context of technological change.

VI.HOW PROGRAM SPECIFIC OUTCOMES ARE ASSESSED:

Proficiency
Program Specific Outcomes (PSOs) Level
assessed by
PSO1 Foundation of mathematical concepts: To use mathematical
methodologies to crack problem using suitable mathematical 2 Assignments
analysis, data structure and suitable algorithm.
PSO2 Foundation of Computer System: The ability to interpret the
fundamental concepts and methodology of computer systems. Mini/Major
2
Students can understand the functionality of hardware and Projects
software aspects of computer systems.
PSO3 Foundations of Software development: The ability to grasp the
3 Methodologies
software development lifecycle and methodologies of software
85
Proficiency
Program Specific Outcomes (PSOs) Level
assessed by
systems. Possess competent skills and knowledge of software
design process. Familiarity and practical proficiency with a broad
area of programming concepts and provide new ideas and
innovations towards research.

VII. MAPPING COURSE OUTCOMES LEADING TO THE ACHIEVEMENT OF PROGRAM


OUTCOMES AND PROGRAM SPECIFIC OUTCOMES:

Program Specific
Program Outcomes (PO)
Outcomes
Learning

Outcomes (PSO)
Course

PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2 PSO3

CLO1 3 2 2 3 2 - - - - - - 2 2 2 1
CLO2 3 2 2 2 2 - - - - - - 1 1 2 1
CLO3 3 3 3 3 2 - - - - - - 1 1 2 1
CLO4 2 2 3 2 3 - - - - - - 2 1 2 2
CLO5 1 2 2 3 2 - - - - - - 1 2 2 2
AVG 2 2 2 3 2 - - - - - - 1 1 2 1
2: Moderate (Medium)
1: Slight (Low) 3: Substantial (High) - : None
VIII. 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 and
Files, Namespaces, Importing Modules, Importing Module Attributes, Module Built-in Functions, Packages,
Other Features of Modules

UNIT-III

86
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
(DB-API),
Object Relational Managers (ORMs), Related Modules

TEXT BOOK:
1. Core Python Programming, Wesley J. Chun, Second Edition, Pearson.

REFERENCE BOOK:
1.Think Python, Allen Downey, Green Tea Press
2. Introduction to Python, Kenneth A. Lambert, Cengage
3. Python Programming: A Modern Approach, VamsiKurama, Pearson

NPTEL RESOURCES:
1. NOC: Machine Learning, ML (Video):

https://nptel.ac.in/courses/106106202/
1. NOC: Introduction to Machine Learning (Video):

https://nptel.ac.in/courses/106105152/
2. NOC: Introduction to Machine Learning (Course sponsored by Aricent) (Video):

https://nptel.ac.in/courses/106106139/

GATE SYLLABUS: NOT APPLICABLE

IES SYLLABUS: NOT APPLICABLE

XI. LESSON PLAN

87
Link for

Methodology
Lecture No.

References
*Teaching
Unit No.
Content to be Small Course
Topics to be Link for
covered under Projects/ Learning
covered PDF
each topic Numerical Outcomes
s(if any)
Introduction, PPT,
Introduction
Download and CO1, CO2 Pen,
1 to python NIL T1
Installation of & CO7 White
programming
1 python Board

Syntax

Assignment
PPT,
Keywords CO1, CO2 Pen,
1 Python Basics NIL T1
& CO7 White
Guidelines Board

Management

2 Program https://d
Object Attribute rive.goo PPT,
Objects-
Class Objects gle.com/ CO1, CO2 Pen,
1 Python NIL T1
Instance Objects drive/fol & CO7 White
Objects,
3 Method Objects ders/1ac Board
FXe12d PPT,
Standard String List KEJIvQ CO1, CO2 Pen,
1 NIL T1
Types Tuple Dictionar NBpfEi & CO7 White
4 WPw92t Board
Type Wpp9L
N
(None)

Other Built-in PPT,


Function/Method
Types, CO1, CO2 Pen,
1 NIL T1
Internal & CO7 White
Types Board

5
Standard · PPT,
Type Object Value CO1, CO2 Pen,
1 NIL T1
Operators, Comparison & CO7 White
6 Standard Object Identity Board
88
Type Built-in Comparison
Functions Boolean type()
cmp() str() and
repr() (and ``
Operator) type()
and isinstance()
Python Type
Operator and BIF
Summary
Storage
Model Update
Categorizing
Model Access PPT,
the Standard
Model char or CO1, CO2 Pen,
1 Types, NIL T1
byte pointer int & CO7 White
Unsupported
versus short Board
Types
versus long float
7 versus double
·
How to Create
and Assign
Numbers
(Number Objects)
How to Update
Numbers - PPT,
Numbers How to
Introduction CO1, CO2 Pen,
1 Remove Numbers NIL T1
to Numbers, & CO7 White
Boolean Standard
Integers Board
(Regular or Plain)
Integers Long
Integers
Unification of
Integers and Long
8 Integers
·
Floating Point Double Precision
Real Floating Point
1 Numbers, Numbers.
Complex Complex Number
Numbers Built-in
PPT,
9 Attributes
CO1, CO2 Pen,
· NIL T1
& CO7 White
Mixed-Mode
Operators, Board
Operations
Built-in
Standard Type
1 Functions,
Operators
Related
Numeric Type
Modules
(Arithmetic)
10 Operators Bit
89
Operators
(Integer-Only)

·
creation of string
Sequences - in Python
1
Strings Accessing string
Python String
11 Operations
·
creation and
accessing of list
in Python
Lists, and
1 Operations on list
Tuples
creation and
accessing of tuple
Operations on
12 tuple
·
Mapping and creation and PPT,
2
Set Types accessing of set CO1, CO2 Pen,
NIL T1
13 Operations on set & CO7 White
https://d Board
rive.goo
· gle.com/
Python File drive/fol
Handling Python ders/1ac
FILES: File
2 Read Files Python FXe12d
Objects
Write/Create KEJIvQ
Files Python NBpfEi
Delete Files WPw92t
Wpp9L
14 N
File Built-in
PPT,
Function [ · Create,
https://d CO1, CO2 Pen,
15 2 open()], File Open and reading NIL
rive.goo & CO7 White
Built-in a File
gle.com/ Board
Methods
drive/fol
· Attributes
ders/1ac PPT,
File Built-in inside built
FXe12d CO1, CO2 Pen, T1
16 2 Attributes, function of NIL
KEJIvQ & CO7 White
Standard Files Create, Open and
NBpfEi Board
reading a File
WPw92t
Command- · PPT,
Wpp9L
line Write to an CO1, CO2 Pen,
17 2 N NIL
Arguments, Existing File & CO7 White
File System, Passing Board
90
File Command-line
Execution, Arguments pickle
Persistent and marshal
Storage Modules DBM-
Modules style Modules
shelve Module
·
What Are
Exceptions?
Related
Exceptions in
Modules
Python Detecting
Exceptions: PPT,
and Handling
Exceptions in CO1, CO2 Pen,
18 2 Exceptions NIL
Python, & CO7 White
Raising
Detecting and Board
Exceptions
Handling
Standard
Exceptions
Exceptions
Creating T1
Exceptions
·
PPT,
With Statement
Context CO1, CO2 Pen,
19 2 Context NIL
Management & CO7 White
Management
Board
Protocol
·
*Exceptions PPT,
Exceptions as
as Strings, CO1, CO2 Pen,
20 2 Strings Raise NIL
Raising & CO7 White
statement Using
Exceptions Board
Raise statement
·
PPT,
Assertions, Assert
CO1, CO2 Pen,
21 2 Standard statement Python NIL T1
& CO7 White
Exceptions Built-In
Board
Exceptions
*Creating
Exceptions,
· PPT,
Why
Creating CO1, CO2 Pen,
22 2 Exceptions? NIL T1
Exceptions Need & CO7 White
Why
of exception Board
Exceptions at
All?
· PPT,
Exceptions
Exceptions and CO1, CO2 Pen,
23 2 and the sys NIL T1
the related & CO7 White
Module
Module Board
Related · CO1, PPT,
24 2 NIL T1
Modules: Exception- CO3, CO4 Pen,
91
Modules and Related Standard & CO7 White
Files, Library Modules Board
Namespaces
·
Importing
How to import
Modules,
module The
25 2 Importing
import Statement
Module
Attribute of
Attributes
import module
·
Module Built-
in Functions,
Module Built- __import__ ()
in Functions, globals() and
Packages, locals() reload()
26 2
Other Packages Using
Features of from-import with
Modules Packages
Features of
Modules Auto-
Loaded Modules
PPT,
CO1,
Doubt And Pen,
27 3 NIL CO3, CO4 T1
revision White
& CO7
Board
https://d PPT,
Regular CO1,
· rive.goo Pen,
28 3 Expressions: NIL CO3, CO4 T1
Motivation gle.com/ White
Introduction & CO7
drive/fol Board
· ders/1ac
Special Symbols FXe12d
and Characters KEJIvQ
Common Regular NBpfEi
Expression WPw92t
Special Symbols and Wpp9L
Symbols and Special N
Characters, Characters PPT,
CO1,
Res and Matching More Pen,
3 NIL CO3, CO4 T1
Python Than One RE White
& CO7
Multithreaded Pattern with Board
Programming: Alternation Re
Introduction Module: Core
Functions and
Methods
Common Regular
Expression
Functions and
92
Methods
Introduction of
Multithreaded
Programming

· https://d PPT,
CO1,
Threads and What Are rive.goo Pen,
29 3 NIL CO3, CO4 T1
Processes Processes What gle.com/ White
& CO7
Are Thread drive/fol Board
· ders/1ac
Threads and Global Interpreter FXe12d PPT,
CO1,
the Global Lock (GIL) Use KEJIvQ Pen,
30 3 NIL CO3, CO4 T1
Interpreter of Global NBpfEi White
& CO7
Lock Interpreter Lock WPw92t Board
(GIL) Wpp9L
· N
PPT,
Python Threading CO1,
Thread Pen,
31 3 Modules Thread NIL CO3, CO4 T1
Module White
Module and Lock & CO7
Board
Objects
·
Threading
Module Objects
Thread Class
Threading PPT,
Thread Object CO1,
Module, Pen,
32 3 Methods Create NIL CO3, CO4 T1
Related White
and using Thread & CO7
Modules Board
Instance, Passing
in Function Other
Threading
Module Functions
https://d
Explain GUI rive.goo PPT,
GUI Programming: gle.com/ CO1,
Pen,
33 4 Programming: Introduction drive/fol NIL CO3, CO4 T1
White
Introduction, What Are Tcl, ders/1ac & CO7
Board
Tk, and Tkinter FXe12d
KEJIvQ
Understand NBpfEi
Tkinter and WPw92t
Python Wpp9L PPT,
Tkinter and CO1,
Programming N Pen,
34 4 Python NIL CO3, CO5 T1
Tkinter Module: White
Programming & CO7
Adding Tk to Board
your Applications
Tk Widgets
93
PPT,
CO1,
Brief Tour of Pen,
35 4 Other GUIs NIL CO3, CO5 T1
Other GUIs White
& CO7
Board
GUI Systems
PPT,
Related Available for CO1,
Pen,
36 4 Modules and Python Define NIL CO3, CO5 T1
White
Other GUIs Brief Tour of & CO7
Board
Other GUIs
Understand
Related Modules PPT,
WEB CO1,
and Other GUIs Pen,
37 4 Programming: NIL CO3, CO5 T1
WEB White
Introduction & CO7
Programming: Board
Introduction
WEB Describe WEB PPT,
CO1,
Programming: Programming Pen,
38 4 NIL CO3, CO5 T1
Web Surfing Client/Server White
& CO7
with Python Computing Board
·
Creating Simple
Web Clients Web
Address
Creating
Components PPT,
Simple Web CO1,
Network Location Pen,
39 4 Clients NIL CO3, CO5 T1
Components White
Advanced & CO7
Urlparse Module Board
Web Clients
Advanced Web
Client: a Web
Crawler
urllib2Module
CGI-Helping PPT,
· CO1,
Servers Pen,
40 4 Introduction to NIL CO3, CO5 T1
Process Client White
CGI CGI module & CO7
Data Board
Building CGI
·
Application PPT,
Building CGI CO1,
Advanced Pen,
41 4 Applications NIL CO3, CO5 T1
CGI, Web White
Setting Up a Web & CO7
(HTTP) Board
Server
Servers
PPT,
CO1,
Doubt And Pen,
42 4 NIL CO3, CO5 T1
revision White
& CO7
Board

94
Database https://d PPT,
CO1,
Programmin rive.goo Pen,
43 5 Introduction NIL CO5, CO6 T1
g: gle.com/ White
& CO7
Introduction, drive/fol Board
· ders/1ac
Databases and FXe12d PPT,
CO1,
Database Python Basic KEJIvQ Pen,
44 5 NIL CO5, CO6 T1
Programming Database NBpfEi White
& CO7
Operations and WPw92t Board
SQL Wpp9L
· N
Introduction
Python
Python Database PPT,
Database CO1,
Application Pen,
45 5 Application NIL CO5, CO6 T1
Programmer's White
& CO7
Interface (DB- Board
Interface
API) Module
Attributes
Python
· PPT,
Database CO1,
Connection Pen,
46 5 Application NIL CO3, CO5 T1
Objects Cursor White
& CO7
Objects Board
Interface
·
Python
Databases and PPT,
Database CO1,
Python: Adapters Pen,
45 5 Application NIL CO3, CO5 T1
Examples of White
& CO7
Using Database Board
Interface
Adapters
PPT,
· CO1,
Pen,
47 5 (DB-API) Implementation NIL CO5, CO6 T1
White
of DB-API & CO7
Board
·
Object
Python and
Relational PPT,
ORMs SQL CO1,
Managers Pen,
48 Alchemy ORM NIL CO3, CO5 T1
(ORMs) White
Example & CO7
Related Board
Database-Related
Modules
Modules
PPT,
**Python · CO1,
Pen,
with IOT Introduction to NIL CO5, CO6 T1
White
(Rasbeerypi) Rasbeerypi & CO7
Board
*TIPS FOR UNIVERSITY EXAM
49 PREPARATION

95
XII. Mapping Course Outcomes Leading to the Achievement of Program Outcomes and Program Specific
Outcomes:

Program Specific
Outcomes
Course

Program Outcomes (PO) Outcomes (PSO)


PO PO PO PO PO PO PO PO PO PO1 PO1 PO1 PSO PSO PSO
1 2 3 4 5 6 7 8 9 0 1 2 1 2 3
CO1 3 3 3 3 3 - - 1 2 - 2 1 3 3 2
CO2 3 3 3 3 3 - - 1 2 - 2 1 3 3 2
CO3 3 3 3 3 3 - - 1 2 - 2 1 3 3 2
CO4 3 3 3 3 3 - - 1 2 - 3 1 3 3 2
CO5 3 3 3 3 3 - - 1 2 - 3 1 3 3 2
AV 3.0
G 3.0 3.0 0 3.0 3.0 1.0 2.0 2.40 1.00 3.00 3.00 2.00

3: Substantial (High) - : None


1: Slight (Low) 2: Moderate (Medium)
Descriptive Questions
X. QUESTION BANK DESCRIPTIVE QUESTIONS:
Short Answer Questions-
UNIT-I
S.NO QUESTION BLOOMSTaxonomy
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

96
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 AnswerQuestions-
S.NO QUESTION BLOOMSTaxonomy
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 AnswerQuestions-
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 AnswerQuestions-
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

97
Long AnswerQuestions-
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 AnswerQuestions-
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 AnswerQuestions-
S.NO QUESTION BLOOMSTaxonomy
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
Descriptive Questions
1. Define python? List the standard data types of python?
2. Define variable in python and list the rules of python variables?
3. Write a python program to create variables in terms of integer, float and string?
4. Write a python code to demonstrate type conversions using int (), float () and str ()?
5. What are the different types of operators used to evaluate Boolean expression?
6. Write a python program to find biggest of two numbers using conditional if?
7. . Write a python function using with parameter and return type?
8. Define python? List the standard data types of python?
9. Define variable in python and list the rules of python variables?
10. Write a python program to create variables in terms of integer, float and string?
11. Write a python code to demonstrate type conversions using int (), float () and str ()?
12. What are the different types of operators used to evaluate Boolean expression?
13. Write a python program to find biggest of two numbers using conditional if?
14. . Write a python function using with parameter and return type?
15. Write a python program using function to the print the value of x as local and global?
16. Define file and explain the two categories of files?
17. How to import a module from a package show with an example?
98
18. Define Exception? List any 6 types of exception?
19. How to rename a module in python and write the syntax and program?
20. Define python? List the standard data types of python?
21. Define variable in python and list the rules of python variables?
22. Write a python program to create variables in terms of integer, float and string?
23. Write a python code to demonstrate type conversions using int (), float () and str ()?
24. What are the different types of operators used to evaluate Boolean expression?
25. Write a python program to find biggest of two numbers using conditional if?
26. . Write a python function using with parameter and return type? [5+5+4]
27. Write a python program using function to the print the value of x as local and global?
28. Define file and explain the two categories of files?
29. How to import a module from a package show with an example?
30. Define Exception? List any 6 types of exception?
31. How to rename a module in python and write the syntax and program?
OBJECTIVE QUESTIONS
UNIT 1
1. What Is The Default Return Value For A Function That Does Not Return Any
ValueExplicitly?

2. Which Of The Following Items Are Present In The FunctionHeader?


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 CodeSnippet?
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:
definit(self, s): self.s
=s
def print(self):
print(s)
a = Test("Python
Class") a.print() gives an error because there is no constructor for classTest.
A. The program
B. Signature for the print method is incorrect, so an error isthrown.
C. The correct output is.
D. The above code will execute correctly on changing print(s) toprint(self.s).
99
Q-6What Will Be The Output Of The Following Code?
class Test:
definit(self, s): self.s
=s
def print(self):
print(self.s)
msg = Test()
A. The program has an error because class Test does not have aconstructor.
B. The above code produces an error because the definition of print(s) does notinclude
. 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 Fischerisa algorithm. (Dynamic programming)
8. Wagner Fischer algorithm is usedtofind (Edit distance between
two strings)
9.
operations are insertion, deletionand substitution?_ (2)

10.What will be theoutput? (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

\ \\
\ d) \\
2.What is theoutput?
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
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:
100
# Do something
a) no, there is no such thing as finally b) no, finally cannot be used with except
c) no, finally must come beforeexcept 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 listof Answer: Lines
7. Program code making use of a given module iscalleda of the module. Answer:Client
8. is a string literal denoted by triple quotes for providing the specifications of certain
programelements. Answer:Docstring
10.What will be theoutput? (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
\ \\
\ d) infil \\
2.What is theoutput?
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
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 beforeexcept d) yes
5. All modular designs are because of a top-down design process? True or False?
a) True b) False
9. The readlines() method returnsa listof Answer: Lines
10. Pr the module. Answer:Client
ogram code making use of a given module iscalleda of specifications of certain
11. is a string literal denoted by triple
quotes for providing the programelements. Answer:Docstring
9. exceptions are raised as a result of an error in opening aparticular
file. Answer:IOError
101
10. Methods of a class that provide access to private members of the class are calledas
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.')

6. The cha
(newline)
7.The expression a{5}willmatch characters with the previousregular
expression.( exactly 5)
8. functions matches a pattern at any position in thestring(re.search)

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


specified, itdefaultsto (Zero)
10. functions does not accept anyargument(re.purge)

UNITIV
1. How do you create awindow??
a) window = newWindow() b) window = Window()
c) window=Frame() d) window =Tk()
2. How do you create aframe?
a) frame=newWindow() b) frame = Window()
c) frame=Frame() d) frame = Tk()
3. How do you create an eventloop??
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 notassigned")
b) tkinter.messagebox.showwarning("showwarning", "Variable is notassigned")
c) tkinter.messagebox.showerror("showerror", "Variable is notassigned")
d) tkinter.messagebox.askyesno("ashyesno", "Variable is notassigned")
102
6. grid()method
7. w=Canvas( ) Answer : master,option=value
8. Listbox) Answer : offers a list to the user from which the user canaccept
any number ofoptions.
9. CGI standsfor
10. Module used for GUI and webprogramming
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.ORMsstands (Object relation models)
7.DB-API standsfor
8. Relational databases are the most widely used type of database, storing informationas
tables containing a number ofrows.(TRUE/FALSE)
9. method of cursor class is used to fetch limited rows from thetable
(cursor.fetchmany(SIZE))
10 method of cursor class is used to get the number of rows affected after anyof
the insert/update/delete database operation executed from Python(cursor.rowcount)
GATE QUESTIONS
NOT Related

Websites:
https://www.python.org/https://pythonprogramming.net
/
https://www.edureka.co/blog/python-programming-
languagehttps://www.programiz.com

XIV.
1. PythonBasics
2. Lists, andTuples

103

You might also like