Pre-Summer Special Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: validbest

Pass the Python Institute PCAP PCAP-31-03 Questions and answers with ValidTests

Exam PCAP-31-03 All Questions
Exam PCAP-31-03 Premium Access

View all detail and faqs for the PCAP-31-03 exam

Viewing page 3 out of 5 pages
Viewing questions 21-30 out of questions
Questions # 21:

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

Expert Solution
Questions # 22:

What can you do if you don’t like a long package path like this one?

Question # 22

Options:

A.

you can make an alias for the name using the alias keyword

B.

nothing, you need to come to terms with it

C.

you can shorten it to alpha. zeta and Python will find the proper connection

D.

you can make an alias for the name using the as keyword

Expert Solution
Questions # 23:

What is the expected behavior of the following code?

Question # 23

Options:

A.

it outputs 1

B.

it outputs 0

C.

it raises an exception

D.

it outputs 2

Expert Solution
Questions # 24:

Assuming that the following inheritance set is in force, which of the following classes are declared properly? (Select two answers)

Question # 24

Options:

A.

class Class_4 (D, A) : pass

B.

class Class_1(C,D): pass

C.

class Class_3(A,C): pass

D.

class Class_2(B,D): pass

Expert Solution
Questions # 25:

What is the expected behavior of the following code?

Question # 25

Options:

A.

it outputs list assignment index out of range

B.

the code is erroneous and it will not execute

C.

it outputs

D.

it outputs error

Expert Solution
Questions # 26:

Assuming that the code below has been executed successfully, which of the following expressions evaluate to True? (Select two answers)

Question # 26

Options:

A.

'var' in Object.__dict__

B.

'prop' in Class.__dict

C.

len(Object.__diet__) == 1

D.

'var1 in Class, dict

Expert Solution
Questions # 27:

Can a module run like regular code?

Options:

A.

yes, and it can differentiate its behavior between the regular launch and import

B.

it depends on the Python version

C.

yes, but it cannot differentiate its behavior between the regular launch and import

D.

no. it is not possible; a module can be imported, not run

Expert Solution
Questions # 28:

Is it possible to safely check if a class object has a certain attribute0

Options:

A.

yes, by using the hasattr attribute

B.

yes. by using the hasattr () method

C.

yes, by using the hasattr () function

D.

no, it is not possible

Expert Solution
Questions # 29:

Assuming that the following piece of code has been executed successfully, which of the expressions evaluate to True? (Select two answers)

Question # 29

Options:

A.

obj_b.prop_a == 3

B.

hasattr(obj_b, 'prop_aa')

C.

isinstance(obj_c,A)

D.

B. VarA == 3

Expert Solution
Questions # 30:

What is true about Python class constructors? (Choose two.)

Options:

A.

there can be more than one constructor in a Python class

B.

the constructor must return a value other than None

C.

the constructor is a method named __init__

D.

the constructor must have at least one parameter

Expert Solution
Viewing page 3 out of 5 pages
Viewing questions 21-30 out of questions