Certified Associate in Python Programming v1.0

Page:    1 / 10   
Exam contains 147 questions

Is it possible to safely check if a class/object has a certain attribute?

  • 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

Answer : B


The first parameter of each method:

  • 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

Answer : D


The simplest possible class definition in Python can be expressed as:

  • A. class X:
  • B. class X: pass
  • C. class X: return
  • D. class X: { }

Answer : A


If you want to access an exception objectג€™s components and store them in an object called e, you have to use the following form of exception statement:

  • A. except Exception (e) :
  • B. except e= Exception :
  • C. except Exception as e:
  • D. such an action is not possible in Python

Answer : C


A variable stored separately in every object is called:

  • A. there are no such variables, all variables are shared among objects
  • B. a class variable
  • C. an object variable
  • D. an instance variable

Answer : D

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

  • A. s. write (ג€Hello\nג€)
  • B. write (s, ג€Helloג€)
  • C. s.writeln (ג€Helloג€)
  • D. s. writeline (ג€Helloג€)

Answer : A


You are going to read just one character from a stream called s. Which statement would you use?

  • A. ch = read (s, 1)
  • B. ch= s.input (1)
  • C. ch= input (s, 1)
  • D. ch= s.read (1)

Answer : D


What can you deduce from the following statement? (Choose two.)

  • A. str is a string read in from the file named file.txt
  • B. a newline 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

Answer : AD

The following class hierarchy is given. What is the expected out of the code?

  • A. BB
  • B. CC
  • C. AA
  • D. BC

Answer : D

Pythonג€™s built in function named open () tries to open a file and returns:

  • A. an integer value identifying an opened file
  • B. an error code (0 means success)
  • C. a stream object
  • D. always None

Answer : C

Which of the following words can be used as a variable name? (Choose two.)

  • A. for
  • B. True
  • C. true
  • D. For

Answer : CD


Python strings can be ג€gluedג€ together using the operator:

  • A. .
  • B. &
  • C. _
  • D. +

Answer : D


A keyword (Choose two.)

  • A. can be used as an identifier
  • B. is defined by Pythonג€™s lexis
  • C. is also known as a reserved word
  • D. cannot be used in the userג€™s code

Answer : BC


How many stars (*) does the snippet print?

  • A. the code is erroneous
  • B. five
  • C. four
  • D. two

Answer : A

Which line can be used instead of the comment to cause the snippet to produce the following expected output? (Choose two.)
Expected output:
1 2 3

  • 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

Answer : AC

Page:    1 / 10   
Exam contains 147 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