Pass4itsure > Python Institute > PCAP > PCAP > PCAP Online Practice Questions and Answers

PCAP Online Practice Questions and Answers

Questions 4

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 newline 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

Buy Now
Questions 5

How many stars (*) does the snippet print?

A. the code is erroneous

B. five

C. four

D. two

Buy Now
Questions 6

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

Buy Now
Questions 7

If S is a stream open for reading, what do you expect from the following invocation?

A. one line of the file will be read and stored in the string called C

B. the whole file content will be read and stored in the string called C

C. one character will be read and stored in the string called C

D. one disk sector (512 bytes) will be read and stored in the string called C

Buy Now
Questions 8

A Python module named pymod.py contains a function named pyfun().

Which of the following snippets will let you invoke the function? (Choose two.)

A. import pymod pymod.pyfun()

B. from pymod import pyfun pyfun()

C. from pymod import * pymod.pyfun()

D. import pyfun from pymod pyfun()

Buy Now
Questions 9

What is the expected behavior of the following code?

A. it outputs 0

B. it raises an exception

C. it outputs 1

D. it outputs 2

Buy Now
Questions 10

Which of the following snippets will execute without raising any unhandled exceptions?

A. Option A

B. Option B

C. Option C

D. Option D

Buy Now
Questions 11

With regards to the directory structure below, select the proper forms of the directives in order to import module_b. (Choose two.)

A. from pyback.upper import module_b

B. import pyback.upper.module_b

C. import upper.module_b

D. import module_b

Buy Now
Questions 12

What is the expected output of the following snippet?

A. True lower

B. True upper

C. False upper

D. False lower

Buy Now
Questions 13

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? (Choose two.)

A. ClassA.__module__ == `__main__'

B. __name__ == `__main__'

C. str(Object) == `Object'

D. len(ClassB.__bases__) == 2

Buy Now
Exam Code: PCAP
Exam Name: Certified Associate in Python Programming
Last Update: May 02, 2024
Questions: 153
10%OFF Coupon Code: SAVE10

PDF (Q&A)

$45.99

VCE

$49.99

PDF + VCE

$59.99