Python Programming Syllabus Summary
and Viva Questions
Syllabus Summary
Unit I: Python Basics
Basics: Python interpreter, variables, expressions, data types.
Conditionals: if, if-else, if-elif-else.
Loops: for, while, break, continue, range, in/not in.
Writing and running `.py` scripts.
Unit II: Data Structures
Lists: append, insert, remove, sort, slicing, list comprehension.
Tuples: index, count, immutability, swap function.
Dictionaries: keys, values, nested dicts.
Strings: formatting, string functions (isdigit, isalpha, etc.).
Sets: union, intersection, difference, add, remove.
Unit III: Functions & File Handling
Inbuilt functions: len(), id(), chr(), etc.
User-defined functions, arguments, global vs local variables.
Lambda functions, map(), filter(), reduce().
File handling: read, write, modes (r, w, a, x), read(), write(), seek().
Unit IV: OOP, Modules, Exceptions
Classes: constructor, destructor, inheritance, encapsulation.
Modules: sys, time, import techniques.
Packages, __init__.py.
Exception Handling: try-except-else-finally, raise, custom exceptions.
Unit V: Database & GUI Programming
SQLite: create, insert, update, delete tables using Python.
GUI: Tkinter module, buttons, labels, dialogs, layouts, frames.
Important Viva Questions with Answers
Q: What is Python?
A: Python is a high-level, interpreted, object-oriented programming language.
Q: What is the difference between a list and a tuple?
A: Lists are mutable, tuples are immutable.
Q: What is a dictionary in Python?
A: A collection of key-value pairs.
Q: What is the use of if-elif-else?
A: To run different blocks of code based on conditions.
Q: What is the purpose of a loop?
A: To repeat a block of code multiple times.
Q: What is the difference between break and continue?
A: break exits the loop, continue skips the current iteration.
Q: What is a function?
A: A block of code that runs when called, used for specific tasks.
Q: What are lambda functions?
A: Small anonymous functions defined with lambda keyword.
Q: How do you handle exceptions in Python?
A: Using try, except, finally, and raise.
Q: What is inheritance in OOP?
A: A class can inherit features from another class.
Q: What is a module?
A: A file with Python code that can be imported.
Q: What is the use of map() and filter()?
A: map() applies a function, filter() filters items.
Q: What is Tkinter?
A: A Python library to create GUI applications.
Q: What is SQLite?
A: A lightweight database used to manage data.
Q: How do you read a file in Python?
A: Using open('filename', 'r') and then read() or readlines().