Python (ME-506) - Important Questions
-
Unit 17 Marks High Priority
Explain Python built-in data types (numeric, sequence, mapping, set, boolean) and demonstrate type conversion methods with examples. Include examples showing implicit and explicit type conversion between $\left\{\text{int, float, str, list, tuple, dict, set}\right\}$.
Core fundamentals: data types, literals, and implicit/explicit type conversion in Python (Unit 1). High-priority foundational topic for exams and interviews.
-
Unit 210 Marks High Priority
Write a Python function to sort a list using merge sort. Provide the complete implementation and derive the time complexity $\left\text{in Big-}O\right$ notation.
Algorithm implementation and complexity analysis using Python functions. Frequently asked to evaluate code and complexity.
-
Unit 27 Marks High Priority
Compare Python lists and tuples in terms of mutability, typical use-cases, and time complexity of common operations such as append, pop and indexing. State the complexity using Big-O notation, e.g., $O\left(1\right)$ where appropriate.
Comparison of core sequence types and their performance characteristics; commonly asked to distinguish list vs tuple and operational complexities.
-
Unit 210 Marks High Priority
Explain Python function definitions, positional and keyword arguments, default arguments, variable-length arguments ($*args$, $**kwargs$), lambda expressions, and closures. Provide concise code examples for each.
Functions, parameter passing conventions, anonymous functions, and closures are core language features often examined.
-
Unit 314 Marks Medium Priority
Explain OOP concepts in Python: class, object, inheritance, method overriding, polymorphism, and encapsulation. Implement a Python class for a simple Matrix with methods for addition and multiplication and overload the $+$ and $*$ operators. State the element-wise addition formula $\left(A + B\right)_{ij} = A_{ij} + B_{ij}$ used in your implementation.
Object-oriented programming essentials: class design, inheritance, polymorphism, and operator overloading. Typical long-answer programming question.
-
Unit 510 Marks Medium Priority
Write a Python program to read a CSV file containing numerical data, compute the column-wise mean values, and handle missing or malformed lines using exception handling (demonstrate try-except-finally). Explain how resources are safely managed.
File operations and robust programming with exceptions are practical and frequently tested skills.
-
Unit 410 Marks High Priority
Using NumPy, demonstrate creation of 1-D and 2-D arrays, broadcasting rules, and vectorized operations. Compute the dot product of two vectors and state the formula $\mathbf{a}\cdot\mathbf{b}=\sum_{i=1}^{n} a_i b_i$ in your explanation.
NumPy practical operations including vectorized computation and numerical formulas; core for scientific computing questions.
-
Unit 410 Marks High Priority
Using Pandas, show how to load a CSV into a DataFrame, perform grouping and aggregation (groupby and aggregate), create a pivot table, and demonstrate methods to detect and handle missing data (dropna, fillna). Provide short code examples.
Pandas data manipulation tasks such as loading datasets, grouping, pivoting, and missing value handling are core practical skills tested in exams.
-
Unit 47 Marks Medium Priority
Write a Python script using Matplotlib to plot stress vs. strain data from arrays, label the axes, add a title and legend, set axis limits, and save the figure to a PNG file.
Data visualization with Matplotlib: plotting, labeling, and saving figures — commonly asked practical question.
-
Unit 310 Marks Medium Priority
Explain Python generators and decorators. Implement a generator that yields Fibonacci numbers and write a decorator that measures and prints the execution time of any function it wraps.
Advanced language features like generators and decorators are increasingly included in questions testing Pythonic design and performance.
Quick Add to Notes
Save questions, your own notes and screenshots into notes filed by unit. It takes a free account.
Create free accountHave an account? Log in
Notes Panel