Department of Computer Science
Course Code: CSC-102
Course Title: Programming Fundamentals
Fall 2025
Lab 08
Objective: Evaluate programming logic, control structures (if, for, while), use of functions
(modular and recursive), built-in functions, and basic data handling.
Student Information
Student Name
Student ID
Date
Assessment
Marks Obtained
Remarks
Signature
Lab 8 Evaluation Rubric
Criteria UNSATISFACTORY COMPETENT (2) PROFICIENT (3) DISTINGUISHED (4)
(1)
Capability of Unable to outline logical Partial steps of the Most steps are All steps of the algorithm
Writing steps or structure of the algorithm are implemented are implemented
Algorithm / algorithm. outlined with some correctly with minor correctly and logically.
Procedure logical errors. logical issues.
Capability of Program incomplete or Program partially Program complete Program complete,
Writing contains major complete; variable with minor logical logically correct, with
Program syntax/logical errors. naming or formatting clear structure, proper
inconsistent; limited issues. variable naming, and
formatting. good formatting.
Use of Control structures Some control Most control All control structures (if,
Control missing or used structures used but structures used for, while) used
Structures (if, incorrectly. with logical errors appropriately with effectively and correctly
for, while) or poor integration. minor issues. in solving problems.
Use of Functions not Few functions Functions Functions (modular and
Functions implemented or implemented implemented recursive) implemented
(Modular / incorrect. correctly; recursion correctly with efficiently and correctly.
Recursive) incomplete. some redundancy
or minor errors.
Usage of No use or incorrect use Limited or partially Appropriate use of Extensive and correct use
Built-in of built-in functions. correct use of built- built-ins in most of built-ins (min, max,
Functions ins. tasks. sum, len, etc.) where
applicable.
Completion Less than 25% tasks Around 50% of lab Around 75% of lab All (100%) lab tasks
of Target in completed. tasks completed. tasks completed. completed successfully.
Lab
Output and No correct output Some correct Most outputs All outputs correct,
Results produced. outputs but not correct and formatted neatly, and
formatted or formatted well-documented.
consistent. appropriately.
1 Objectives
Evaluate programming logic and problem-solving.
Assess understanding of control structures (if, for, while).
Test ability to use functions (modular and recursive).
Check usage of built-in functions and basic data handling.
1 Question 1: Simple I/O and Arithmetic
Write a program that takes two numbers and prints:
Their sum, difference, product, and average.
Sample Input:
Enter first number: 6
Enter second number: 4
Sample Output:
Sum = 10
Difference = 2
Product = 24
Average = 5.0
2 Question 2: Even, Odd, and Positive Check
Write a Python program that:
Takes an integer from the user.
Checks whether it is even or odd.
Also check if it’s positive, negative, or zero.
Use nested if-else statements.
3 Question 3: Multiplication Table using for Loop
Write a program that prints the multiplication table of a number entered by the user up to 10.
Sample Output:
Enter number: 5
5 x 1 = 5
5 x 2 = 10
...
5 x 10 = 50
4 Question 4: Factorial using while Loop
Write a Python program to find the factorial of a number using a while loop.
Sample Input: 5
Expected Output: Factorial of 5 = 120
5 Question 5: Sum of Digits using while Loop
Write a program that calculates the sum of digits of a number using a while loop.
Example:
Input: 1234 → Output: 10
6 Question 6: Fibonacci Series using for Loop
Write a program that prints the first n terms of the Fibonacci series using a for loop.
Input: n = 7
Output: 0 1 1 2 3 5 8
7 Question 7: Palindrome Checker (String & Loop)
Write a program that checks whether a given string is a palindrome (reads same forward and
backward).
Input: madam
Output: madam is a palindrome.
Hint: Use slicing or loop comparison.
8 Question 8: Function – Simple Calculator
Define a function calculator(num1, num2, op) that performs:
Addition (+)
Subtraction (-)
Multiplication (*)
Division (/)
Call the function based on user input.
Example:
Enter first number: 8
Enter operator (+, -, *, /): *
Enter second number: 5
Result: 40
9 Question 9: Recursive Problems (Choose any one)
Write a recursive function for either:
a) Factorial:
factorial(n) that returns n × factorial(n-1)
10 Question 10: Built-in Functions Practice
Given the list:
data = [23, 56, 12, 89, 34, 90, 45]
Write a program that prints:
Maximum value
Minimum value
Sum of all numbers
Average value
Count of numbers greater than 50
Use built-in functions: max(), min(), sum(), len().
11 Question 11: Write a Python program to convert any number from 1 to 9999 into words
using loops and conditions.
1. Example:
Input: 542
Output: five hundred forty two
2. Hints:
Create lists for word mappings:
ones = ["", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]
teens = ["ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen",
"sixteen", "seventeen", "eighteen", "nineteen"]
tens = ["", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]
Handle cases using if-elif-else:
1–9 → use ones
10–19 → use teens
20–99 → use tens + ones
100–999 → use hundred
1000–9999 → use thousand