Certified Associate in Python Programming v1.0

Page:    1 / 5   
Exam contains 67 questions

What is the expected behavior of the following code?

  • A. it outputs 6
  • B. it raises an exception
  • C. it outputs 1
  • D. it outputs 3


Answer : D

What is the expected output of the following code?
myli = range (-2,2)
m = list(filter(lambda x: True if abs(x) < 1 else False, myli)) print(len(m))

  • A. 4
  • B. 1
  • C. an exception is raised
  • D. 16


Answer : B

What is true about lambda functions? (Choose two.)

  • A. they are called anonymous functions
  • B. they cannot return the None value as a result
  • C. they must contain the return keyword
  • D. they must have a non-zero number of parameters


Answer : AD

What is the expected behavior of the following code?
x =3 % 1
y = 1 if x > 0 else 0
print(y)

  • A. the code is erroneus and it will not execute
  • B. it outputs 1
  • C. it outputs 0
  • D. it outputs -1


Answer : B

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

  • A. 2
  • B. -1
  • C. an errno value corresponding to file not found
  • D. 0


Answer : D

What is the expected output of the following code?

  • A. an exception is raised
  • B. 1
  • C. 0
  • D. -1


Answer : C

What is the expected behavior of the following code?
my_list = [i for i in range(5)]
m = [my_list[i] for i in range(4, 0, -1) if my_list[i] % 2 != 0] print(m)

  • A. the code is erroneus and it will not execute
  • B. it outputs [4, 2, 0]
  • C. it outputs [3, 1]
  • D. it outputs [1, 3]


Answer : B

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

  • A. a is not None
  • B. a() == 4
  • C. a != b
  • D. b() == 4


Answer : AD

Which of the following statements are true? (Choose two.)

  • A. if invoking open() fails, an exception is raised
  • B. instd, outstd, errstd are the names of pre-opened streams
  • C. open() requires a second argument
  • D. open() is a function which returns an object that represents a physical file


Answer : AC

What is the expected output of the following code if there is no file named non_existing_file inside the working directory?

  • A. 2 2 3
  • B. 2 2
  • C. 1 3
  • D. 1 2 2


Answer : B

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

  • A. math.ceil(2.5) == math.trunc(2.5)
  • B. math.ceil(2.5) < math.floor(2.5)
  • C. math.floor(2.5) == math.trunc(2.5)
  • D. math.hypot(3,4) == math.sqrt(25)


Answer : CD

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

  • A. import module_b
  • B. import pypack.upper.module_b
  • C. from pypack.upper import module_b
  • D. import upper.module_b


Answer : BC

What is the expected output of the following code?

import sys

b1 type (dir(sys)) is str
b2 type (sys.path[-1]) is str
print (b1 and b2)

  • A. True
  • B. False
  • C. 0
  • D. None


Answer : B

What is the expected behavior of the following code?

  • A. it outputs 3
  • B. the code is erroneous and it will not execute
  • C. it outputs 2
  • D. it outputs 1


Answer : B

What is the expected behavior of the following code?

  • A. the code is erroneous and it will not execute
  • B. it outputs 1
  • C. it outputs 3
  • D. it outputs 2


Answer : D

Page:    1 / 5   
Exam contains 67 questions

Talk to us!


Have any questions or issues ? Please dont hesitate to contact us

Certlibrary.com is owned by MBS Tech Limited: Room 1905 Nam Wo Hong Building, 148 Wing Lok Street, Sheung Wan, Hong Kong. Company registration number: 2310926
Certlibrary doesn't offer Real Microsoft Exam Questions. Certlibrary Materials do not contain actual questions and answers from Cisco's Certification Exams.
CFA Institute does not endorse, promote or warrant the accuracy or quality of Certlibrary. CFA® and Chartered Financial Analyst® are registered trademarks owned by CFA Institute.
Terms & Conditions | Privacy Policy