Read and download free pdf of CBSE Class 12 Computer Science Functions Worksheet Set A. Download printable Computer Science Class 12 Worksheets in pdf format, CBSE Class 12 Computer Science Functions Worksheet has been prepared as per the latest syllabus and exam pattern issued by CBSE, NCERT and KVS. Also download free pdf Computer Science Class 12 Assignments and practice them daily to get better marks in tests and exams for Class 12. Free chapter wise worksheets with answers have been designed by Class 12 teachers as per latest examination pattern
Functions Computer Science Worksheet for Class 12
Class 12 Computer Science students should refer to the following printable worksheet in Pdf in Class 12. This test paper with questions and solutions for Class 12 Computer Science will be very useful for tests and exams and help you to score better marks
Class 12 Computer Science Functions Worksheet Pdf
1. A function can be defined as the organised block of reusable code, which can be called whenever required. It is basically named unit of a group of proper statements.
2. Types of Python Function There are three types of functions in Python, which are given below
(i) Built-in Function Built-in functions are known as library functions. These are pre-defined functions in Python programming system that are always available for use.
e.g. type(), input(), print() etc.
(ii) User Defined Functions Python provides facility for programmers to define their own functions according to their requirements. Those functions defined by programmers are known as user defined functions.
e.g. Function for finding factorial, function for checking whether a number is prime or not, etc.
(iii) Function Defined in Modules In Python, there are some functions that are pre-defined in specific modules. e.g. sin(), cos() are contained in math module, mean(), mode() are in statistics module etc.
3. Defining a Function Function contain ‘def ’ keyword to provide the required functionality. The def keyword is followed by the function name and parentheses ().
Any input parameters or arguments should be placed within these parentheses.
There is a colon (:) at the end of def line.
4. Calling a Function Function definition part only define the name of function and specify the parameters.
Function can be called multiple times with different expressions as the actual parameters.
5. Parameters and Arguments A parameter is a variable used to define a particular value during a function definition.
An argument is a value passed to the function during the function call which is received for corresponding parameter defined in function header.
6. Passing Parameters
• Default Parameter Values It instructs the compiler what value to pass for a parameter if the programmer deliberately misses the matching argument of that parameter in the function call statement.
• Keyword (Named) Arguments Using keyword argument, you can declare value using name.
Python provides a way of writing function calls where you can write any argument in any order, but value should be in right form.
• Positional Arguments Positional arguments are arguments that need to be included in the proper position or order.
The first position argument always needs to be listed first when the function is called. The second positional argument needs to be listed second and the third positional argument listed third etc.
7. Returning Values from Functions
• Functions Returning Some Value (Non-void Functions) This function is used to create a specific task. After completion that task it returns some result in term of value. Non-void functions are also known as fruitful functions. Non-void function can return value in various form. Syntax return < value>
• Functions not Returning Any Value (Void Functions) When a function does not return a value, we can say it is a void function. Void functions are also known as non-fruitful functions. Methods in Python do not return any value.
8. Scope of Variables A variable defined inside a function cannot be accessed outside it.
Scope of variables in Python program, shows the area where you can use it. The variables are treated differently in different functions.
There are two kinds of scope of variable in Python, which are described below:
(i) Local Variable (Local Scope) A variable that is defined inside any function or a block is known as a local variable.
Any other function of the program cannot use them without receiving as the argument.
(ii) Global Variable (Global Scope) A variable declared outside of all functions in a program has global scope and is known as global variable.
Global variable is usable for all functions of Python program without declaration in their body or without receiving as the arguments.
9. Namespace A namespace is basically a system to make sure that all the names in a program are unique and can be used without any conflict. Python implements namespaces as dictionaries. In Python, the LEGB (Local, Enclosed, Global, Built-in) rule is used to decide the order in which the namespaces are to be searched for scope resolution.
Direction (Q. Nos. 1-15) Each of the question has four options out of which only one is correct.
Select the correct option as your answer.
1. Which is/are the advantage(s) of functions in Python?
(a) Reducing duplication of code
(b) Decomposing complex problems into simpler pieces
(c) Improving clarity of the code
(d) All of the mentioned
Answer : D
2. None will return by function when
(a) return statement is not used inside a function
(b) return statement is used inside a function
(c) Both (a) and (b)
(d) None of the above
Answer : A
3. Zero or more keyword arguments can be passed to a function in a
(a) double function call
(b) any function call
(c) single function call
(d) None of these
Answer : C
4. Which of the following function headers is correct?
(a) def myFunc(x = 2, y = 3, z):
(b) def myFunc(x = 2, y, z = 3):
(c) def myFunc(x, y = 2, z = 3):
(d) def myFunc(x, y, z = 3, p):
Answer : C
5. 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()
Answer : A
6. Required arguments are the arguments passed to a function in
(a) any positional order
(b) correct positional order
(c) odd positional order
(d) even positional order
Answer : B
7. Suppose there is a list such that: list1=[1,2,3]. If we want to print this list in reverse order, which of the following methods should be used?
(a) reverse(list1)
(b) list(reverse[(list1)])
(c) reversed(list1)
(d) list(reversed(list1))
Answer : D
8. What is the output of following code?
def test():
a=96
print(a)
a =+ 2
test()
(a) 96
(b) 98
(c) 94
(d) Error
Answer : A
9. What will be the output of following code?
def test(i):
i = [3]
num = [9]
test(num)
print(num)
(a) [3]
(b) [9]
(c) [9, 3]
(d) [3, 9]
Answer : B
10. What is the output of following code?
val=5
def test():
global val
val=val+1
test()
val
(a) 6
(b) 5
(c) 4
(d) Error
Answer : A
11. Identify the output of following code.
def Func(hello, num):
while(num > 0):
print(hello)
num − =1
Func(‘A’,4)
(a) AAA
(b) AAAA
(c) Error
(d) Infinite loop
Answer : D
12. What is the output of following code?
def func(x):
x = x + [15]
res = [11, 12, 13, 14]
func(res)
print(len(res))
(a) 5
(b) 4
(c) 3
(d) Error
Answer : B
13. What is the output of following code?
def myFun(a, b):
def myFun1(c, d):
return c + d
return myFun1(a, b)
return a
result = myFun(12, 13)
print(result)
(a) 13
(b) 25
(c) (12, 25)
(d) Error
Answer : B
14. What is the output of following code?
def test(x = 2, y = 1):
x = x*y + 1
y = y* 2 − x
print(x, y)
test(y = 5, x = 3)
(a) 16 6
(b) 16 − 6
(c) − 16 6
(d) 15 8
Answer : B
15. What is the output of following code?
def find():
l=“HELLO”
j=“ ”
l1=[]
count=1
for i in l:
if i in [‘a’, ‘e’, ‘i’, ‘o’, ‘u’]:
j=j+i.swapcase()
else:
if(count%2 !=0):
j=j+str(len(l[:count]))
else:
j=j+i
count=count+1
print(j)
find()
(a) H2LL5
(b) H2L45
(c) 1E3L5
(d) Error
Answer : C
Please click on below link to download CBSE Class 12 Computer Science Functions Worksheet Set A
Functions CBSE Class 12 Computer Science Worksheet
The above practice worksheet for Functions has been designed as per the current syllabus for Class 12 Computer Science released by CBSE. Students studying in Class 12 can easily download in Pdf format and practice the questions and answers given in the above practice worksheet for Class 12 Computer Science on a daily basis. All the latest practice worksheets with solutions have been developed for Computer Science by referring to the most important and regularly asked topics that the students should learn and practice to get better scores in their examinations. Studiestoday is the best portal for Printable Worksheets for Class 12 Computer Science students to get all the latest study material free of cost. Teachers of studiestoday have referred to the NCERT book for Class 12 Computer Science to develop the Computer Science Class 12 worksheet. After solving the questions given in the practice sheet which have been developed as per the latest course books also refer to the NCERT solutions for Class 12 Computer Science designed by our teachers. After solving these you should also refer to Class 12 Computer Science MCQ Test for the same chapter. We have also provided a lot of other Worksheets for Class 12 Computer Science which you can use to further make yourself better in Computer Science.
You can download the CBSE Practice worksheets for Class 12 Computer Science Functions for the latest session from StudiesToday.com
Yes, the Practice worksheets issued for Functions Class 12 Computer Science have been made available here for the latest academic session
There is no charge for the Practice worksheets for Class 12 CBSE Computer Science Functions you can download everything free
Regular revision of practice worksheets given on studiestoday for Class 12 subject Computer Science Functions can help you to score better marks in exams
Yes, studiestoday.com provides all the latest Class 12 Computer Science Functions test practice sheets with answers based on the latest books for the current academic session