For students taking the Python Programming Question Paper (CPCPP-101) exam under the Certificate in Professional Skills program, understanding code logic is just as important as writing it. This paper tests your ability to predict outputs, understand Object-Oriented Programming (OOPS), and write basic Python scripts.

Below is the fully solved paper for the Short Term Batch II 2025 session. We have analyzed the code snippets to provide the exact outputs and written detailed answers for the theoretical sections.

Download Python Programming Question Paper


Solved: Python Programming Question Paper

Paper Code: 7408 Max Marks: 50 Duration: 2 Hours

Note: Attempt all questions.

Q1. What will be the output of the following Python statements?

ii)

Python

fruits=["apple", "banana", "cherry"]
print("List of fruits:")
for fruit in fruits:
    print("*", fruit)

Output:

Plaintext

List of fruits:
* apple
* banana
* cherry

iii)

Python

a = True
b = False
c = False
if not a or b:
    print (1)
elif not a or not b and c:
    print (2)
elif not a or b or not b and a:
    print (3)
else:
    print (4)

Logic Breakdown:

  • not a is False. b is False. First condition (False or False) is False.
  • not b is True. c is False. True and False is False. Second condition is False.
  • not b is True. a is True. True and True is True. Third condition (False or False or True) is True. Output: 3

iv)

Python

s = "Python"
print(s[1:4])

Logic: String slicing starts at index 1 (‘y’) and stops before index 4 (‘o’). Indices: 0=P, 1=y, 2=t, 3=h, 4=o, 5=n.

Output: yth

v)

Python

print(len([10, 20, 30]))

Output: 3

vi)

Python

i=1
while i<=3:
    print(i)
    i+=1

Output:

Plaintext

1
2
3

Q2. Answer any FIVE of the following:

i) What are variables and data types? Explain the built-in data types in Python.

  • Variable: A named location in memory used to store data (e.g., x = 5).
  • Data Types: Classifications that specify which type of value a variable has.
  • Built-in Types:
    • Numeric: int (integers), float (decimal numbers), complex.
    • Sequence: str (string), list, tuple.
    • Boolean: bool (True/False).
    • Dictionary: dict (key-value pairs).

ii) Name the different types of operators in Python and explain arithmetic operators.

  • Types: Arithmetic, Comparison, Logical, Bitwise, Assignment, Identity, and Membership operators.
  • Arithmetic Operators: Used for mathematical calculations.
    • + (Addition)
    • - (Subtraction)
    • * (Multiplication)
    • / (Division)
    • % (Modulus/Remainder)
    • ** (Exponentiation)

iii) What is Object-Oriented Programming System (OOPS)? List any four features. OOPS is a programming paradigm based on the concept of “objects,” which can contain data (attributes) and code (methods). Features:

  1. Class & Object: The blueprint and the instance.
  2. Encapsulation: Hiding data within a class.
  3. Inheritance: Creating new classes from existing ones.
  4. Polymorphism: Using a single function for different types of objects.

iv) What is a widget? Name any four GUI widgets. A widget is an element of a Graphical User Interface (GUI) that displays information or accepts user input. Examples (Tkinter):

  1. Label: Displays text or images.
  2. Button: A clickable button to trigger actions.
  3. Entry: A single-line text input field.
  4. Text: A multi-line text input field.

vi) Explain the salient features of Python.

  • Simple & Easy to Learn: Python has a clean syntax similar to English.
  • Interpreted Language: Code is executed line by line.
  • Dynamically Typed: You don’t need to declare variable types explicitly.
  • Standard Library: Huge library support for everything from web scraping to machine learning.

Q3. Answer any FIVE of the following:

ii) Explain command line arguments and variable-length arguments in Python.

  • Command Line Arguments: Values passed to the script at runtime. Accessed using sys.argv list.
  • Variable-Length Arguments: Used when the number of arguments is unknown.
    • *args: Passes a variable number of non-keyword arguments (as a tuple).
    • **kwargs: Passes a variable number of keyword arguments (as a dictionary).

iii) Explain decision-making statements and looping statements in Python with examples.

  • Decision Making (if...else):Pythonx = 10 if x > 5: print("Greater") else: print("Smaller")
  • Looping (for, while):Python# For loop for i in range(3): print(i)

iv) Explain how to define and call a function in Python. A function is defined using the def keyword.

  • Definition:Pythondef greet(name): return "Hello, " + name
  • Call:Pythonprint(greet("Ali")) # Output: Hello, Ali

v) Write a Python program to demonstrate the concept of classes and objects.

Python

class Student:
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def display(self):
        print("Name:", self.name, "Age:", self.age)

# Creating an Object
s1 = Student("Rahul", 20)
s1.display()

vi) Which keyword is used to define a function in Python, and what is a built-in function? List any three.

  • Keyword: def is used to define a function.
  • Built-in Function: These are pre-defined functions available in Python that do not require importing any module.
  • Examples:
    1. print(): Displays output.
    2. len(): Returns the length of an object.
    3. type(): Returns the data type of an object.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.