5-6 Devasc Book Flashcards
When parsing a text file, what determines the end of a line?
a. Return code
b. Nothing; Python sees it as one big string
c. \n or EoF
d. All of the above
C
What syntax would you use to open a text file to be written to?
a. data = open(“text.txt”, “w”)
b. data = load(“text.txt”, “w”)
c. load(“text.txt”, “w”)
d. open(“text.txt”, “w”)
A
Which of the following do you use to write to a CSV file in Python?
a. with open(“text.csv”, “a”) as filehandle:
csv_writer = csv.write(filehandle)
csv_writer.writerow(data)
b. with open(“text.csv”, “a”) as filehandle:
csv_writer.writerow(data)
c. with open(“text.csv”, “a”) as filehandle:
csv_writer = csv.writer(filehandle)
csv_writer.writerow(data)
d. with open(“text.csv”, “a”) as filehandle:
csv_writer = csv.writer(f)
csv_writer.writerow(data)
C
Which module is imported to read XML data?
a. xmlm
b. xmltodict
c. XMLParse
d. None of the above
B
Which methods are used for converting a native JSON file to Python and then back to
JSON? (Choose two.)**
\
a. load() and dump()
b. loads() and dump()
c. loads() and dumps()
d. load() and dumps()
A,C
What does YAML stand for?
a. Yet Another Markup Language
b. YAML Ain’t Markup Language
c. The name of its creator
d. None of the above
B
What is the syntax for error handling in Python?
a. try-except-else-finally
b. raise ErrorMessage
c. assertErrorValue
d. All of the above
A
When does the finally block execute?
a. After the try block is successful
b. After the except block
c. At the end of every try block
d. When an error code stops the else block
C
Test-driven development requires that developers:
a. Create a unit test for every bit of code they write
b. Know how to use DevOps tools for automated testing
c. Create a simple test that fails and then write code that allows the test to succeed
d. Completely unnecessary in an Agile development shop
C
What is the difference between a unit test and an integration test? (Choose two.)
a. An integration test is for validation of how different parts of the application work
together.
b. An integration test verifies that the application operates as expected.
c. A unit test verifies API functionality.
d. A unit test is most specific in scope and tests small bits of code.
A,D
Which class is inherited as part of a unit test?
a. unittest.testcase
b. unittest.TestCase
c. unittest
d. TestCase
B
Which of the following is a sample use case of a southbound API?
a. Pushing network configuration changes down to devices
b. Increasing security
c. Streaming telemetry
d. Sending information to the cloud
A
What are some benefits of using asynchronous APIs? (Choose two.)
a. Not having to wait on a response to process data
b. Reduced processing time
c. Increased processing time
d. Data function reuse
A,B
What are the HTTP functions used for API communication? (Choose three.)
a. GET
b. SOURCE
c. PURGE
d. PATCH
e. PUT
A,D,E
True or false: RESTful API authentication can use API keys or custom tokens.
a. True
b. False
A