Massive Summer Special Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: suredis

Python Institute PCAP-31-03 Certified Associate in Python Programming Exam Practice Test

Page: 1 / 15
Total 147 questions

Certified Associate in Python Programming Questions and Answers

Testing Engine

  • Product Type: Testing Engine
$54.25  $154.99

PDF Study Guide

  • Product Type: PDF Study Guide
$45.5  $129.99
Question 1

You need data which can act as a simple telephone directory. You can obtain it with the following clauses (choose two relevant variants; assume that no other items have been created before)

Options:

A.

dir={'Mom':5551234567, 'Dad':5557654321>

B.

dir={'Mom':'5551234567', * Dad':'5557654321'}

C.

dir={Mom:5551234567, Dad:5557654321}

D.

dir={Mom:'5551234567', Dad:'5557654321'}

Question 2

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

Options:

A.

lists may not be stored inside tuples

B.

tuples may be stored inside lists

C.

tuples may not be stored inside tuples

D.

lists may be stored inside lists

Question 3

Which of the following literals reflect the value given as 34.23? (select two answers)

Options:

A.

.3423e2

B.

3423e-2

C.

.3423e-2

D.

3423e2

Question 4

What is the expected behavior of the following code?

Options:

A.

it outputs 'None'

B.

it outputs 3

C.

it raises an exception

D.

it outputs 0

Question 5

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

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

Question 6

What is the expected behavior of the following code?

It will:

Options:

A.

print 0

B.

cause a runtime exception

C.

prints 3

D.

print an empty line

Question 7

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

Question 8

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

Options:

A.

open () is a function which returns an int that represents a physical file handle

B.

the second open () argument is optional

C.

instd, outstd, errstd are the names of pre-opened streams

D.

if invoking open () fails, the value None is returned

Question 9

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

Options:

A.

'var' in Object.__dict__

B.

'prop' in Class.__dict

C.

len(Object.__diet__) == 1

D.

'var1 in Class, dict

Question 10

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

Question 11

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

Question 12

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

Options:

A.

a is b

B.

b( ) > 2

C.

a() > 2

D.

a is not None

Question 13

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

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

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

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

Question 16

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

Options:

A.

121 + 1 != '!' + 2 * '2'

B.

'AbC' lower () < 'AB'

C.

'1' + '1' + '1' < '1' * 3'

D.

'3.14' != str(3.1415)

Question 17

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.

<<

Question 18

Which line can be used instead of the comment to cause the snippet to produce the following expected output? (Select two answers)

Expected output:

1 2 3

Code:

Options:

A.

c, b, a = b, a, c

B.

c, b, a = a, c, b

C.

a, b, c = c, a, b

D.

a, b, c = a, b, c

Question 19

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

Question 20

What is the expected behavior of the following code?

x - 3 % 1

y -1 if x > else 0

print (y)

Options:

A.

it outputs -1

B.

the code is erroneous and it will not execute

C.

it outputs 1

D.

it outputs 0

Question 21

A compiler is a program designed to (select two answers)

Options:

A.

rearrange the source code to make it clearer

B.

check the source code in order to see if its correct

C.

execute the source code

D.

translate the source code into machine code

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 1

D.

it outputs 3

Page: 1 / 15
Total 147 questions