GPYC Exam Questions
71 real GPYC exam questions with expert-verified answers and explanations. Page 2 of 2.
- Question #51Python Fundamentals & Command Line Tools
Examine the code snippet below. What will be the contents of the variable i during the loops first iteration? ``` phrase = "Python is a powerful language".split() for i in phrase:...
string splitfor loopiterationlist indexing - Question #52Web Scraping & Forensics with Python
A .gif file has the following attributes: Extension: .gif Magic value for start of file: \x47\x49\x46\x38 Magic value for end of file: \x3b A small data file called "raw_data" cont...
file carvingmagic bytesregex binaryforensics - Question #53Python Fundamentals & Command Line Tools
What will be printed when the code in the screen capture is run? ```python >>> x=1 >>> y=2 >>> if x() and (y): ... z=x+y ... print(z) ... elif x() or (y): ... z=y-x ... print(z) .....
TypeErrorcallableconditionalscontrol flow - Question #54Interacting with APIs & Databases
What does the LIMIT function restrict in an SQL SELECT statement?
SQL SELECTLIMIT clausedatabase queriesrecord filtering - Question #55Advanced Python for Security Automation
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 "...
Scapypacket list indexingnetwork analysispacket capture - Question #56Python Fundamentals & Command Line Tools
Which of the following is the output when the following program is executed with a Python Interpreter? ```python >>> a = -10 >>> if a: ... print(a) ... else: ... print(-a) ```
truthinessnegative integersboolean evaluationconditionals - Question #57Network & Web Programming
During a password guessing attack, which HTTP request method would a Python program most commonly call to submit a username and password to a target website?
HTTP methodsPOST requestauthenticationweb requests - Question #58Python Fundamentals & Command Line Tools
What will the following code in Python 3 result in? ```python >>> x = 'global x' >>> def outer_func(): ... x = 'outer x' ... def inner_func(): ... print(x) ... inner_func() ... pri...
variable scopeclosuresnested functionsLEGB rule - Question #59Network & Web Programming
What does the following line of code do? `s.sendto(data, ('127.0.0.1', 5000))`
UDP socketsendtosocket programmingnetwork communication - Question #60Python Fundamentals & Command Line Tools
What is the output of the following line of code typed into a Python interactive session? `>>>print(8 << 1)`
bitwise operatorsleft shiftbinary arithmeticinteger operations - Question #61Advanced Python for Security Automation
What does the attacker do in a SQL Injection attack?
SQL injectionattack techniquesdatabase securityweb vulnerabilities - Question #62Web Scraping & Forensics with Python
With a requests session object named "browser", how can the expiration attribute of a cookie named "MUID" from "gpyc.com/" be accessed?
requests librarysession cookiescookie attributesHTTP sessions - Question #63Python Fundamentals & Command Line Tools
What does the following command do? pip search syslog
pippackage managementcommand line toolsPython modules - Question #64Python Fundamentals & Command Line Tools
Which of the lambda definitions of the function some_code is equivalent to the following function definition? def some_code (invalue): outvalue = invalue * 2 return outvalue
lambda functionsfunction definitionsPython syntaxanonymous functions - Question #65Advanced Python for Security Automation
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?
subprocessprocess managementI/O pipesPython modules - Question #66Python Fundamentals & Command Line Tools
What will the last value of V be when Python executes the following control loop? for x in range(4, 20, 2): print(x)
for looprange functioniterationcontrol flow - Question #67Advanced Python for Security Automation
In a SQL injection attack, which character would an attacker use to separate multiple SQL statements on a single line?
SQL injectionsemicolon delimiterSQL syntaxattack techniques - Question #68Network & Web Programming
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 ad...
socket programmingbind methodnetwork backdoorIP and port binding - Question #69Python Fundamentals & Command Line Tools
What will be the value of the i variable when the while loop finishes its execution? i = 0 while i != 0: i = i + 1 else: i = i + 1
while loopelse clauseloop executioncontrol flow - Question #70Python Fundamentals & Command Line Tools
An operator able to perform bitwise shifts is coded as (select two answers)
bitwise operatorsbit shiftingPython operators - Question #71Python Fundamentals & Command Line Tools
When the following program "question.py" is executed with Python what is the output? $ cat question.py def i(i): i=i return i i=i(10) print(i) $ python question.py
function definitionsvariable shadowingname bindingPython execution