Pcap 31 02 PDF
Pcap 31 02 PDF
Pcap 31 02 PDF
Question 1
Can a module run Eke regular code?
Options:
A. yes, and it can differentiate its behavior between the regular launch and import
C. yes, but it cannot differentiate its behavior between the regular launch and import
Answer: D
Explanation:
you write a module (a .py file) where it can be executed directly. Alternatively, it can also be
imported and used in another module. By doing the main check, you can have that code only execute
when you want to run the module as a program and not have it execute when someone just wants to
import your module and call your functions themselves.
Question 2
How many elements will the list2 list contain after execution of the following snippet?
list1 = [False for i in range (1, 10) ]
list2 = list1 [-1:1:-1]
Options:
A. zero
B. five
C. seven
D. three
https://www.certification-questions.com
Python Institute PCAP-31-02
Answer: C
Explanation:
929]
Explanation:
Question 3
Which of the following statements are true? (Select two answers)
Options:
Answer: B, C
Question 4
What will be the value of the i variable when the while e loop finishes its execution?
Options:
A. 1
B. 0
C. 2
https://www.certification-questions.com
Python Institute PCAP-31-02
Answer: A
Explanation:
9327]
Explanation:
Question 5
An operator able to perform bitwise shifts is coded as (select two answers)
Options:
A. - -
B. ++
C. <<
D. >>
Answer: C, D
Question 6
The following class hierarchy is given. What is the expected output of the code?
https://www.certification-questions.com
Python Institute PCAP-31-02
Options:
A. BB
B. CC
C. AA
D. BC
Answer: B, C
Question 7
What can you deduce from the following statement0 (Select two answers) str = open('file.txt',
"rt")
Options:
https://www.certification-questions.com
Python Institute PCAP-31-02
D. the opened file cannot be written with the use of the str variable
Answer: A, D
Question 8
The first parameter of each method:
Options:
Answer: D
Question 9
What is the expected output of the following snippet?
Options:
https://www.certification-questions.com
Python Institute PCAP-31-02
A. 3
B. 1
C. 2
Answer: A
Explanation:
39667]
Explanation:
Question 10
The simplest possible class definition in Python can be expressed as:
Options:
A. class X:
B. class X:
pass
C. class X:
return
D. class X: {}
Answer: A
https://www.certification-questions.com