AKTU B.
TECH · PYTHON PROGRAMMING
PYQ Analysis
Most Important Questions
Based on 4 years of question papers · 2021-22 to 2024-25 · 7 Marks Questions
4 5 25 70
PAPERS ANALYSED COURSE OUTCOMES TOP QUESTIONS MAX MARKS
CO1
Python Basics & Operators
Data Types · Operator Precedence · Type Conversion · Introduction
1 Explain Operator Precedence and Associativity in Python. Solve the following expressions
step-by-step, given a=3, b=5, c=10:
(i) a & b<<2//5**2+c^b
(ii) b>>a**2<<2>>b**2^c**3
⭐ 3 Papers 7 Marks
2 Write short notes on the following with examples:
(a) Operator Precedence (b) Python Indentation (c) Type Conversion
⭐ 3 Papers 7 Marks
3 Discuss why Python is an interpreted language. Explain the history and features of Python
while comparing Python version 2 and Python version 3.
⭐ 2 Papers 7 Marks
4 Write a Python program to swap two numbers without using a temporary variable. Prompt
the user for input.
⭐ 2 Papers 7 Marks
Explore our developer-friendly HTML to PDF API Printed using PDFCrowd HTML to PDF
5 Write a program to validate email addresses using Regular Expressions.
Criteria: (1) Must contain @ symbol (2) Must contain domain name (3) Should not have
spaces
1 Paper (2024-25) 7 Marks · High Weightage
CO2
Control Structures & Loops
for · while · break · continue · Strings · Patterns
1 Explain for loop and while loop in Python with appropriate examples. Also discuss the
break and continue statements with examples. When is else used with a loop?
⭐ 4 Papers 7 Marks · Most Repeated
2 Write a Python Program to find the LCM of two numbers. (Hint: Use GCD logic, then apply
LCM = (a × b) / GCD(a, b))
⭐ 2 Papers 7 Marks
3 Write a Python program to check if an input number is prime or not. Also write an
algorithm/program to generate all prime numbers up to N.
⭐ 3 Papers 7 Marks
4 Write a program to create the following Hollow Pyramid Pattern:
*
* *
* *
* *
*********
⭐ 2 Papers 7 Marks
5 Write a Python program that accepts a sentence and calculates the number of digits,
uppercase letters, and lowercase letters present in it. Explain with output.
⭐ 2 Papers 7 Marks
Explore our developer-friendly HTML to PDF API Printed using PDFCrowd HTML to PDF
CO3
Functions, Lists, Tuples & Dictionaries
Built-in Methods · String Manipulation · List Comprehension
1 Distinguish between a List and a Tuple with examples. Explain at least 4 built-in methods
of Dictionary with suitable examples of each.
⭐ 3 Papers 7 Marks
2 Explain the concept of functions in Python. Write a function that takes a list of numbers
and returns the sum of all numbers in the list. Also explain the concept of list comprehension.
⭐ 3 Papers 7 Marks
3 Write a Python program to remove duplicates from a list and print the resulting list. Also
explain how to define a list in Python and its methods.
⭐ 2 Papers 7 Marks
4 Write a Python function to count the frequency of each character in a given string and
return the output as a dictionary.
Example: char_frequency("HELLO") returns {"H":1, "E":1, "L":2, "O":1}
⭐ 2 Papers 7 Marks
5 Write a Python function to find the longest word in a given list of words.
Example: longest_word(['apple', 'banana', 'cherry']) returns 'banana'
1 Paper (2024-25) 7 Marks · High Weightage
CO4
File Handling, Exceptions & OOP
File Modes · try-except · Inheritance · Modules
1 Explain different file opening modes in Python. Write a Python program to read a file and
capitalize the first letter of every word in the file.
⭐ 4 Papers 7 Marks · Most Repeated
2 Discuss Exceptions and Assertions in Python with suitable examples. Explain any two
built-in exceptions. Compare assert , try-except and raise statements.
Explore our developer-friendly HTML to PDF API Printed using PDFCrowd HTML to PDF
⭐ 3 Papers 7 Marks
3 Write a Python program to read a file named "[Link]" and count the number of lines,
words, and characters in the file. Also explain the purpose of the with statement in file
handling.
⭐ 2 Papers 7 Marks
4 Illustrate through examples how to implement different types of inheritance in Python.
Explain the static method, instance method, and class method with suitable examples.
⭐ 2 Papers 7 Marks
5 Write a program to reverse the contents of a file character by character, separating each
character with a comma. Also write a program to read a CSV file and display rows where a
specific column value exceeds a given threshold.
1 Paper (2024-25) 7 Marks · High Weightage
CO5
NumPy, Pandas, Matplotlib & Algorithms
DataFrames · Graphs · Random Numbers · Sorting · Recursion
1 Explain the concept of DataFrame in Pandas. Write a Python program to create a
DataFrame from a dictionary and print it.
⭐ 3 Papers 7 Marks
2 Explain the basic usage of matplotlib for plotting graphs. Write a Python program to plot a
simple line graph showing the relationship between x = [1, 2, 3, 4, 5] and y = [1, 4,
9, 16, 25] .
⭐ 2 Papers 7 Marks
3 Describe how to generate random numbers using NumPy. Write a Python program to
create an array of 5 random integers between 10 and 50. Also explain why NumPy is
preferred over Python arrays for mathematical calculations.
⭐ 2 Papers 7 Marks
4 Explain the Tower of Hanoi problem and its recursive solution in Python. Also write a
Python program to implement the merge sort algorithm and discuss how to compare the
Explore our developer-friendly HTML to PDF API Printed using PDFCrowd HTML to PDF
time complexity of two algorithms.
⭐ 2 Papers 7 Marks
5 Create a Pie Chart using matplotlib to represent programming language popularity data:
Python 30% · Java 25% · C++ 20% · JavaScript 15% · Ruby 10%
Also write a program to read [Link] , calculate average marks for each student, and
display results.
1 Paper (2024-25) 7 Marks · High Weightage
📌 Key Exam Takeaways
🔁 Loops (CO2) 📂 File Handling (CO4)
for/while loops with break & continue appear File modes + reading/writing appear in all 4
in all 4 papers. Must prepare. papers. Highest repeat rate.
📋 List/Tuple/Dict (CO3)
Data structures with built-in methods
🔢 Operator Precedence (CO1)
Expression evaluation with step-by-step
appear in 3+ papers consistently. solution — 3 papers, high scoring.
📊 Pandas & matplotlib (CO5)
DataFrame creation and graph plotting are
⚠️ Exception Handling (CO4)
try-except-raise-assert combination asked
consistently asked across years. in 3 papers. Pair with file handling.
🆕 2024-25 NEW TRENDS — PREPARE THESE TOO
These topics appeared for the first time in 2024-25 and are likely to recur:
Regular Expressions Lambda in List Comprehension CSV File Processing
Tkinter Event Handling Hollow Pyramid Pattern Email Validation
Explore our developer-friendly HTML to PDF API Printed using PDFCrowd HTML to PDF