CBSE Class 12 Computer Science — Functions
All previous year questions from Chapter: Functions
2 questions found
2026(2 questions)
- 9
What will be the output of the following code ? ```python def f1(a,b=1): print(a+b,end='-') c=f1(1,2) print(c,sep='*') ```
1 mark· A· Functions - Default Arguments & Return Value - 34
(a) Write the output of the following code : ```python def Exam2026(given) : new=[] for ch in given[1:-1]: if ch.isupper(): new.reverse() elif ch not in new: new.append(ch) elif ch in new: new.pop() print(new) Exam2026("Gold-24Medals") ``` OR (b) Write the output of the following code : ```python def Exam2026(given): new = 0 while given: if new % 2: new += given % 10 else: new += given % 5 print(new, end='-') given //= 10 Exam2026(123456) ```
3 marks· C· Tracing Function Output — String Slicing, List append/pop/reverse, Modulo Arithmetic