Big Halloween Sale Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: simple70

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

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

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: {}


Expert Solution
Questions # 22:

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

string = 'python' [::2]

string = string[-1] + string[-2]

Options:

A.

string[0] == string[-1]


B.

string is None


C.

len (string] == 3


D.

string[0] == 'o'


Expert Solution
Questions # 23:

What is the expected behavior of the following code?

Question # 23

Options:

A.

it outputs 3


B.

it outputs 1


C.

it outputs 6


D.

it raises an exception


Expert Solution
Questions # 24:

If you need to serve two different exceptions called Ex1 and Ex2 in one except branch, you can write:

Options:

A.

except Ex1 Ex2:


B.

except (ex1, Ex2):


C.

except Ex1, Ex2:


D.

except Ex1+Ex2:


Expert Solution
Questions # 25:

What can you do if you don't like a long package path tike this one0 import alpha.beta.gamma.delta.epsiIon.zeta

Options:

A.

you can make an alias for the name using the a 1 i a s 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 die as keyword


Expert Solution
Questions # 26:

Assuming that the following code has been executed successfully, select the expressions which evaluate to true.

(Select two answers.)

Question # 26

Options:

A.

a == b


B.

b {1} == 4


C.

a is not None


D.

a (2) == 4


Expert Solution
Questions # 27:

What is the expected output of the following code?

Question # 27

Options:

A.

2


B.

3


C.

4


D.

an exception is raised


Expert Solution
Questions # 28:

A file name like this one below says mat: (select three answers)

services. cpython-36.pyc

Options:

A.

the interpreter used to generate the file is version 3.6


B.

it has been produced by CPython


C.

it is the 36th version of the file


D.

the file comes from the services . py source file


Expert Solution
Questions # 29:

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

Options:

A.

a code point is a point inside the code when execution stops immediately


B.

an escape sequence can be recognized by the # sign put in front of it.


C.

UTF-8 is one of the ways of representing UNICODE code points.


D.

ASCII is the name of a character coding standard


Expert Solution
Questions # 30:

A Python module named pymod, py contains a function named pyfun ( ).

Which of the following snippets will let you invoke the function? (Select two answers)

Options:

A.

From pymod import ‘

Pymod.pyfun ( )


B.

Import pymod

Pymod. Pyfun ( )


C.

Import pyfun from pymod

Pyfun ( )


D.

From pymod import pyfun

Pyfun ( )


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