Welcome to TestSimulate

Pass Your Next Certification Exam Fast!

Everything you need to prepare, learn & pass your certification exam easily.

365 days free updates. First attempt guaranteed success.

[Sep-2021] Practice Python Institute PCAP-31-03 exam. Online Exam Practice Tests with detailed explanations! Pass PCAP-31-03 with confidence! [Q38-Q60]

Share

Practice Python Institute PCAP PCAP-31-03 exam. Online Exam Practice Tests with detailed explanations! Pass PCAP-31-03 with confidence!

PCAP-31-03 - Certified Associate in Python Programming Practice Tests 2021 | TestSimulate

NEW QUESTION 38
What is the expected behavior of the following code?

  • A. it outputs True
  • B. it outputs nothing
  • C. it raises an exception
  • D. it outputs False

Answer: A

 

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

  • A. B.VarA == 3
  • B. hasattr(obj_b, 'prop_aa')
  • C. obj_b.prop_a == 3
  • D. isinstance(obj_c,A)

Answer: B,D

 

NEW QUESTION 40
Assuming that the code below has been executed successfully, which of the following expressions will always evaluate to True? (Select two answers) import random v1 = random. random() v2 = random. random()

  • A. v1 == v2
  • B. random.choice{[1,2,3]) > 0
  • C. len(random. sample([1,2,3],1)) > 2
  • D. v1 < 1

Answer: B,D

 

NEW QUESTION 41
What is the expected behavior of the following code?

  • A. it outputs True
  • B. it outputs nothing
  • C. it raises an exception
  • D. it outputs False

Answer: A

 

NEW QUESTION 42
What is the expected output of the following snippet?

  • A. 0
  • B. 1
  • C. the code is erroneous
  • D. 2

Answer: C

 

NEW QUESTION 43
What is the expected output of the following snippet?

  • A. True lower
  • B. True upper
  • C. False lower
  • D. False upper

Answer: A

 

NEW QUESTION 44
What is the expected behavior of the following code?

  • A. it outputs error
  • B. the code is erroneous and it will not execute
  • C. it outputs <class ' IndexError' >
  • D. it outputs list assignment index out of range

Answer: D

 

NEW QUESTION 45
What is the output of the following piece of code?

  • A. antbatcame1
  • B. ant'bat'came1
  • C. ant"bat"came1
  • D. ant bat came1

Answer: C

Explanation:

 

NEW QUESTION 46
A method for passing the arguments used by the following snippet is called:

  • A. positional
  • B. keyword
  • C. named
  • D. sequential

Answer: A

 

NEW QUESTION 47
What is the expected output of the following code if existing_file is the name of a file located inside the working directory?

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

Answer: A

 

NEW QUESTION 48
What is the expected behavior of the following code?

  • A. it outputs error
  • B. the code is erroneous and it will not execute
  • C. it outputs <class ' IndexError' >
  • D. it outputs list assignment index out of range

Answer: D

 

NEW QUESTION 49
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 -

  • A. >>
  • B. <<<
  • C. <<
  • D. >>>

Answer: A

 

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

  • A. super-class constructor is invoked implicitly during constructor execution
  • B. the constructor cannot use the default values of the parameters
  • C. the constructor's first parameter identifies an object currently being created
  • D. the constructor can be invoked directly under strictly defined circumstances

Answer: C

 

NEW QUESTION 51
What is true about the following snippet? (Select two answers)

  • A. the siring I feel fine 'will be seen
  • B. the string what a pity will be seen
  • C. the code will raise an unhandled exception
  • D. the string it's nice to see you will be seen

Answer: A,B

 

NEW QUESTION 52
Assuming that the code below has been placed inside a file named code.py and executed successfully, which of the following expressions evaluate to True? (Select two answers)

  • A. _name == _main_'
  • B. str(Object) == 'Object'
  • C. len(ClassB.__bases__) == 1
  • D. ClassA. _module_ == 'ClassA'

Answer: C

 

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

  • A. platform.processor()
  • B. platform.platform ()
  • C. platform.python_version()
  • D. platform.uname ()

Answer: B

 

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

  • A. 'prop' in Class.__diet
  • B. len(Object.__diet__) == 1
  • C. 'var' in Object.__diet__
  • D. 'var1 in Class, diet

Answer: B,C

 

NEW QUESTION 55
Assuming that the following snippet has been successfully executed, which of the equations are False? (Select two answers)

  • A. len(a) == len(b)
  • B. b[0] - 1 == a[0]
  • C. a[0] - 1 == b[0]
  • D. a[0] = b[0]

Answer: B,D

Explanation:
>>> print(len(a)==len(b))
True
>>> print(a[0]-1==b[0])
True
>>> print(a[0]==b[0])
False
>>> print(b[0]-1 == a[0])
False

 

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

  • A. '1' + '1' + '1' < '1' * 3'
  • B. 'AbC' lower () < 'AB'
  • C. '3.14' != str(3.1415)
  • D. 121 + 1 != '!' + 2 * '2'

Answer: C,D

 

NEW QUESTION 57
How many lines does the following snippet output?

  • A. three
  • B. two
  • C. four
  • D. one

Answer: A

 

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

  • A. UTF-8 is one of the ways of representing UNICODE code points.
  • B. ASCII is the name of a character coding standard
  • C. an escape sequence can be recognized by the # sign put in front of it.
  • D. a code point is a point inside the code when execution stops immediately

Answer: A,B

 

NEW QUESTION 59
The first parameter of each method:

  • A. holds a reference to the currentlv processed object
  • B. is always set to None
  • C. is set by the first argument's value
  • D. is set to a unique random value

Answer: A

Explanation:
The first argument of every class method, including init, is always a reference to the current instance of the class. By convention, this argument is always named self. In the init method, self refers to the newly created object; in other class methods, it refers to the instance whose method was called

 

NEW QUESTION 60
......

Get instant access to PCAP-31-03 practice exam questions: https://drive.google.com/open?id=1_iQCWxMawJBPYpz-TXfeDU24TcRZ2MWR

The best PCAP-31-03 exam study material and preparation tool is here: https://www.testsimulate.com/PCAP-31-03-study-materials.html