DON'T WANT TO MISS A THING?

Certification Exam Passing Tips

Latest exam news and discount info

Curated and up-to-date by our experts

Yes, send me the newsletter

Latest Python PCEP Exam Questions and Answers, 2025 Update | SPOTO

SPOTO's latest exam dumps on the homepage, with a 100% pass rate! SPOTO delivers authentic Cisco CCNA, CCNP study materials, CCIE Lab solutions, PMP, CISA, CISM, AWS, and Palo Alto exam dumps. Our comprehensive study materials are meticulously aligned with the latest exam objectives. With a proven track record, we have enabled thousands of candidates worldwide to pass their IT certifications on their first attempt. Over the past 20+ years, SPOTO has successfully placed numerous IT professionals in Fortune 500 companies.
Take other online exams

Question #1
What is the expected output of the following code? x = ''' print(len(x))
A. 1correct
B. 2
C. The code is erroneous
D. 0
View answer
Correct Answer: A
Question #2
Which of the following lines correctly invoke the function defined below: def fun(a, b, c=0): # Body of the function. (Select two answers)
A. fun(0, 1, 2)correct
B. fun(b=0, a=0)correct
C. fun(b=1)
D. fun()
View answer
Correct Answer: AB
Question #3
A.?Script
B. Code laws
C. Command-line
D. Command list
View answer
Correct Answer: A
Question #4
Python is an example of:
A. a machine language
B. a high-level programming languagecorrect
C. a natural language
View answer
Correct Answer: B
Question #5
What is the output of the following snippet?
A. 12
B. (2, 1)
C. (1, 2)
D. 21
View answer
Correct Answer: D
Question #6
What is the expected output of the following code? x = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]] def func(data): res = data[0][0] for da in data: for d in da: if res < d: res = d return res print(func(x[0]))
A. The code is erroneous
B. 8
C. 6
D. 2
E. 4correct
View answer
Correct Answer: E
Question #7
What is the output of the following snippet? dct = {} dct['1'] = (1, 2) dct['2'] = (2, 1) for x in dct.keys(): print(dct[x][1], end='')
A. 21correct
B. (2,1)
C. (1,2)
D. 12
View answer
Correct Answer: A
Question #8
What is the expected output of the following code? print(list('hello'))
A. hello
B. [h, e, l, l, o]
C. ['h', 'e', 'l', 'l', 'o']
D. ['h' 'e' 'l' 'l' 'o']
E. None of the above
View answer
Correct Answer: C
Question #9
Strings in Python are delimited with:
A. backslashes (i
B. double quotes (i
C. asterisks (i
D. dollar symbol (i
View answer
Correct Answer: B
Question #10
A set of rules which defines the ways in which words can be coupled in sentences is called:
A. Alexis
B. Bsyntax
C. Csemantics
D. Ddictionary
View answer
Correct Answer: B
Question #11
If a list passed into function’s argument and modified inside the function:
A. Will affect the argument
B. Will not affect the argument
C. Will give an error
D. Will become global by default
View answer
Correct Answer: A
Question #12
What is the expected output of the following code? def func(p1, p2): p1 = 1 p2[0] = 42 x = 3 y = [1, 2, 3] func(x, y) print(x, y[0])
A. 3 1
B. The code is erroneous
C. 1 42
D. 3 42correct
E. 1 1
View answer
Correct Answer: D
Question #13
Take a look at the snippet, and choose the true statements: (Choose two.)
A. nums is longer than vals
B. nums and vals are of the same length
C. vals is longer than nums
D. nums and vals refer to the same list
View answer
Correct Answer: BD
Question #14
What is the expected output of the following code? def func(data): for d in data[::2]: yield d for x in func('abcdef'): print(x, end='')
A. bdf
B. An empty line
C. abcdef
D. acecorrect
View answer
Correct Answer: D
Question #15
Which of the following expressions evaluate to a non-zero result? (Select two answers.)
A. 2**3/A-2correct
B. 4/2**3-2correct
C. 1**3/4-1
D. 1*4//2**3
View answer
Correct Answer: AB
Question #16
What is the output of the following snippet? dct = {} dct['1'] = (1, 2) dct['2'] = (2, 1) for x in dct.keys(): print(dct[x][1], end='')
A. 21correct
B. (2,1)
C. (1,2)
D. 12
View answer
Correct Answer: A
Question #17
A set of rules which defines the ways in which words can be coupled in sentences is called:
A. lexis
B. syntax
C. semantics
D. dictionary
View answer
Correct Answer: B
Question #18
Octal has the following base:
A. 2
B. 8
C. 10
D. 16
View answer
Correct Answer: B
Question #19
What is the expected output of the following code? def func(x): return 1 if x % 2 != 0 else 2 print(func(func(1)))
A. The code is erroneous
B. None
C. 2
D. 1correct
View answer
Correct Answer: D
Question #20
What is the expected output of the following code? def func(num): res = '*' for _ in range(num): res += res return res for x in func(2): print(x, end='')
A. **
B. The code is erroneous
C. *
D. ****correct
View answer
Correct Answer: D
Question #21
What would you insert instead of so that the program checks for even numbers? if ???: print('x is an even number')
A. x % x == 0
B. x % 1 == 2
C. x % 2 == 0correct
D. x % 'even' == True
E. x % 2 == 1
View answer
Correct Answer: C
Question #22
What do you call a tool that lets you lanch your code step-by-step and inspect it at each moment of execution?
A. A debuggercorrect
B. An editor
C. A console
View answer
Correct Answer: A
Question #23
Which of the following for loops would output the below number pattern? 11111 22222 33333 44444 55555
A. for i in range(0, 5):print(str(i) * 5)
B. for i in range(1, 6):print(str(i) * 5)correct
C. for i in range(1, 6):print(i, i, i, i, i)
D. for i in range(1, 5):print(str(i) * 5)
View answer
Correct Answer: B
Question #24
What is the expected output of the following code? x = [0, 1, 2] x.insert(0, 1) del x[1] print(sum(x))
A. 3
B. 2
C. 4correct
D. 5
View answer
Correct Answer: C
Question #25
What is the expected output of the following code? x = [0, 1, 2] x.insert(0, 1) del x[1] print(sum(x))
A. 3
B. 2
C. 4correct
D. 5
View answer
Correct Answer: C
Question #26
What is the expected output of the following code? def func(p1, p2): p1 = 1 p2[0] = 42 x = 3 y = [1, 2, 3] func(x, y) print(x, y[0])
A. 3 1
B. The code is erroneous
C. 1 42
D. 3 42correct
E. 1 1
View answer
Correct Answer: D
Question #27
What is the expected output of the following code? def func(text, num): while num > 0: print(text) num = num - 1 func('Hello', 3)
A. An infinite loop
B. HelloHelloHello
C. HelloHelloHelloHello
D. HelloHello
View answer
Correct Answer: A
Question #28
Consider the following code snippet: w = bool(23) x = bool('') y = bool(' ') z = bool([False]) Which of the variables will contain False?
A. z
B. xcorrect
C. y
D. w
View answer
Correct Answer: B
Question #29
What will be the output of the following code snippet?
A. 3
B. 2
C. 4
D. 1
View answer
Correct Answer: C
Question #30
What is the expected output of the following code? print(list('hello'))
A. None of the above
B. hello
C. [h, e, l, l, o]
D. ['h', 'e', 'l', 'l', 'o']correct
E. ['h' 'e' 'l' 'l' 'o']
View answer
Correct Answer: D

View The Updated Python Exam Questions

SPOTO Provides 100% Real Python Exam Questions for You to Pass Your Python Exam!

View Answers after Submission

Please submit your email and WhatsApp to get the answers of questions.

Note: Please make sure your email ID and Whatsapp are valid so that you can get the correct exam results.

Email:
Whatsapp/phone number: