EMT Practice Test

1. Question Content...


Question List

Question1: What happens if a programmer fails to build exception handling into a program, and the program
encounters an unexpected error condition?

Question2: What would be the string resulting from the following command, considering the string variable "gpyc"?

Question3: What does the "enumerate" function return when applied to a list?

Question4: What is the output of the following line of code typed into a Python interactive session?
>>> print (int("1111",2))

Question5: When the following program "question.py" is executed with Python what is the output?

Question6: Which of the following would produce this list?
[65, 66, 67, 68]

Question7: A log file is stored in variable "a". The file has the following format for each log entry, in order, stored in big
endian:
Field 1: 2-byte integer
Field 2: 2-byte integer
Field 3: 4-byte integer
Which of the following would unpack a line from the log file into the proper fields?

Question8: Which of the lambda definitions of the function some_code is equivalent to the following function definition?

Question9: Which of the following modules allows a programmer to specify and spawn new processes, connect to
their input and output pipes, and retrieve returned data?

Question10: What will the following code in Python 3 result in?

Question11: Which python regular expression method should be used to match any character in a-z, 0-9, or !@#$%^&*
()?

Question12: Which of the following will be the value of the variable y?

Question13: What will be printed when the code in the screen capture is run?

Question14: What will the contents of the "__name__" variable be if the program "gpyc.py" is run as a standalone
program?

Question15: Examine the code snippet below. What will be the contents of the variable 'i' during the loops first iteration?

Question16: In a SQL injection attack, which character would an attacker use to separate multiple SQL statements on a
single line?

Question17: What is the output of the following line of code typed into a Python interactive session?

Question18: Which of the following is the final output when program.py is executed with a Python Interpreter?

Question19: A multi-byte character encoded with UTF-8 has the first byte 11001101. What will the next byte begin with?

Question20: What is the output of the following line of code typed into a Python interactive session?
>>> print (~100)

Question21: An attacker does not yet know the IP address of his target. He uses the "socket" module to create a
backdoor program. He is writing the command to bind the computer's current IP address and port 4444 to
the "backdoor" socket. Which command should he use?

Question22: What is the output of the following commands typed in the Python Interactive shell?

Question23: If the variable "example" contains a handle to a subprocess object, which of the following would show all of
the possible results of running the subprocess?

Question24: A user enters unexpected data into program. Which functionality can the programmer use to present an
understandable error message to the user?

Question25: Review the following code, written in Python. What are the contents of variable a?

Question26: A programmer attempts to run the Python program hello.py as follows, but an error occurs. What is the
cause of this error?

Question27: What is the output of the following when executed in a Python shell?

Question28: Using the Python "sockets" module, which of the following functions looks up the IP address of
www.giac.org?

Question29: What will the last value of 'x' be when Python executes the following control loop?

Question30: Review the following Python code:

Question31: What does the following line of code do?
example=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)

Question32: Which of the following is the output when the following program is executed with a Python Interpreter?

Question33: When accessing the hard drive directly, how would the character 'B' be stored?

Question34: What does executing the following code in Python 3 result in?
'\x0066'

Question35: What are the contents of the variable x when the following is executed in a Python interactive session?

Question36: Which command will search for python modules that will have the ability to parse pcap files?

Question37: What is the output of the following line of code typed into a Python interactive session?
>>> print (8 << 1)

Question38: A programmer includes the following line in his program. What does this enable him to do?
from scapy.all import *

Question39: Variable "traffic" contains a Scapy packet list. A programmer runs the following command:
p1=traffic[1]
Which of the following describes the contents of p1, with respect to the "traffic" packet list?