My Report

Python Programming Practice Test 7


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 will be the output of the following Python code?

x = [12, 34]
print(len(''.join(list(map(str, x)))))

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

from math import factorial
print(math.factorial(5))

3. Program code making use of a given module is called a ______ of the module.

4. The nested list undergoes shallow copy even when the list as a whole undergoes deep copy.

5. In top-down design every module is broken into same number of submodules.

6. What is math.factorial(4.0)?

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

def to_upper(k):
    return k.upper()
x = ['ab', 'cd']
print(list(map(to_upper, x)))

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

f=lambda x:bool(x%2)
print(f(20), f(21))

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

x = [12, 34]
print(len(list(map(len, x))))

10. The single line equivalent of the following Python code?

l=[1, 2, 3, 4, 5]
def f1(x):
    return x<0
m1=filter(f1, l)
print(list(m1))

 

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.