GALGOTIAS UNIVERSITY
School of Computing Science and Engineering
Mid Term Examination — Even Semester 2025–26
Course: Python Course Code: CSE / Duration: 90 Minutes Max. Marks: 50
Programming BCA / [Link]
Date: Roll No.: Section: Branch / Year:
_________________ _________________ _________________ _________________
GENERAL INSTRUCTIONS
1. This paper consists of FOUR sections. Attempt all sections.
2. Section A (MCQ) — 1 mark each | Section B (Short Answer) — 2 marks each
3. Section C (Medium Answer) — 5 marks each | Section D (Long Answer) — 10 marks each
4. Write neat and legible code wherever required. Marks will be deducted for untidy work.
5. Assume suitable data if not provided. Mobile phones and electronic gadgets are not allowed.
MARKS DISTRIBUTION AT A GLANCE
Section A — MCQ B — Short Answer C — Medium D — Long Answer
Answer
Marks 10 × 1 = 10 5 × 2 = 10 2 × 5 = 10 2 × 10 = 20
SECTION A — MULTIPLE CHOICE QUESTIONS [10 × 1 = 10 Marks]
Instructions: Each question carries 1 mark. Choose the most appropriate option.
1. Which of the following is NOT a feature of Python?
(a) Easy to learn and read
(b) Platform dependent
(c) Open source
(d) Supports object-oriented programming
2. What will be the output of: type(3.14) ?
(a) <class 'int'>
(b) <class 'float'>
(c) <class 'double'>
(d) <class 'number'>
3. Which keyword is used to define a function in Python?
(a) function
(b) define
(c) def
(d) func
4. What is the index of the first element in a Python list?
(a) 1
(b) -1
(c) 0
(d) Depends on the list
5. What will print(10 // 3) output?
(a) 3.33
(b) 3
(c) 4
(d) 1
6. Which data type is IMMUTABLE in Python?
(a) List
(b) Dictionary
(c) Set
(d) Tuple
7. What does the len() function return for the string 'Python' ?
(a) 5
(b) 6
(c) 7
(d) Error
8. Which loop is used when the number of iterations is not known in advance?
(a) for loop
(b) while loop
(c) do-while loop
(d) nested loop
9. What is the output of: print(type(lambda x: x+1)) ?
(a) <class 'function'>
(b) <class 'lambda'>
(c) <class 'method'>
(d) <class 'object'>
10. Which module in Python provides mathematical functions like sqrt(), ceil(), floor()?
(a) os
(b) sys
(c) math
(d) random
SECTION B — SHORT ANSWER QUESTIONS [5 × 2 = 10 Marks]
Instructions: Answer ALL questions. Each question carries 2 marks. Keep answers concise.
Q1. List any FOUR Python keywords and explain their purpose with one-line descriptions. [2 marks]
Q2. Differentiate between '==' (equality operator) and '=' (assignment operator) in Python with an
example. [2 marks]
Q3. What is indentation in Python? Why is it mandatory? Give an example showing correct and
incorrect indentation. [2 marks]
Q4. Write a Python statement to take a user's name and age as input and print: Hello <name>, you are
<age> years old. [2 marks]
Q5. Explain the difference between a List and a Tuple in Python. Give one example of each. [2
marks]
SECTION C — MEDIUM ANSWER QUESTIONS [2 × 5 = 10 Marks]
Instructions: Answer ANY TWO questions. Each question carries 5 marks.
Q1. Explain string slicing in Python with syntax and examples. Write a Python program that: [5
marks]
(i) Takes a string input from the user.
(ii) Prints the string in reverse using slicing.
(iii) Prints every alternate character of the string.
(iv) Prints a substring from index 2 to 6.
(v) Checks whether the string is a palindrome or not.
Q2. Write a Python program to demonstrate the use of a Dictionary. The program should: [5 marks]
(i) Create a dictionary storing student names as keys and their marks as values (at least 4 entries).
(ii) Display all keys, all values, and all key-value pairs.
(iii) Add a new student entry.
(iv) Delete an existing entry.
(v) Check if a particular student name exists in the dictionary.
Q3. Write a Python program using user-defined functions to: [5 marks]
(i) Define a function calculate_grade(marks) that returns A / B / C / D / F based on marks range.
(ii) Define a function find_factorial(n) that returns the factorial of n using a loop.
(iii) Call both functions with appropriate arguments and display the results.
(iv) Also demonstrate a lambda function to compute the square of a number.
(v) Explain the concept of local vs global variable with an example.
SECTION D — LONG ANSWER QUESTIONS [2 × 10 = 20 Marks]
Instructions: Answer ANY TWO questions. Each question carries 10 marks. Be detailed and use code wherever
needed.
Q1. Write a complete Python program that implements a Student Grade Management System using
Lists, Strings, and Loops. The program should: [10 marks]
(a) Accept the names and marks (out of 100) of 5 students using a loop and input().
(b) Store the data in separate lists: one for names, one for marks.
(c) Display a formatted result table with: Roll No. | Name | Marks | Grade | Result (Pass/Fail).
(d) Calculate and display: class average, highest marks (with student name), and lowest marks.
(e) Count and display how many students passed (marks >= 40).
(f) Sort and display student names in alphabetical order.
(g) Use at least one user-defined function in your solution.
[Marks: Correct logic = 4 | Proper use of Lists & Loops = 3 | Functions & formatting = 3]
Q2. Answer the following multi-part question on Python Basics, Operators, and Control Flow: [10
marks]
(a) [2 marks] Explain all types of Python operators (Arithmetic, Relational, Logical, Assignment,
Bitwise, Membership, Identity) with one example each in a tabular format.
(b) [3 marks] Write a Python program using if-elif-else to create a simple calculator that takes
two numbers and an operator (+, -, *, /, //, %) from the user and displays the result. Handle
division by zero.
(c) [2 marks] Write a program using nested loops to print the following pattern:
*
**
***
****
*****
(d) [2 marks] Explain the difference between break, continue, and pass statements with a code
example for each.
(e) [1 mark] What is the difference between while True loop and a for loop? Give a use case
for each.
Q3. Write a comprehensive Python program demonstrating File Handling and Modules. The program
should: [10 marks]
(a) [2 marks] Import the math module and demonstrate: sqrt(), pow(), ceil(), floor(), pi,
factorial().
(b) [3 marks] Write a program that creates a text file '[Link]' , writes 5 student records
(name and marks separated by comma), reads the file back, and displays the data in formatted
output.
(c) [2 marks] Handle the FileNotFoundError exception when trying to open a non-existent file
using try-except-finally.
(d) [2 marks] Demonstrate the difference between append mode ('a') and write mode ('w')
when opening files.
(e) [1 mark] Explain what import random does and demonstrate any two functions from the
random module.
★ BONUS QUESTION (Attempt for Extra Credit — Not Compulsory)
Q*. Write a Python program using lambda functions and the map() and filter() built-in functions to:
(a) Square all elements of a list using map(). (b) Filter all even numbers from the list using
filter(). (c) Use a lambda inside sorted() to sort a list of tuples by the second element. [Bonus
marks]
HIGH-PROBABILITY TOPIC ANALYSIS
Based on Galgotias University PYQs and standard mid-term patterns — study these topics FIRST
Rank Topic Unit Exam Weight Most Likely
Question Type
1 ★★★ Lists & Dictionaries 6–7 Very High Write program +
Operations
2 ★★★ User-Defined 7 Very High Write + Explain
Functions
3 ★★★ Loops 4 Very High Pattern / Program
(for/while/nested)
4 ★★★ String Methods & 5 High Code output + Write
Slicing program
5 ★★ Operators (all types) 3 High Table format or
MCQ
6 ★★ if-elif-else / 4 High Write program
Calculator
7 ★★ Lambda + map/filter 8 Medium Short code question
8 ★★ File Handling 8 Medium Read/Write file
program
9★ Data Types & 2 Medium MCQ / Differentiate
Variables
10 ★ Math Module & 8 Low-Med MCQ / Short Answer
import
** END OF QUESTION PAPER **
Prepared as a model paper for Galgotias University Mid-Term | Python Programming | 90 Min | 50 Marks