Win IT Exam with Last Dumps 2024

Python PCAP Exam

Page 4/15
Viewing Questions 31 40 out of 146 Questions

Question 31
What is the expected behavior of the following code?It will:
Image PCAP_31Q.jpg related to the Python PCAP Exam
A. print 4321
B. print
C. cause a runtime exception
D. print 1234

Question 32
If you need a function that does nothing, what would you use instead of XXX? (Choose two.)
Image PCAP_32Q.png related to the Python PCAP Exam
A. pass
B. return
C. exit
D. None

Question 33
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

Question 34
The first parameter of each method:
A. holds a reference to the currently processed object
B. is always set to None
C. is set to a unique random value
D. is set by the first argument's value

Question 35
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: {}

Question 36
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

Question 37
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

Question 38
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 ")
B. write (s, "Hello")
C. s.writeln ("Hello")
D. s. writeline ("Hello")

Question 39
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= (1)

Question 40
What can you deduce from the following statement? (Choose two.)
Image PCAP_40Q.png related to the Python PCAP Exam
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