0% found this document useful (0 votes)
77 views3 pages

Xii CS (Chapter123)

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views3 pages

Xii CS (Chapter123)

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

BORN TO WIN ACADEMY

Class: XII TEST 1 Marks: 35


Subject: Computer Science (083) Time : 1 ½ Hr

General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A has 6 questions carrying 01 mark each.
4. Section B has 3 Very Short Answer type questions carrying 02 marks each.
5. Section C has 3 Short Answer type questions carrying 03 marks each.
6. Section D has 1 Long Answer type question carrying 04 marks.
7. Section E has 2 question carrying 05 marks each.

QNo SECTION A Marks


Answer the following questions

1. a) State True or False: 1


While defining a function in Python, the positional parameters in the function header
must always be written after the default parameters.
b) Predict and write the correct output of the following code :
event=”G20 Presidency@2024”
L=event.split(‘ ‘)
print(L[::-2])
2. a) Write the correct code to complete the function body in the given code snippet. 1
def f(number):
#missing function body
print(f(5))
b) What is the default return value for a function that does not return any value
explicitly?
3. What will be the output of the following expressions?
a) (5>10)and(10<5)or(3<18)and not8<18 1
b) print(16*5/4*2/5-8)
4. a) Write the valid declaration of L: 1
L=[‘Mon’,’23’,’hello’,’60.5’]
b) What will be the output?
>>>str = “hello”
>>>str[:2]
Q5 and 6 are ASSERTION and REASONING based Questions. Mark the correct
choice as
a) Both A and R are true and R is the correct explanation of A.
b) Both A and R are true and R is not the correct explanation of A.
c) A is true but R is false.
d) A is false but R is true.
e) Both A and B are false.
5. Assertion (A): A parameter having a default in function header becomes optional in
function call. 1
Reason(R): A function call may or may not have values for default arguments.
6. Assertion (A): Dictionaries are mutable but their keys are immutable.
Reason(R): The values of a dictionary can change but keys of dictionary cannot be 1
changed because through them data is hashed.
SECTION B
7. a) What will be the output of the following python code? 2
i) def func(): ii) def func():
return total + 1 total+=1
total = 0 return total
print(func()) total=0
print(func())
b) Differentiate between parameters and arguments.
8. Write a function LMOVE(L,n) in python, which accepts a list L of numbers and n is a
numeric value by which all elements of the list are shifted to left. 2
9. Write the most appropriate list method to perform the following tasks.
a) Delete a given element from the list. 2
b) Delete 3rd element from the list.
c) Add an element in the end of the list.
d) Add an element in the beginning of the list.

SECTION C
10. a) What will be the output of the following python code?
def func(b): 3
global x
print(‘Global x=’, x)
y=x+b
x=7
z=x–b
print(‘Local x = ‘,x)
print(‘y = ‘,y)
print(‘z = ‘,z)
x=5
func(10)
b) Find the error in the given code:
def in(x,y):
x=x + y
print(x.y)
x*=y
print(x**y)
11. Write a program to print a square multiplication table as shown below:
1 2 3 4 5 6 7 8 9
2 4 6 8 10 12 14 16 18
3 6 9 12 15 18 21 24 27
4 8 12 16 20 24 28 32 36
5 10 15 20 25 30 35 40 45
3
6 12 18 24 30 36 42 48 54
7 14 21 28 35 42 49 56 63
8 16 24 32 40 48 56 64 72
9 18 27 36 45 54 63 72 81

12. What are the arguments supported by python? Explain each of them with a suitable
example. 3
SECTION D
13. a)Write the term suitable for following descriptions: 4
i) A name inside the parentheses of a function header that can receive a value.
ii) A variable created inside a function body.
iii) A value assigned to a parameter name in the function call.
iv) A value assigned to a parameter name in the function header.

b) Predict the output of the following code fragment:


fruit={}
f1=[‘Apple’,’Banana’,’apple’,’Banana’]
for index in f1:
if index in fruit:
fruit[index]+=1
else:
fruit[index]-=1
print(fruit)
print(len(fruit))
SECTION E

14. a) What will be the output of the following code:


def func(x,y=100):
temp = x + y
x += temp
if(y!=200):
print(temp,x,x)
a=20
b=10
5
func(b)
print(a,b)
func(a,b)
print(a,b)
b) Write a function, WordsLen(S), that takes a string as an argument and returns a
tuple containing length of each word of a string. For example, if the string is “A
function is executed in an execution frame”, the tuple will have (1,8,2,8,2,2,9,5).
15. Write a program to have following functions:
a) A function that takes a number as argument and calculates cube for it. The
function does not return a value. If there is no value passed to the function call,
the function should calculate cube of 2.
b) A function that takes two char arguments and returns True if both the
arguments are equal otherwise False. 5

******************************************************

You might also like