[go: up one dir, main page]

0% found this document useful (0 votes)
61 views7 pages

12 CS PT 0302 Ans

1. The document provides instructions and questions for a periodic test in Computer Science for grade 12. It is divided into 3 sections - A, B and C containing multiple choice questions. 2. Section A contains 20 questions carrying 0.5 marks each. Section B contains 20 questions carrying 1 mark each. Section C contains 5 case study based questions. 3. The questions test knowledge of Python functions including definition, parameters, return values, scope, built-in functions etc. Questions relate to topics like defining and calling functions, global and local variables, default arguments, return statements etc.
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)
61 views7 pages

12 CS PT 0302 Ans

1. The document provides instructions and questions for a periodic test in Computer Science for grade 12. It is divided into 3 sections - A, B and C containing multiple choice questions. 2. Section A contains 20 questions carrying 0.5 marks each. Section B contains 20 questions carrying 1 mark each. Section C contains 5 case study based questions. 3. The questions test knowledge of Python functions including definition, parameters, return values, scope, built-in functions etc. Questions relate to topics like defining and calling functions, global and local variables, default arguments, return statements etc.
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
You are on page 1/ 7

VEDIC VIDYASHRAM SENIOR SECONDARY SCHOOL

TIRUNELVELI-627 358
(Academic Year : 21-22)
Grade : XII COMPUTER SCIENCE (083) CODE : PT-0302
Time : 1.30 hrs Max : 35

General Instructions:
1. The question paper is divided into 3 Sections - A, B and C.
2. Section A, consist of 20 Questions. Attempt all questions.
3. Section B, consist of 20 Questions. Attempt all questions.
4. Section C, consist of 5 case study based Questions. Attempt all questions.

PERIODIC TEST-3
SECTION-A
Each carry 0.5 Marks ( 20 * 0.5 = 10)
Name the statement that sends back a value from a function.
(a) print
01 (b) input
(c) return
(d) None
Which of the following arguments works with implicit values that are used if no value is provided?
(a) keyword
02 (b) required
(c) variable-length
(d) default
Which of the following items are present in the function header?
(a) function name only
03 (b) both function name and parameter list
(c) parameter list only
(d) return value
What is the name given to that area of memory, where the system stores the parameters and
local variables of a function call?
(a) a heap
04
(b) storage area
(c) a stack
(d) an array
Carefully observe the code and give the answer.
def function1(a):
a= a + '1'
a=a*2
05 >>> function1("hello")
(a) indentation Error
(b) cannot perform mathematical operation on strings
(c) hello2
(d) hello2hello2
What is a variable defined outside all the functions referred to as?
06
(a) A static variable

1
(b) A global variable
(c) A local variable
(d) An automatic variable
What is a variable defined inside a function referred to as
(a) A static variable
07 (b) A global variable
(c) A local variable
(d) An automatic variable
_______function will return the largest integer less than the given floating point number.
08 a) floor() b) ceil() c) sqrt() d) CEIL()

_______function returns the absolute value.


a) fabsolute( )
09 b) abs( )
c) absolute( )
d) None of these
______function returns the length of the object being passed.
10 a) Length() b) Len() c) lenth() d) count()

A function in python begins with which keyword?


11
a) void b) return c) int d) def

What is output of print(math.pow(3, 2))?


12
a) 9 b) 9.0 c) None d) None of these

What will be the output of the following code:


A=1
def f ():
13
A=10
print(A)
a) 1 b) 10 c) Error d) None
What is the value returned by
14 >>> math.floor(-3.4)
a) 3 b)-4 c) 4.0 d)3.0

What is the value returned by


15 >>> math.floor(3.4)
a) 3 b) 4 c) 4.0 d) 3.0

Name the statement that sends back a value from a function


16
a) print b) input c) return d) None

What is displayed on executing print(math.fabs(-3.4))?


17
a) -3.4 b) 3.4 c) 3 d) -3

2
What is the value of x if x = math.sqrt(4)?
18
a) 2 b) 2.0 c) (2, -2) d) (2.0, -2.0)

What is the output of the function shown below (random module has already been imported)?
>>>random.choice('sun')
19 a) sun b) u c) either s, u or n d) Error

__________function returns the smallest integer greater than the given floating point number.
20
a) floor() b) ceil() c) sqrt() d) abs()
SECTION-B ( 20 * 1 = 20)
Which of the following function headers is not correct?
a) def f(a = 1, b):
21 b) def f(a = 1, b=3, c = 2):
c) def f(a = 1, b = 1, c = 2):
d) def f(a , b = 1, c = 2, d=6):
What is the output of the below program?
def sayHello():
print('Hello World!')
sayHello()
22 sayHello()
a) Hello World! and Hello World!
b) ‘Hello World!’ and ‘Hello World!’
c) Hello and Hello
d) None of the mentioned
What is the output of the below program?
def printMax(a, b):
if a > b:
print(a, 'is maximum')
elif a == b:
23
print(a, 'is equal to', b)
else:
print(b, 'is maximum')
printMax(3, 4)
a) 3 b) 4 c) 4 is maximum d) None of the mentioned
What is called when a function is defined inside a class?
24 a) Module b) Class
c) Another function d) Method
What is the output of below program?
def f(x, y, z):
25 return x + y + z
f(2, 30, 400)
a) 432 b) 24000 c) 430 d) No output
What is a variable defined outside a function referred to as?
26 a)A static variable b)A global variable
c)A local variable d)An automatic variable

3
What is the output of the following piece of code?
def a(b):
b = b + [5]
27 c = [1, 2, 3, 4]
a(c)
print(len(c))
a)4 b)5 c)1 d)An exception is thrown
What is the output of the following code?
def change(i = 1, j = 2):
i=i+j
j=j+1
28
print(i, j)
change(j = 1, i = 2)
a)An exception is thrown because of conflicting values
b)1 2 c)3 3 d)3 2
What is the output of the below program?
def C2F(c):
return c * 9/5 + 32
29 print C2F(100)
print C2F(0)
a) 212.0 and 32.0 b) 314.0 and 24.0
c) 567 and 98 d) 212 and 32
Which of the following is a features of DocString?
a) Provide a convenient way of associating documentation with Python modules, functions,
classes, and methods
30
b) All functions should have a docstring
c) Docstrings can be accessed by the __doc__ attribute on objects
d) All of the mentioned
What is the output of the functions shown below?
ord(65)
31 ord(‘A’)
a) A and 65 b) Error and 65
c) A and Error c) Error and Error
What are the outcomes of the function shown below?
>>>x=3
32
>>>eval('x^2')
a) Error b) 1 c) 9 d) 6
The function pow(x,y,z) is evaluated as:
33 a) (x**y)**z b) (x**y) / z
c) (x**y) % z d) (x**y)*z
What is the output of the following function?
34 any([2>8, 4>2, 1>2])
a) Error b) True c) False d) 4>2
______ function can identify the whitespace in a given string.
35
a) Space( ) b) isspace( ) c) Isspace( ) d) is_space( )
36 What is the output of the function shown below?

4
import math

abs(math.sqrt(25))
a) Error b) -5 c) 5 d) 5.0
What is the output of the program given below:
import random
x = random.random()
37
y= random.randint(0,4)
print(int(x),”:”, y+int(x))
a) 0: 0 b) 2 : 4 c)1: 6 d) 0 : 5
What is the output of the following code?
def display(b, n):
while n > 0:
print(b,end="")
38
n=n-1
display('z',3)
a)zzz b)zz
c)An exception is executed d)Infinite loop
def cal(a,b,c):
return a*3,b*3,c*3
val=cal(10,12,14)
print(type(val))
print(val)
39
a) [30, 24, 28] c) [30,36,42]
d) <class tuple'> and (30,36,42)
b) [10, 20, 30]

What are the outcomes of the function shown below?

40 >>>x=3
>>>eval('x**2')
a) Error b) 1 c) 9 d) 6
SECTION-C
A variable declared outside all the functions in a python program, then mention the statements
which are True in the context of the variable.
1. This variable will have global scope.
41 2. This variable will not be accessible from anywhere in the prog.
3. This variable will have a large lifetime than local variable.
4. This variable will be referred as Local variable.
a) Only 1&2 b) Only 1 c) Only 1&3 d) Only 3
What is the output of below program?
def say(message, times = 1):
42 print(message * times , end =’ ‘)
say(‘Hello and’)
say('World', 5)
5
a) Hello and WorldWorldWorldWorldWorld
b) Hello and World 5
c) Hello and World,World,World,World,World
d) Hello and HelloHelloHelloHelloHello
What is the output of the below program?
x = 50
def func():
global x
print('x is', x)
x=2
print('Changed global x to', x)
func()
print('Value of x is', x)
43 a) x is 50
Changed global x to 2
Value of x is 50
b) x is 50
Changed global x to 2
Value of x is 2
c) x is 50
Changed global x to 50
Value of x is 50
d) None of the mentioned
What is the output of the below program?
def func(a, b=5, c=10):
print('a is', a, 'and b is', b, 'and c is', c)
func(3, 7)
func(25, c = 24)
func(c = 50, a = 100)
a) a is 7 and b is 3 and c is 10
a is 25 and b is 5 and c is 24
44
a is 5 and b is 100 and c is 50
b) a is 3 and b is 7 and c is 10
a is 5 and b is 25 and c is 24
a is 50 and b is 100 and c is 5
c) a is 3 and b is 7 and c is 10
a is 25 and b is 5 and c is 24
a is 100 and b is 5 and c is 50
d) None of the mentioned
What is the output of this program?
L = [lambda x: x ** 2,
lambda x: x ** 3,
lambda x: x ** 4]
45
for f in L:
print(f(3))
a) 27 and 81 and 343 b) 6 and 12
c) 9 and 27 and 81 d) None of the mentioned
*********
6
7

You might also like