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

Hot Vendors

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

Questions 4

What is true about Object-Oriented Programming in Python? (Select two answers)

Options:

A.

if a real-life object can be described with a set of adjectives, they may reflect a Python object method

B.

the same class can be used many times to build a number of objects

C.

each object of the same class can have a different set of methods

D.

a subclass is usually more specialized than its superclass

Buy Now
Questions 5

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

Buy Now
Questions 6

Files with the suffix .pyc contain:

Options:

A.

Python 4 source code

B.

backups

C.

temporary data

D.

semi-compiled Python code

Buy Now
Questions 7

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

Buy Now
Questions 8

What would you use instead of XXX if you want to check whether a certain ‘ key' exists in a dictionary called diet? (Select two answers)

II

if XXX:

print("Key exists")

Options:

A.

'key' in diet

B.

diet['key'] != None

C.

diet.exists('key')

D.

'key' in diet.keys()

Buy Now
Questions 9

What is the output of the following piece of code?

PCAP-31-03 Question 9

Options:

A.

ant'bat'camel

B.

ant"bat"camel

C.

antbatcamel

D.

ant bat camel

Buy Now
Questions 10

Which of the following expressions evaluate to True? (Select two answers)

Options:

A.

11 == '011'

B.

3 * 'a' < 'a' * 2

C.

'abc' .upper () < 'abc'

D.

'1' + '2' * 2 !=2 '12'

Buy Now
Questions 11

Assuming that the math module has been successfully imported, which of the following expressions evaluate to True? (Select two answers)

Options:

A.

math. hypot (3,4) == math.sqrt (25)

B.

math. hypot (2,5) == math.truec (2.5)

C.

math. hypot (2,5) == math.true (2.5)

D.

math. cell (2,5) == math.floor (2.5)

Buy Now
Questions 12

Assuming that the V variable holds an integer value to 2, which of the following operators should be used instead of OPER to make the expression equal to 1?

V OPER 1 -

Options:

A.

<<<

B.

>>>

C.

>>

D.

<<

Buy Now
Questions 13

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

Options:

A.

closing an open file is performed by the closefile ( ) function

B.

the second open ( ) argument describes the open mode and defaults to ‘w’

C.

if open ( ) ‘s second argument is ‘r’ the file must exist or open will fail

D.

if open ( )’s second argument is ‘w’ and the invocation succeeds, the previous file’s content is lost

Buy Now
Questions 14

A two-parameter lambda function raising its first parameter to the power of the second parameter should be declared as:

Options:

A.

lambda (x, y) = x ** y

B.

lambda (x, y): x ** y

C.

def lambda (x, y): return x ** y

D.

lambda x, y: x ** y

Buy Now
Questions 15

What is the expected behavior of the following code?

PCAP-31-03 Question 15

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 16

What is the expected behavior of the following code?

PCAP-31-03 Question 16

Options:

A.

it outputs 1

B.

it outputs 2

C.

the code is erroneous and it will not execute

D.

it outputs 3

Buy Now
Questions 17

What is the expected behavior of the following code?

PCAP-31-03 Question 17

Options:

A.

it outputs False

B.

it outputs True

C.

it raises an exception

D.

it outputs nothing

Buy Now
Questions 18

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

PCAP-31-03 Question 18

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

Buy Now
Questions 19

What is the expected output of the following code?

PCAP-31-03 Question 19

Options:

A.

a

B.

an exception is raised

C.

b

D.

c

Buy Now
Questions 20

What is the expected behavior of the following snippet?

PCAP-31-03 Question 20

It will:

Options:

A.

cause a runtime exception on line 02

B.

cause a runtime exception on line 01

C.

cause a runtime exception on line 03

D.

print3

Buy Now
Questions 21

A method for passing the arguments used by the following snippet is called:

PCAP-31-03 Question 21

Options:

A.

sequential

B.

named

C.

positional

D.

keyword

Buy Now
Questions 22

What is the expected output of the following code if existing_file is the name of a file located inside the working directory?

PCAP-31-03 Question 22

Options:

A.

1 2

B.

1 2 3

C.

1 3

D.

2 3

Buy Now
Questions 23

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

Buy Now
Questions 24

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

PCAP-31-03 Question 24

Options:

A.

isinstance (obj_b,A)

B.

A.VarA == 1

C.

obj_a is obj_aa

D.

B.VarA == 1

Buy Now
Questions 25

Which of the following words can be used as a variable name? (Select two valid names)

Options:

A.

for

B.

True

C.

true

D.

For

Buy Now
Questions 26

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 27

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

import random

v1 = random. random()

v2 = random. random()

Options:

A.

len(random.sample([1,2,3],2)) > 2

B.

v1 == v2

C.

random.choice([1,2,3]) >=1

D.

v1 >= 1

Buy Now
Questions 28

What is the expected output of the following snippet?

PCAP-31-03 Question 28

Options:

A.

3

B.

1

C.

2

D.

the code is erroneous

Buy Now
Questions 29

Which of the following lines of code will work flawlessly when put independently inside the add_new () method in order to make the snippet's output equal to [0, 1, 1] ? (Select two answers)

PCAP-31-03 Question 29

Options:

A.

put self.store(1])

B.

self put stire(1])

C.

self .put self.get () [-1])

D.

self .put (self.store[1])

Buy Now
Questions 30

What is the expected behavior of the following code?

PCAP-31-03 Question 30

Options:

A.

It outputs False

B.

It outputs nothing

C.

It outputs True

D.

It raises an exception

Buy Now
Questions 31

Python strings can be “glued” together using the operator:

Options:

A.

.

B.

&

C.

_

D.

+

Buy Now
Questions 32

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

Buy Now
Questions 33

What is the expected behavior of the following code?

PCAP-31-03 Question 33

It will:

Options:

A.

print 4321

B.

print

C.

cause a runtime exception

D.

print 1234

Buy Now
Questions 34

A variable stored separately in every object is called:

Options:

A.

there are no such variables, all variables are shared among objects

B.

a class variable

C.

an object variable

D.

an instance variable

Buy Now
Questions 35

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'

Buy Now
Questions 36

Which of the following expressions evaluate to True? (Select two answers)

Options:

A.

len ('' ' '') == 2

B.

len ( ' ' ' 12

34 ' ' ') == 4

C.

chr (ord('z') - 1 == 'Y'

D.

ord (''0'') - ord (''9'') == 10

Buy Now
Questions 37

An operator able to perform bitwise shifts is coded as (select two answers)

Options:

A.

- -

B.

++

C.

<<

D.

>>

Buy Now
Questions 38

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

Options:

A.

Python strings are actually lists

B.

Python strings can be concatenated

C.

Python strings can be sliced like lists

D.

Python strings are mutable

Buy Now
Questions 39

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

PCAP-31-03 Question 39

Options:

A.

import pypack.module_a

B.

import module_a from pypack

C.

import module_a

D.

from pypack import module_a

Buy Now
Questions 40

What is true about Python packages? (Select two answers)

Options:

A.

the__name__variable content determines the way in which the module was run

B.

a package can be stored as a tree of sub-directories/sub-folders

C.

__pycache__is the name of a built-in variable

D.

hashbang is the name of a built-in Python function

Buy Now
Questions 41

What is the expected behavior of the following code?

PCAP-31-03 Question 41

Options:

A.

it outputs -2

B.

it outputs 2. 0

C.

it outputs 0. 0

D.

the code is erroneous and it will not execute

Buy Now
Questions 42

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 43

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 44

Which of the following expressions evaluate to True? (Select two answers)

Options:

A.

121 +1 == int ('1' + 2 * '2')

B.

float ('3.14') == str('3.'+'14')

C.

'xyz'.lower() 'XY'

D.

'8' + '8' !=2 * '8'

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

PDF + Testing Engine

$56  $159.99

Testing Engine

$42  $119.99
buy now PCAP-31-03 testing engine

PDF (Q&A)

$35  $99.99
buy now PCAP-31-03 pdf
dumpsmate guaranteed to pass
24/7 Customer Support

DumpsMate's team of experts is always available to respond your queries on exam preparation. Get professional answers on any topic of the certification syllabus. Our experts will thoroughly satisfy you.

Site Secure

mcafee secure

TESTED 21 Nov 2024