Course: B.Tech (Mechanical / Computer Science Engineering)
Semester: V
Subject Code: KME056
Subject Title: Programming, Data Structures & Algorithms using Python
Maximum Marks: 100
Time: 3 Hours
Paper Structure:
Section A: Short answer (20 marks)
Section B: Medium / descriptive (30 marks)
Section C: Long / application-based (50 marks)
SECTION A — Short Answer Questions (2 × 10 = 20 Marks)
Ten brief conceptual questions to test core understanding:
Two characteristics of Python programming language. How to initialize a string in Python.
Difference between an array and a list. Definition and use of slicing.
How to define a function in Python. Meaning of global scope in functions.
What is a stack? Define a queue in Python.
Explain Big-O notation. Define dynamic programming.
These questions assess basic syntax, theory, and algorithmic concepts.
SECTION B — Descriptive Questions (10 × 3 = 30 Marks)
Attempt any three questions.
Explain data types in Python (int, float, string, bool, list, tuple, set, dict).
Explain tuples and dictionaries with examples and operations.
Define file handle and its use with examples (open(), read(), write(), etc.).
Describe commands related to stacks and queues (append(), pop(), enqueue(), dequeue()).
Write a Python program for matrix multiplication using nested loops or NumPy.
This section focuses on practical knowledge and implementation clarity
SECTION C — Long Answer Questions (10 × 5 = 50 Marks)
Students must attempt one part from each question (Q3–Q7).
Q3 — Control Statements and IDE
a. Explain break, continue, and pass with examples.
b. Explain functions of Python IDEs (like IDLE, PyCharm, Jupyter).
Q4 — List and Sorting
a. Explain list operations with examples (append, extend, insert, remove, sort, reverse).
b. Write and explain a Selection Sort program in Python.
Q5 — File Handling
a. Explain commands for reading files (read(), readline(), readlines()).
b. Summarize Python commands commonly used in data handling (with, open, write).
Q6 — OOP and Trees
a. Explain classes and objects in Python with a valid program.
b. Define search trees and explain binary trees with structure and traversal.
Q7 — Algorithms
a. Write a Python program to calculate the GCD (Greatest Common Divisor).
b. Write and explain Euclid’s Algorithm for GCD.
These long questions test both coding ability and conceptual clarity
Core Topics Covered
Python fundamentals and syntax Data structures (lists, tuples, dictionaries, stacks, queues)
Sorting and searching algorithms File handling and I/O
Object-oriented programming Computational complexity (Big-O)
Recursion and dynamic programming Algorithmic problem solving
FAQs
Q1. What is the difference between an array and a list in Python?
Arrays store elements of the same type, while lists can store mixed data types.
Q2. What is Big-O notation?
Big-O represents the time complexity of an algorithm — how efficiently it runs as data size increases.
Q3. What is the use of a stack?
A stack follows the LIFO principle (Last In, First Out) used in function calls and backtracking.
Q4. What is slicing in Python?
Slicing allows extracting a part of a sequence using index ranges, e.g., my_list[1:4].
Q5. What is the difference between break and continue?
break exits the loop entirely, while continue skips the current iteration and moves to the next.