Labour Day Sale Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: buysanta

Exact2Pass Menu

Question # 4

What is the expected output of the following code?

A.

abcef

B.

The program will cause a runtime exception error

C.

acdef

D.

abdef

Full Access
Question # 5

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

A.

except Ex1 Ex2:

B.

except (ex1, Ex2):

C.

except Ex1, Ex2:

D.

except Ex1+Ex2:

Full Access
Question # 6

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

A.

is instance(obj_b,C)

B.

C._C__VarA == 2

C.

has atr (B, 'get')

D.

obj_c.get() == 2

Full Access
Question # 7

What is the expected output of the following code?

A.

3

B.

5

C.

4

D.

an exception is raised

Full Access
Question # 8

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

string = 'SKY' (:: -1)

string = string (-1)

A.

string is None

B.

string (0) == string (-1

C.

string (0) == 'Y'

D.

len (string) == 1

Full Access
Question # 9

What is the expected behavior of the following code?

It will:

A.

print 4321

B.

print

C.

cause a runtime exception

D.

print 1234

Full Access
Question # 10

What is the expected behavior of the following snippet?

It will:

A.

cause a runtime exception

B.

print 1

C.

print 0 , [1]

D.

print [1J

Full Access
Question # 11

What will the value of the i variable be when the following loop finishes its execution?

A.

10

B.

the variable becomes unavailable

C.

11

D.

9

Full Access
Question # 12

What is the expected output of the following code?

A.

21

B.

2

C.

3

D.

12

Full Access
Question # 13

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

A.

the sys.path variable is a list of strings

B.

_pycache_is a folder that stores semi-completed Python modules

C.

a package contents can be stored and distributed as an mp3 file

D.

a code designed to initialize a package's state should be placed inside a file named init.py

Full Access
Question # 14

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

A.

open () requires a second argument

B.

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

C.

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

D.

if invoking open () fails, an exception is raised

Full Access
Question # 15

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:

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

Full Access
Question # 16

What is the expected behavior of the following code?

A.

it outputs False

B.

it outputs True

C.

it raises an exception

D.

it outputs nothing

Full Access
Question # 17

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, 21 ? (Select two answers)

A.

self.queue.append(get_Iast() + 1)

B.

queue.append(self.get last () + 1)

C.

self.queue.append(self.queue[+1]

D.

self.queue.append(self.get last() +1)

Full Access
Question # 18

Which of the following invocations are valid? (Select two answers)

A.

sorted ("python'')

B.

"python" .sort ( )

C.

sort" ("python")

D.

"python' ,find (" ")

Full Access
Question # 19

If you want to transform a string into a list of words, what invocation would you use? (Select two answers)

Expected output:

A.

s.split ()

B.

split (s, "˜ "˜)

C.

s.split ("˜ "˜)

D.

split (s)

Full Access
Question # 20

What is the expected behavior of the following code?

A.

it outputs 2

B.

the code is erroneous and it will not execute

C.

it outputs 1

D.

it outputs 3

Full Access
Question # 21

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]

A.

string[0] == string[-1]

B.

string is None

C.

len (string] == 3

D.

string[0] == 'o'

Full Access
Question # 22

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]

A.

zero

B.

five

C.

seven

D.

three

Full Access