CS25C02 - COMPUTER PROGRAMMING : PYTHON
Compiled Question Bank (Part A - 2 marks, Part B - 16 marks)
Prepared for Anna University style exams
Date: 2025-10-30
--- UNIT 1: Introduction to Python ---
Part A (2 marks)
1. Define algorithm and flowchart.
2. What is pseudocode? Give an example.
3. Differentiate interactive mode and script mode.
4. What is indentation in Python?
5. List any four data types in Python.
6. What are reserved words? Give two examples.
7. Define variable and give an example.
8. Mention any two built-in functions in Python.
9. What is the use of the 'import' statement?
10. Give examples of arithmetic operators.
Part B (16 marks)
1. Explain the steps in problem solving with suitable examples.
2. Draw a flowchart and write pseudocode for finding the largest of three numbers.
3. Write a Python program to calculate area and perimeter of geometric shapes using arithmetic operators.
4. Explain interactive and script mode with example codes.
5. Discuss the importance of indentation, comments, and error messages in Python programs.
6. Write a Python program using built-in functions and demonstrate importing from packages.
--- UNIT 2: Control Structures ---
Part A (2 marks)
1. What is the syntax of the if statement?
2. Differentiate if and if-else.
3. What is the purpose of elif?
4. Define nested loop.
5. What is the use of the pass statement?
6. Write the syntax of a for loop.
7. What is the difference between for and while loop?
8. What will happen if the loop condition is never true?
9. Write one example for multi-way decision making.
10. What is an infinite loop?
Part B (16 marks)
1. Explain various decision-making statements with syntax and examples.
2. Write a Python program to check whether a number is even or odd using if-else.
3. Write a program to find the grade of a student using if-elif-else.
4. Explain the working of for and while loops with suitable examples.
5. Write a Python program to print multiplication tables using nested loops.
6. Discuss the role of the pass statement in control structures.
--- UNIT 3: Functions ---
Part A (2 marks)
1. Define a function in Python.
2. What is a parameter?
3. Differentiate formal and actual arguments.
4. What is a return statement?
5. What is recursion?
6. What is a lambda function?
7. Define named arguments.
8. What is the use of a function?
9. How do you call a function in Python?
10. Can a function return multiple values?
Part B (16 marks)
1. Explain the concept of functions in Python with examples.
2. Write a Python program using a function to find factorial of a number.
3. Explain recursion with an example program.
4. Write a program to find the sum of digits using user-defined function.
5. Differentiate between normal and lambda functions with examples.
6. Explain parameter passing techniques in Python with examples.
--- UNIT 4: Strings & Collections ---
Part A (2 marks)
1. What is string slicing?
2. How to compare two strings in Python?
3. What is the use of split() and strip() functions?
4. Differentiate list and tuple.
5. How to add and remove elements in a list?
6. What is a dictionary literal?
7. Write syntax to access and replace a dictionary value.
8. Mention any two list operators.
9. What is meant by sorting a list?
10. Define immutable type with an example.
Part B (16 marks)
1. Explain various string operations with examples.
2. Write a Python program to count vowels, consonants, digits, and spaces in a string.
3. Discuss the creation and manipulation of lists and tuples with examples.
4. Write a program to search and sort elements in a list.
5. Write a Python program to create a dictionary and perform add, remove, update, and access operations.
6. Compare lists, tuples, and dictionaries in terms of mutability and usage.
--- UNIT 5: File Operations ---
Part A (2 marks)
1. What is a file in Python?
2. Differentiate text file and binary file.
3. Write the syntax for opening a file.
4. What is the purpose of read() and write() methods?
5. What is the use of the with statement in file handling?
6. How do you append data to a file?
7. Name any two file modes in Python.
8. What is the use of the os module?
9. What is the sys module used for?
10. What is a CSV file?
Part B (16 marks)
1. Explain file handling in Python with example programs.
2. Write a program to read a file and count the number of lines, words, and characters.
3. Write a program to copy the contents of one file to another.
4. Demonstrate file reading and writing operations with append mode.
5. Explain the use of os and sys modules in file and directory manipulation.
6. Write a program to read and write CSV files using the csv module.
--- UNIT 6: Packages ---
Part A (2 marks)
1. What is a module?
2. What is a package?
3. How to import a module?
4. What are user-defined modules?
5. Give examples of built-in modules in Python.
6. What is NumPy used for?
7. Mention two functions of the Pandas library.
8. What is SciPy?
9. What is Scikit-learn mainly used for?
10. How to create and import a user-defined module?
Part B (16 marks)
1. Explain the concept of modules and packages in Python.
2. Write a Python program using a user-defined module and explain the steps.
3. Explain the features and uses of NumPy and Pandas with examples.
4. Discuss how data can be read and analyzed using Pandas.
5. Explain the structure and use of scientific computing packages (NumPy, SciPy, Scikit-learn).
6. Write a Python program demonstrating importing and using built-in modules.
--- PAST YEAR QUESTIONS (SELECTED) ---
(Paraphrased examples from Anna University-style previous papers and question banks)
1. Define algorithm and pseudo-code. (Apr/May 2024 - Part A)
2. Write a pseudo-code to accept two numbers, add them and print the result. (2019)
3. Explain the program development cycle. (2024 - Part B style)
4. Write algorithm, pseudocode and flowchart for Tower of Hanoi / Guess the number. (2024 - Part B)
5. Questions on list features, tuple advantages, string split(), range() usage, and module/package explanations commonly app
--- REFERENCES / SOURCES DISCOVERED ONLINE ---
1. Studocu internal notes and CS25C02 internal test material. (Studocu).
2. Anna University Question Bank (Library). (library.annauniv.edu)
3. Stucor - GE8151 Problem Solving and Python Programming question bank. (stucor.in)
4. DSCET GE8151 question bank PDF. (dscet.ac.in)
5. OnlineAnna / EnggTree aggregated Anna University question papers pages.
(Citations/details for web sources were collected while searching. If you want the direct PDFs I found online, I can attach them
--- END OF DOCUMENT ---