My Report

Python Programming Practice Test 6


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement

1. What is called when a function is defined inside a class?

2. What will be the output of the following Python function?

sum(2,4,6)
sum([1,2,3])

3. Lambda contains block of statements.

4. What is the type of sys.argv?

5. The function pow(x,y,z) is evaluated as:

6. Which of the following functions will not result in an error when no arguments are passed to it?

7. What will be the output of the following Python code?

def f1(x):
    global x
    x+=1
    print(x)
f1(15)
print("hello")

8. What is a variable defined inside a function referred to as?

9. What will be the output of the following Python code?

def san(x):
    print(x+1)
x=-2
x=4
san(12)

10. What will be the output of the following Python code?

def f1():
    x=15
    print(x)
x=12
f1()

 

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.