Winter Special Sale Limited Time 60% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: 713PS592

PCAP-31-03 Certified Associate in Python Programming Questions and Answers

Questions 4

Assuming that the code below has been placed inside a file named code.py and executed successfully, which of the following expressions evaluate to True? (Select two answers)

PCAP-31-03 Question 4

Options:

A.

str(Object) == 'Object'

B.

_name == _main_'

C.

ClassA. _module_ == 'ClassA'

D.

len(ClassB.__bases__) == 1

Buy Now
Questions 5

What is the expected behavior of the following code?

PCAP-31-03 Question 5

Options:

A.

It outputs False

B.

It outputs nothing

C.

It outputs True

D.

It raises an exception

Buy Now
Questions 6

Python's built-in function named open () tries to open a file and returns:

Options:

A.

an integer value identifying an opened file

B.

an error code (0 means success)

C.

a stream object

D.

always None

Buy Now
Questions 7

Assuming that String is six or more letters long, the following slice

String[1:-2]

is shorter than the original string by:

Options:

A.

four chars

B.

three chars

C.

one char

D.

two chars

Buy Now
Questions 8

What is the output of the following piece of code?

PCAP-31-03 Question 8

Options:

A.

ant'bat'camel

B.

ant"bat"camel

C.

antbatcamel

D.

ant bat camel

Buy Now
Questions 9

Options:

Buy Now
Questions 10

The first parameter of each method:

Options:

A.

holds a reference to the currently processed object

B.

is always set to None

C.

is set to a unique random value

D.

is set by the first argument's value

Buy Now
Questions 11

What is the expected output of the following code if the file named existing_text_file is a non-zero length text file located inside the working directory?

PCAP-31-03 Question 11

Options:

A.

the length of the first line from the file

B.

-1

C.

the number of lines contained inside the file

D.

the length of the last line from the file

Buy Now
Questions 12

The following class definition is given. We want the show () method to invoke the get () method, and then output the value the get () method returns. Which of the invocations should be used instead of XXX?

PCAP-31-03 Question 12

Options:

A.

print (get(self))

B.

print (self.get())

C.

print (get())

D.

print (self.get (val))

Buy Now
Questions 13

What is the expected output of the following snippet?

PCAP-31-03 Question 13

Options:

A.

abc

B.

The code will cause a runtime exception

C.

ABC

D.

123

Buy Now
Questions 14

Is it possible to safely check if a class/object has a certain attribute?

Options:

A.

yes, by using the hasattr attribute

B.

yes, by using the hasattr ( ) method

C.

yes, by using the hassattr ( ) function

D.

no, it is not possible

Buy Now
Questions 15

What is the expected behavior of the following code?

PCAP-31-03 Question 15

It will:

Options:

A.

print 4321

B.

print

C.

cause a runtime exception

D.

print 1234

Buy Now
Questions 16

With regards to the directory structure below, select the proper forms of the directives in order to import module_c. (Select two answers)

PCAP-31-03 Question 16

Options:

A.

from pypack.upper.lower import module_c

B.

import pypack.upper.lower.module_c

C.

import upper.module_c

D.

import upper.lower.module_c

Buy Now
Questions 17

What is the expected behavior of the following code?

PCAP-31-03 Question 17

Options:

A.

the code is erroneus and it will not execute

B.

it outputs [2, 4]

C.

it outputs [4, 2]

D.

it outputs [0, 1, 2, 3, 4]

Buy Now
Questions 18

What is the expected output of the following code?

PCAP-31-03 Question 18

Options:

A.

a

B.

an exception is raised

C.

b

D.

c

Buy Now
Questions 19

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

PCAP-31-03 Question 19

Options:

A.

is instance(obj_b,C)

B.

C._C__VarA == 2

C.

has atr (B, 'get')

D.

obj_c.get() == 2

Buy Now
Questions 20

What is the expected behavior of the following code?

x = 8 ** (1/3)

y = 2. if x < 2.3 else 3.

print(y)

Options:

A.

it outputs 2.0

B.

it outputs 2. 5

C.

the code is erroneus and it will not execute

D.

it outputs 3.0

Buy Now
Questions 21

Which of the equations are True? (Select two answers)

Options:

A.

chr (ord (x)) = = x

B.

ord (ord (x)) = = x

C.

chr (chr (x)) = = x

D.

ord (chr (x)) = = x

Buy Now
Exam Code: PCAP-31-03
Exam Name: Certified Associate in Python Programming
Last Update: Nov 30, 2024
Questions: 147

PDF + Testing Engine

$66  $164.99

Testing Engine

$50  $124.99
buy now PCAP-31-03 testing engine

PDF (Q&A)

$42  $104.99
buy now PCAP-31-03 pdf