[Oct-2021] PCAP-31-03 Pre-Exam Practice Tests Exam Questions and Answers for Python Institute PCAP Study Guide [Q28-Q47]

Share

[Oct-2021] PCAP-31-03 Pre-Exam Practice Tests | Exam Questions and Answers for Python Institute PCAP Study Guide

Certified Associate in Python Programming Certification Sample Questions

NEW QUESTION 28
Which of the following snippets will execute without raising any unhandled exceptions? (Select answers) A)

B)

C)

D)

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

Answer: A,B,D

 

NEW QUESTION 29
Assuming that the following inheritance set is in force, which of the following classes are declared properly?
(Select two answers)

  • A. class Class_2(B,D): pass
  • B. class Class_3(A,C): pass
  • C. class Class_4 (D, A) : pass
  • D. class Class_1(C,D): pass

Answer: C,D

 

NEW QUESTION 30
Which of the following expression evaluate to True? (Select two answers)

  • A. len("""
    """) == o
  • B. chr(ordCA') + 1) == 'B'
  • C. ord("Z") - ord("z") -- ord("0")
  • D. len('\'*) == 1

Answer: A

 

NEW QUESTION 31
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 32
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 33
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 3
  • D. it outputs 2

Answer: B

 

NEW QUESTION 34
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 (get())
  • C. print (self.get (val))
  • D. print (self.get())

Answer: D

 

NEW QUESTION 35
A class constructor (Select two answers)

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

Answer: A,D

 

NEW QUESTION 36
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 37
What is the expected output of the following code?

  • A. True
  • B. None
  • C. False
  • D. 0

Answer: A

 

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

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

Answer: C

 

NEW QUESTION 39
What can you deduce from the following statement0 (Select two answers) str = open('file.txt', "rt")

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

Answer: C,D

 

NEW QUESTION 40
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 2.0
  • B. it outputs 2. 5
  • C. the code is erroneus and it will not execute
  • D. it outputs 3.0

Answer: A

 

NEW QUESTION 41
How many elements will the list2 list contain after execution of the following snippet?
list1 = [False for i in range (1, 10) ]
list2 = list1 [-1:1:-1]

  • A. seven
  • B. three
  • C. zero
  • D. five

Answer: A

Explanation:

 

NEW QUESTION 42
Assuming that the snippet below has been executed successfully, which of the following expressions will evaluate to True? (Select two answers) string = 'SKY' (:: -1) string = string (-1)

  • A. len (string) == 1
  • B. string (0) == 'Y'
  • C. string (0) == string (-1
  • D. string is None

Answer: A,B

 

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

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

Answer: D

 

NEW QUESTION 44
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. 1
  • C. an errno value corresponding to file not found
  • D. 2

Answer: A

 

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

  • A. True
  • B. None
  • C. False
  • D. 0

Answer: A

 

NEW QUESTION 46
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. 1
  • C. an errno value corresponding to file not found
  • D. 2

Answer: A

 

NEW QUESTION 47
......

Python Institute Exam Practice Test To Gain Brilliante Result: https://www.pass4surequiz.com/PCAP-31-03-exam-quiz.html

Tested Material Used To PCAP-31-03: https://drive.google.com/open?id=1lMcqtHuvNHPt4xWJbUUmgv7G5Ne6q2Oo