0% found this document useful (0 votes)
7 views6 pages

QN Bank3 Function Basics

The document contains a series of questions related to basic programming concepts, specifically focusing on functions in Python. It includes code snippets and asks for the expected output or identification of errors in the code. Each question tests the reader's understanding of function definitions, variable scope, and syntax in Python.

Uploaded by

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

QN Bank3 Function Basics

The document contains a series of questions related to basic programming concepts, specifically focusing on functions in Python. It includes code snippets and asks for the expected output or identification of errors in the code. Each question tests the reader's understanding of function definitions, variable scope, and syntax in Python.

Uploaded by

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

CHAPTER - 3

WORKING WITH FUNCTIONS

Functions - BASICS
QUESTION 1

What will be the output of the following code:


def cube(x):
return x*x*x
x=cube(2)
print(x)

i. 2 ii. 4 iii. 8 iv. 20


QUESTION 2

a) Consider the code below and answer the


questions that follow:
def multiply(number1, number2):
answer=number1* number2
return answer
print(number1, 'times', number2, '", answer)
output=multiply(5, 5)

i) When the code above is executed, what gets printed?


(ii) What is variable output equal to after the code is executed?
QUESTION 3

What will be the output of the following code:


A=1
def f():
A=10
print(A)

i. 1 ii. 10 iii. Error iv. None


QUESTION 4
The output of the code shown below is:
def f1( ):
x=15
print(x)
x=12
f1( )
print(x)

a) Error b) 12 c) 15 d) 15
12
QUESTION 5
Find the errors in the following code:

define check( )
N = input (“Enter N:”)
i=3
answer = 1 + i ** 4 / N
Return answer

You might also like