Python

A vibrant illustration of a computer screen displaying Python code with educational elements such as books, a calculator, and fun graphics representing logic and problem-solving.

Python Code Challenge

Test your Python programming skills with our engaging quiz designed for all levels. Dive into practical coding scenarios and improve your understanding of Python functions, data structures, and lambda expressions.

  • 10 stimulating questions
  • Multiple choice format
  • Instant feedback on your answers
10 Questions2 MinutesCreated by CodingWizard42

The output of the code shown below is:

odd=lambda x: bool(x%2)
numbers=[n for n in range(10)]
print(numbers)
n=list()
for I in numbers:
    if odd(i):
        continue
    else:
        break
A) [0, 2, 4, 6, 8, 10]
B) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
C) [1, 3, 5, 7, 9]
D) Error

What is the output of the code shown below?

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

A) False True
B) False False
C) True True
D) True False

 What is the output of the code shown below?

import functools
l=[1,2,3,4]
print(functools.reduce(lambda x,y:x*y,l))
A) Error
B) 10
C) 24
D) No output

What is the output of the code shown?

l=[1, -2, -3, 4, 5]
def f1(x):
    return x<2
m1=filter(f1, l)
print(list(m1))
A) [1, 4, 5]
B) Error
C) [-2, -3]
D) [1, -2, -3]

What is the output of the code shown below?

l=[-2, 4]
m=map(lambda x:x*2, l)
print(m)
A) [-4, 16]
B) Address of m
C) Error
D) -4 16

What is the output of the following code?

l=[1, -2, -3, 4, 5]
def f1(x):
    return x<-1
m1=map(f1, l)
print(list(m1))
A) [False, False, False, False, False]
B) [False, True, True, False, False]
C) [True, False, False, True, True]
D) [True, True, True, True, True]

What is the output of the code shown?

l=[1, 2, 3, 4, 5]
m=map(lambda x:2**x, l)
print(list(m))
A) [1, 4, 9, 16, 25 ]
B) [2, 4, 8, 16, 32 ]
C) [1, 0, 1, 0, 1]
D) Error

 What is the output of the code shown?

import functools
l=[1, 2, 3, 4, 5]
m=functools.reduce(lambda x, y:x if x>y else y, l)
print(m)
A) Error
B) Address of m
C) 1
D) 5

What is the output of the code shown below?

l=[n for n in range(5)]
f=lambda x:bool(x%2)
print(f(3), f(1))
for I in range(len(l)):
    if f(l[i]):
        del l[i]
        print(i)
A) True True 1 2 Error
B) False False 1 2
C) True False 1 2 Error
D) False True 1 2

What is the output of the code shown?

m=reduce(lambda x: x-3 in range(4, 10))
print(list(m))
A) [1, 2, 3, 4, 5, 6, 7]
B) No output
C) [1, 2, 3, 4, 5, 6]
D) Error
{"name":"Python", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Test your Python programming skills with our engaging quiz designed for all levels. Dive into practical coding scenarios and improve your understanding of Python functions, data structures, and lambda expressions.10 stimulating questionsMultiple choice formatInstant feedback on your answers","img":"https:/images/course8.png"}
Powered by: Quiz Maker