CS 083 RT 4 MAT CS Final
CS 083 RT 4 MAT CS Final
REVISION TEST IV
COMPUTER SCIENCE (083)
PRACTICALS
SUBJECT CODE: CS083 SCHOOL CODE: 55474
SECTION A
1)Which keyword is used for function?
a) funb) definec) defd) function
2) Which operator is used in Python to import modules from packages?
a) . b) * c) -> d)&
3) Which is a type of function?
a)custom b)build in c)main d)system
4)Which argument is also called as positional arguments?
a) keyword b) default c) required d) variable length
5)_____ is used after name of functions.
a) [] b){} c) () d) <>
6)Which of the following function headers is correct?
a)def fun(a = 2, b = 3, c) b) def fun(a = 2, b, c = 3)
c)def fun(a, b = 2, c = 3)d) def fun(a, b, c = 3, d)
7) Which one of the following is the correct way of calling a function?
a)function_name()b) call function_name()
c) ret function_name()d) function function_name()
8) The end from which elements are added or deleted is called _________ of a stack.
a) endb)top c) bottom d) none
9) Trying to pop an element from an empty stack results into a special condition
called________ .
a) overflow b) underflow c) fullflow d) full stack
10) Which of the following statement is a function call?
a) call sum() b)def sum() c)sum() d) function sum()
11) Pushing an element into stack already having five elements and stack size of 5, then
stack becomes ___________
a) overflowb)crashc) underflowd) user flow
12) Which of the following is an example of non primitive data structure?
a) array b) function c) stackd) all the above
13) What is n1?
defcal(n1)
a) parameter b) argument c) keyword d) none of these
14) Which of the following functions helps us to randomize the items of a list?
a) seedb) randomisec) shuffled) uniform
15) The randrange function returns only an integer value.
a) Trueb) False
16)What will be the output of the following Python code?
random.randrange(1,100,10)
a) 32 b) 67 c) 91 d) 80
Explanation: The output of this function can be any value which is a multiple of 10, plus 1. Hence a value like 11,
21, 31, 41…91 can be the output. Also, the value should necessarily be between 1 and 100. The only option which
satisfies this criteria is 91.
SECTION B
SECTION C
x is 50
Changed local x to 2
x is now 50
27) Write the algorithm for traversing stack elements.
28) Write the output of the following Python code?
a) S=”WELCOME”
def change(T):
T=”HELLO”
Print(T,end=’@’)
Change(S)
Print(S)
HELLO@WELCOME
b) S=”GOOD MORNING”
Print(S.capitalize(),S.title(),end=”!”)
Good morning!Good Morning!
c) L=[‘a’,’b’,’c’,’d’] print (“ ”.join(L))
abcd
29) Mention the basic operation of stack
30) Explain about abs(), eval(), str() functions.
SECTION D
Answer the following questions (3 X 5=15)
31) Explain briefly about random module.
32) Explain briefly about stack.
33)33) Fill the statements
total=_____ #line1
def sum(arg1,arg2)___ #line2
total=arg1+____ #line3
Print (total) #line4
return_____ #line5
total=sum(10,20) #line6
print(____) #line7
a)Which value or constant will be equal to variable total in line1?0
b)Which symbol is used to terminate the function def in line2? :
c)Fill the answers in line 3.arg2
d)Which value will be return in line5?total
e)Fill the answers for line 7.total
SECTION E
Answer the following questions (2 X 4=8)
34) Write the output for the following code.
a)List1=[5,8,3,9,6,1]
Mention the List1 after List1.pop(2)
[5,8,9,6,1]
b)def fun1(name, age=20):
print(name, age)
fun1('Emma', 25)
Emma 25
c)def add(a, b):
return a+5, b+5
result = add(3, 2)
print(result)
(8, 7)
d) What will be the output of the following Python code?
defsayHello():
print('Hello World!')
sayHello()
sayHello()
Hello World!