QuizCluster
Class 12Subject Code: 083Year: 202535 Questions Available

CBSE Class 12 Computer Science 2025 — QuizCluster Solutions

Comprehensive question-by-question independently authored solutions for CBSE Class 12 Computer Science Board Examination (2025). Questions are referenced directly to the official CBSE Question Paper.

Official Source & AttributionSource of question paper: Central Board of Secondary Education (CBSE)

Solutions and conceptual explanations are independently prepared by QuizCluster. QuizCluster is an independent educational platform and is not affiliated with, endorsed by, or sponsored by the Central Board of Secondary Education (CBSE). Official question papers are accessed via direct external links to official CBSE repositories and are never hosted or mirrored on QuizCluster.

Question Index

Q1 of 35
Reinforce with Topic Quizzes

Practice chapter-wise adaptive MCQs to strengthen weak concepts from this board paper.

View all years for this subject
Q1

Python Revision Tour & Functions: Python Scope, Mutability and List Comprehensions

Section A1 MarksChapter: Python Revision Tour & Functions
Easy
Question 1 — Problem Statement (Synopsis)
Open in Official Paper
Predict the output of the following Python code snippet and explain the behavior of mutable objects passed into functions: def process_data(val, records=[]): records.append(val * 2) return records print(process_data(5)) print(process_data(10)) print(process_data(15, [100])) print(process_data(20))
See Question 1 in official CBSE Class Computer Science Question Paper (2025)
QuizCluster Step-by-Step Solution

Step 1: Default argument evaluation in Python

In Python, default arguments like `records=[]` are evaluated ONCE when the function definition is executed, creating a single persistent mutable list object shared across calls that don't pass an explicit argument.

Step 2: Stepwise trace of function calls

1. `process_data(5)`: Appends 10 to default list → returns `[10]`. 2. `process_data(10)`: Uses same default list and appends 20 → returns `[10, 20]`. 3. `process_data(15, [100])`: Uses explicit list `[100]`, appends 30 → returns `[100, 30]`. 4. `process_data(20)`: Reverts to shared default list, appends 40 → returns `[10, 20, 40]`.

Final Answer
Output: [10] [10, 20] [100, 30] [10, 20, 40]
Important Core Concept

Mutable default parameters persist across multiple function invocations in Python; use `None` as default sentinel to avoid shared state.

Common Student Pitfall

Assuming `records` is reset to empty list `[]` on each call.

Master Python Revision Tour & Functions
Practice curated MCQ drills on QuizCluster
Practice Python Revision Tour & Functions Quizzes
Question 1 of 35

Source of question paper: Central Board of Secondary Education (CBSE). QuizCluster provides independently prepared educational solutions and explanations. QuizCluster is an independent educational platform and is not affiliated with or endorsed by CBSE. Question papers are accessed through links to official CBSE resources and are not hosted by QuizCluster.