Black Friday Special 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: save70

Free and Premium Python Institute PCAP-31-03 Dumps Questions Answers

Page: 1 / 6
Total 145 questions

Certified Associate in Python Programming Questions and Answers

Question 1

What is the expected output of the following snippet?

Options:

A.

abc

B.

The code will cause a runtime exception

C.

ABC

D.

123

Buy Now
Question 2

A Python module named pymod.py contains a variable named pyvar.

Which of the following snippets will let you access the variable? (Select two answers)

Options:

A.

import pyvar from pymod pyvar = 1

B.

from pymod import pyvar = 1

C.

from pymod import pyvar pyvar ()

D.

import pymod pymod.pyvar = 1

Question 3

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)

Options:

A.

put self.store(1])

B.

self put stire(1])

C.

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

D.

self .put (self.store[1])

Question 4

What can you deduce from the following statement? (Select two answers)

str = open('file.txt', "rt")

Options:

A.

str is a string read in from the file named file.txt

B.

a newlina character translation will be performed during the reads

C.

if file. txt does not exist, it will be created

D.

the opened file cannot be written with the use of the str variable

Question 5

What is the expected behavior of the following code?

Options:

A.

it outputs 1

B.

it outputs 2

C.

the code is erroneous and it will not execute

D.

it outputs 3

Question 6

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

Question 7

What is the expected output of the following code?

Options:

A.

21

B.

2

C.

3

D.

12

Question 8

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

Options:

A.

len('\'•) == 1

B.

len("""

""") == o

C.

chr(ordCA') + 1) == 'B'

D.

ord("Z") - ord("z") -- ord("0")

Question 9

How many lines does the following snippet output?

Options:

A.

three

B.

one

C.

two

D.

four

Question 10

What is the expected output of the following code?

def foo(x,y,z):

return x(y) - x(z)

print{f00(lambda x: x % 2, 2, 1) )

Options:

A.

1

B.

0

C.

-1

D.

an exception is raised

Question 11

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

Options:

A.

is instance(obj_b,C)

B.

C._C__VarA == 2

C.

has atr (B, 'get')

D.

obj_c.get() == 2

Question 12

Which one of the platform module functions should be used to determine the underlying platform name?

Options:

A.

platform.uname ()

B.

platform.platform ()

C.

platform.python_version()

D.

platform.processor()

Question 13

Which of the following lambda function definitions are correct? (Select two answers)

Options:

A.

lambda X : None

B.

lambda : 3,1415

C.

lambda x : def fun(x): return x

D.

lambda lambda: lambda * lambda

Question 14

What is the expected output of the following code?

Options:

A.

4

B.

16

C.

an exception is raised

D.

1

Question 15

There is a stream named s open for writing. What option will you select to write a line to the stream''

Options:

A.

s.write("Hello\n")

B.

write(s, "Hello")

C.

s.writeln("Hello")

D.

s.writeline("Hello")

Question 16

What is the expected behavior of the following code?

Options:

A.

it outputs False

B.

it outputs True

C.

it raises an exception

D.

it outputs nothing

Question 17

Which of the listed actions can be applied to the following tuple? (Select two answers)

Options:

A.

tup [:]

B.

tup.append (0)

C.

tup [0]

D.

del tup

Question 18

What is true about Python class constructors? (Select two answers)

Options:

A.

the constructor's first parameter identifies an object currently being created

B.

the constructor cannot use the default values of the parameters

C.

the constructor can be invoked directly under strictly defined circumstances

D.

super-class constructor is invoked implicitly during constructor execution

Question 19

What is the expected behavior of the following code?

Options:

A.

it outputs 6

B.

it outputs 1

C.

it outputs 3

D.

it raises an exception

Question 20

What is the expected behavior of the following code?

Options:

A.

it outputs 2

B.

it raises an exception

C.

it outputs 3

D.

it outputs 5

Question 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

Question 22

What is the expected behavior of the following code?

Options:

A.

it outputs 2

B.

the code is erroneous and it will not execute

C.

it outputs 3

D.

it outputs :

Page: 1 / 6
Total 145 questions