Python Institute PCAP-31-02 Certified Associate in Python Programming Exam Practice Test

Page: 1 / 14
Total 40 questions

Question 1

What is the expected behavior of the following code''

def f(n):

for i in range{1, n+1): yield i

print(f(2))

It will;



Answer : B

Question 2

What is the expected behavior of the following snippet9

def x() : # line 01

return 2 f line 02

x = 1 + x() # line 03

print(x) f# line 04

It will:



Answer : D

Question 3

What is the expected output of the following code?

def f(n): *

if n = =1:

return '1' return str(n) + f(n-1)

print(f(2))



Answer : C

Question 4

What is the expected output of the following code?

str = 'abcdef de f fun(s): del s[2]

return s

print(fun(str) )



Answer : B

Question 5

Which of the following statements are true? (Select two answers)



Answer : A, D

Question 6

Assuming that the following snippet has been successfully executed, which of the equations are False? (Select two answers)

a = [0] b = a&=]

MO] = 1



Answer : B

Page:    1 / 14   
Total 40 questions