Get Real PCAP-31-03 Exam Dumps [Jan-2023] Practice Tests [Q56-Q79]

Share

Get Real PCAP-31-03 Exam Dumps [Jan-2023] Practice Tests

Last PCAP-31-03 practice test reviews: Practice Test Python Institute dumps


For more info read reference:

Python Institute Official Website Preparation Material FAQs and Guide

 

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

  • A. it outputs 0
  • B. it raises an exception
  • C. it outputs 2
  • D. it outputs 1

Answer: B

 

NEW QUESTION 57
A variable stored separately in every object is called:

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

Answer: B

 

NEW QUESTION 58
What can you do if you don't like a long package path tike this one0 import alpha.beta.gamma.delta.epsiIon.zeta

  • A. you can make an alias for the name using the a 1 i a s keyword
  • B. you can shorten it to alpha. zeta and Python will find the proper connection
  • C. you can make an alias for the name using die as keyword
  • D. nothing; you need to come to terms with it

Answer: C

 

NEW QUESTION 59
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)

Answer: A,C

 

NEW QUESTION 60
What is the expected output of the following code?

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

Answer: A

Explanation:

 

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

  • A. from pypack import module_a
  • B. import pypack.module_a
  • C. import module_a from pypack
  • D. import module_a

Answer: A,B

 

NEW QUESTION 62
A property that stores information about a given class's super-classes is named:

  • A. _upper_
  • B. _bases_
  • C. _super_
  • D. _ancestors_

Answer: C

 

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

  • A. instd, outstd, errstd are the names of pre-opened streams
  • B. if invoking open () fails, the value None is returned
  • C. open () is a function which returns an int that represents a physical file handle
  • D. the second open () argument is optional

Answer: C,D

 

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

It will:

  • A. print <generator object f at (some hex digits)>
  • B. cause a runtime exception
  • C. print 1234
  • D. print 4321

Answer: A

Explanation:

 

NEW QUESTION 65
What is the expected output of the following code if the file named existing_text_file is a non-zero length text file located inside the working directory?

  • A. the number of lines contained inside the file
  • B. the length of the first line from the file
  • C. 0
  • D. the length of the last line from the file

Answer: C

 

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

  • A. antbatcamel
  • B. ant"bat"camel
  • C. ant'bat'camel
  • D. ant bat camel

Answer: B

Explanation:

 

NEW QUESTION 67
What is true about Object-Oriented Programming in Python? (Select two answers)

  • A. inheritance is the relation between a superclass and a subclass
  • B. the arrows on a class diagram are always directed from a superclass towards its subclass
  • C. encapsulation allows you to protect some data from uncontrolled access
  • D. an object is a recipe for a class

Answer: B,C

 

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

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

Answer: A,C

 

NEW QUESTION 69
What is the expected out of the following code of the file named zero_length_existing_file is a zero-length file located inside the working directory?

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

Answer: C

 

NEW QUESTION 70
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. random.choice([1,2,3]) >=1
  • B. v1 >= 1
  • C. v1 == v2
  • D. len(random.sample([1,2,3],2)) > 2

Answer: A,C

 

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

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

Answer: B,D

 

NEW QUESTION 72
An operator able to perform bitwise shifts is coded as (select two answers)

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

Answer: A,D

 

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

  • A. Python strings are actually lists
  • B. Python strings can be sliced like lists
  • C. Python strings are mutable
  • D. Python strings can be concatenated

Answer: B,D

 

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

  • A. it raises an exception
  • B. it outputs 'None'
  • C. it outputs 3
  • D. it outputs 0

Answer: D

 

NEW QUESTION 75
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) = 'Object1
  • C. Class A.__module__ == ' main__'
  • D. len (ClassB.__bases__) == 2

Answer: C,D

 

NEW QUESTION 76
A file name like this one below says mat: (select three answers)
services. cpython-36.pyc

  • A. the file comes from the services . py source file
  • B. it is the 36th version of the file
  • C. the interpreter used to generate the file is version 3.6
  • D. it has been produced by CPython

Answer: A,C,D

 

NEW QUESTION 77
Assuming that the following piece of code has been executed successfully, which of the expressions evaluate to True? (Choose two.)

  • A. A.VarA == 1
  • B. B.VarA == 1
  • C. isinstance (obj_b,A)
  • D. obj_a is obj_aa

Answer: C,D

 

NEW QUESTION 78
The following class definition is given. We want the show () method to invoke the get () method, and then output the value the get () method returns. Which of the invocations should be used instead of XXX?

  • A. print (self.get (val))
  • B. print (self.get())
  • C. print (get(self))
  • D. print (get())

Answer: B

 

NEW QUESTION 79
......

Get Ready to Pass the PCAP-31-03 exam with Python Institute Latest Practice Exam : https://2cram.actualtestsit.com/Python-Institute/PCAP-31-03-exam-prep-dumps.html