Python Institute PCAP-31-03試験情報と無料練習テストはこちら [Q46-Q71]

Share

Python Institute PCAP-31-03試験情報と無料練習テストはこちら

合格させるPython Institute PCAP-31-03プレミアムお試しセットテストエンジンPDFで無料問題集セット


Python Institute PCAP-31-03 認定試験の出題範囲:

トピック出題範囲
トピック 1
  • Ideas: class, object, property, method, encapsulation, inheritance, grammar vs class, superclass, subclass
トピック 2
  • Private components (instance vs classes), name mangling
  • closures: meaning, defining, and using closures
トピック 3
  • Inheritance: single, multiple, isinstance(), overriding, not is and is operators
トピック 4
  • Event classes, except E as e, arg property
  • import variants; advanced qualifiying for nested modules
トピック 5
  • Instrospection: hasattr() (objects vs classes), __name__, __module__, __bases__ properties
トピック 6
  • Math: ceil(), floor(), trunc(), factorial(), hypot(), sqrt(); random: random(), seed(), choice(), sample()
  • indexing, slicing, immutability

 

質問 46
What is the expected behavior of the following code?

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

正解: C

 

質問 47
What is the expected output of the following code?

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

正解: D

 

質問 48
What is the expected behavior of the following code?
x = 8 ** (1/3)
y = 2. if x < 2.3 else 3.
print(y)

  • A. it outputs 3.0
  • B. it outputs 2. 5
  • C. it outputs 2.0
  • D. the code is erroneus and it will not execute

正解: C

 

質問 49
What independently inside the add_new () method in order to make the snippet's output equal to [0, 1, 1] ? (Select two answers)

  • A. self .put (self.store[1])
  • B. self put stire(1])
  • C. put self.store(1])
  • D. self .put self.get () [-1])

正解: A,B

 

質問 50
What is the expected output of the following code?

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

正解: B

解説:

 

質問 51
What is the expected behavior of the following code?

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

正解: C

 

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

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

正解: C

 

質問 53
What is the expected output of the following snippet?

  • A. 0
  • B. abc
  • C. ABC
  • D. The code will cause a runtime exception

正解: D

解説:

 

質問 54
Assuming that the following code has been executed successfully, select the expressions which evaluate to True (Select two answers)

  • A. a() > 2
  • B. b( ) > 2
  • C. a is not None
  • D. a is b

正解: A,B,C

 

質問 55
There is a stream named s open for writing. What option will you select to write a line to the stream''

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

正解: D

 

質問 56
The first parameter of each method:

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

正解: D

解説:
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

 

質問 57
Which of the following lines of code will work flawlessly when put independently inside the add_new () method in order to make the snippet's output equal to [0, 1, 1] ? (Select two answers)

  • A. self .put (self.store[1])
  • B. self put stire(1])
  • C. put self.store(1])
  • D. self .put self.get () [-1])

正解: A,B

 

質問 58
What is the expected behavior of the following code?

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

正解: B

 

質問 59
Assuming that the following snippet has been successfully executed, which of the equations are False? (Select two answers)

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

正解: C,D

解説:
>>> 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

 

質問 60
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 module_a from pypack
  • C. import pypack.module_a
  • D. import module_a

正解: A,C

 

質問 61
Which of the following statements are true? (Select two answers)

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

正解: C,D

 

質問 62
What is the expected behavior of the following code?

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

正解: A

 

質問 63
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. split (s)
  • D. s.split ()

正解: A,D

 

質問 64
Assuming that the snippet below has been executed successfully, which of the following expressions will evaluate to True? (Select two answers) string = 'python' [::2] string = string[-1] + string[-2]

  • A. string[0] == 'o'
  • B. string is None
  • C. len (string] == 3
  • D. string[0] == string[-1]

正解: A

 

質問 65
Which of the following snippets will execute without raising any unhandled exceptions? (Select answers) A)

B)

C)

D)

  • A. Option B
  • B. Option C
  • C. Option A
  • D. Option D

正解: A,B,D

 

質問 66
A variable stored separately in every object is called:

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

正解: D

 

質問 67
What is the expected output of the following snippet?

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

正解: C

解説:

 

質問 68
What is the expected behavior of the following code?

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

正解: A

 

質問 69
What can you deduce from the following statement? (Select two answers)
str = open('file.txt', "rt")

  • A. str is a string read in from the file named file.txt
  • B. if file. txt does not exist, it will be created
  • C. the opened file cannot be written with the use of the str variable
  • D. a newlina character translation will be performed during the reads

正解: A,C

 

質問 70
What is the expected output of the following code?

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

正解: B

 

質問 71
......

更新された公式認定はPCAP-31-03認証済みのPCAP-31-03問題集でPDF:https://www.goshiken.com/Python-Institute/PCAP-31-03-mondaishu.html