October/2022 Latest Braindump2go PCAP-31-03 Exam Dumps with PDF and VCE Free Updated Today! Following are some new Braindump2go PCAP-31-03 Real Exam Questions!

QUESTION 86
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: B

QUESTION 87
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

QUESTION 88
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

QUESTION 89
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

QUESTION 90
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(l)

Answer: D

QUESTION 91
What can you deduce from the following statement? (Select two answers)

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

QUESTION 92
The following class hierarchy is given. What is the expected output of the code?

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

Answer: D

QUESTION 93
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

QUESTION 94
A class constructor (Select two answers)

A. can return a value
B. cannot be invoked directly from inside the class
C. can be invoked directly from any of the subclasses
D. can be invoked directly from any of the superclasses

Answer: BC

QUESTION 95
Which of the listed actions can be applied to the following tuple? (Select two answers)

A. tup [:]
B. tup.append (0)
C. tup [0]
D. del tup

Answer: AD

QUESTION 96
What is the expected output of the following snippet?

A. True False
B. True True
C. False False
D. False True

Answer: B

QUESTION 97
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: C

QUESTION 98
Which of the following words can be used as a variable name? (Select two valid names)

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

Answer: CD

QUESTION 99
How many elements will the list1 list contain after execution of the following snippet?

A. two
B. zero
C. one
D. three

Answer: A

QUESTION 100
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:

Answer: B

QUESTION 101
What is the expected behavior of the following code?

It will:

A. print 0
B. cause a runtime exception
C. prints 3
D. print an empty line

Answer: B

QUESTION 102
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 (get(self))
B. print (self.get())
C. print (get())
D. print (self.get (val))

Answer: B

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

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

Answer: C

QUESTION 104
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: AC

QUESTION 105
You are going to read 16 bytes from a binary file into a bytearray called data. Which lines would you use? (Select two answers)

A. data = bytearray (16) bf.readinto (data)
B. data = binfile.read (bytearray (16))
C. bf. readinto (data = bytearray (16))
D. data = bytearray (binfile.read (16))

Answer: AD

QUESTION 106
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

Answer: AC

QUESTION 107
Which of the equations are True? (Select two answers)

A. chr (ord (x)) = = x
B. ord (ord (x)) = = x
C. chr (chr (x)) = = x
D. ord (chr (x)) = = x

Answer: AD

QUESTION 108
Files with the suffix .pyc contain:

A. Python 4 source code
B. backups
C. temporary data
D. semi-compiled Python code

Answer: D

QUESTION 109
What can you do if you don’t like a long package path like this one?

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

Answer: D

QUESTION 110
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: C
Explanation:
Information from Python course, singned by Python Institute:
Python provides a function which is able to safely check if any object/class contains a specified property. The function is named hasattr, and expects two arguments to be passed to it:
the class or the object being checked;
the name of the property whose existence has to be reported (note: it has to be a string containing the attribute name, not the name alone)

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

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

Answer: D

QUESTION 112
Python strings can be “glued” together using the operator:

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

Answer: D

QUESTION 113
Executing the following snippet

will cause the dct:

A. to hold two keys named `pi’ linked to 3.14 and 3.1415 respectively
B. to hold two key named `pi’ linked to 3.14 and 3.1415
C. to hold one key named `pi’ linked to 3.1415
D. to hold two keys named `pi’ linked to 3.1415

Answer: C

QUESTION 114
A two-parameter lambda function raising its first parameter to the power of the second parameter should be declared as:

A. lambda (x, y) = x ** y
B. lambda (x, y): x ** y
C. def lambda (x, y): return x ** y
D. lambda x, y: x ** y

Answer: D

QUESTION 115
What is the expected behavior of the following code?

It will:

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

Answer: B

QUESTION 116
What is true about Python class constructors? (Choose two.)

A. there can be more than one constructor in a Python class
B. the constructor must return a value other than None
C. the constructor is a method named __init__
D. the constructor must have at least one parameter

Answer: CD

QUESTION 117
What is the expected behavior of the following code?

A. it outputs -2
B. it outputs 2.0
C. it outputs 0.0
D. the code is erroneous and it will not execute

Answer: A

QUESTION 118
What is the expected behavior of the following code?

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

Answer: C

QUESTION 119
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 length of the first line from the file
B. -1
C. the number of lines contained inside the file
D. the length of the last line from the file

Answer: B

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

A. from pypack.upper.lower import module_c
B. import pypack.upper.lower.module_c
C. import upper.module_c
D. import upper.lower.module_c

Answer: AB


Resources From:

1.2022 Latest Braindump2go PCAP-31-03 Exam Dumps (PDF & VCE) Free Share:
https://www.braindump2go.com/pcap-31-03.html

2.2022 Latest Braindump2go PCAP-31-03 PDF and PCAP-31-03 VCE Dumps Free Share:
https://drive.google.com/drive/folders/1WOF8RI5Clwh0-xEjaINnfZaRFK1GiPxm?usp=sharing

3.2021 Free Braindump2go PCAP-31-03 Exam Questions Download:
https://www.braindump2go.com/free-online-pdf/PCAP-31-03-Dumps(87-117).pdf
https://www.braindump2go.com/free-online-pdf/PCAP-31-03-PDF(118-130).pdf
https://www.braindump2go.com/free-online-pdf/PCAP-31-03-PDF-Dumps(1-30).pdf
https://www.braindump2go.com/free-online-pdf/PCAP-31-03-VCE(56-86).pdf
https://www.braindump2go.com/free-online-pdf/PCAP-31-03-VCE-Dumps(31-55).pdf

Free Resources from Braindump2go,We Devoted to Helping You 100% Pass All Exams!