Limited-Time Offer: Enjoy 50% Savings! - Ends In 0d 00h 00m 00s Coupon code: 50OFF
Welcome to QA4Exam

Exam preparation

GIAC GPYC Exam Guide for the Penetration Testing

GPYC is the code of the GIAC Python Coder exam, part of the GIAC Penetration Testing certification. You get 75 questions and 120 minutes. It is scored across 12 exam topics. 13 free practice questions with explanations are online, and each exam topic below links to the ones written for it.

GPYC Exam Details

Vendor
GIAC
Exam Code
GPYC
Real Exam Questions
75
Time Limit
120 min
Free Practice Questions
13
Full Question Set
75
Exam Topics
12
Last Updated
December 3, 2026
Exam Name
GIAC Python Coder
Certification
GIAC Penetration Testing
Technology
Programming Language

GPYC Exam Topics and Weights

Control Structures and Iteration

What this topic covers

Build Python conditionals and for or while loops to direct program flow. Iterate over file objects to process input incrementally instead of loading entire files into memory.

Why does iterating over a file object use less memory than calling read?

Iterating over the file object reads it one line at a time, so memory does not grow with the whole file. A read() call loads everything into one string first. Example: for line in f: process(line).

1 free GPYC practice question on Control Structures and Iteration

Creation of Executables

What this topic covers

Turn Python programs into Windows executables and understand backdoor functionality in penetration testing. Choose a suitable delivery method, such as a reviewed script signed by an approved identity when the client accepts signed scripts.

1 free GPYC practice question on Creation of Executables

Data Analysis with Python

What this topic covers

Parse binary fields with struct formats such as >I, and analyze files and logs with Python. Use Counter for occurrence counts and sets for distinct values, including long-tail and short-tail analysis.

Which struct format string fits a four-byte big-endian identifier field?

Use the format string >I. The greater-than sign selects big-endian byte order, and I is an unsigned four-byte integer. struct.unpack(">I", data:4) returns a tuple, so take element zero of the result.

2 free GPYC practice questions on Data Analysis with Python

Data Structures

What this topic covers

Work with bytes, byte arrays, integers, strings, lists, tuples, and dictionaries. Decode UTF-8 or Latin-1 data appropriately, handling UnicodeDecodeError when invalid text must not be replaced silently.

When should I decode bytes as UTF-8 and catch UnicodeDecodeError?

Decode with UTF-8 when the field is documented as UTF-8, and catch UnicodeDecodeError so bad input is reported. Using errors="replace" silently inserts replacement characters, which hides corruption. Latin-1 never fails, because every byte maps to one character.

1 free GPYC practice question on Data Structures

Database Interaction

What this topic covers

Query and update databases from Python using SQL libraries. Bind parameters, such as hostnames, as data rather than SQL syntax to handle special characters safely and apply exact-match conditions.

Why use a question-mark placeholder instead of building SQL with the hostname?

Parameter binding passes the hostname as data, so apostrophes and SQL metacharacters cannot change the query. With sqlite3, cursor.execute with a ? placeholder and a tuple performs an exact equality match. Example: WHERE name = ? with (host,).

1 free GPYC practice question on Database Interaction

Exception Handling

What this topic covers

Use Python exception handling to respond to runtime failures without losing useful error details. Place file operations inside try blocks so access errors can be caught and reported.

Where should the open call go when file-access errors need their own report?

Put the open call inside the outer try block, with its own except clause for OSError. Then missing files and permission errors are caught and reported separately from later processing errors. The program can respond to each failure without crashing.

1 free GPYC practice question on Exception Handling

Functions, Classes, and Objects

What this topic covers

Write Python functions and define classes to organize program behavior. Initialize mutable instance data, such as an observations list, in __init__ so each object keeps its own state.

Why create the observations list inside __init__ instead of as a class attribute?

A list created in __init__ is new for each instance, so each object keeps its own observations. A class attribute list is shared by every instance, so one object's appends show up in all the others. Assign self.observations = inside __init__.

1 free GPYC practice question on Functions, Classes, and Objects

Network Interfaces

What this topic covers

Use Python sockets to communicate over TCP and UDP. Send UDP datagrams with SOCK_DGRAM and sendto, specifying each destination without establishing a connection.

When do I call sendto on a UDP socket instead of connecting first?

Use sendto with a SOCK_DGRAM socket to name the destination for each datagram. UDP needs no connection setup, and sendto does not wait for an application reply. Example: sock.sendto(data, (host, port)).

1 free GPYC practice question on Network Interfaces

Packet Analysis with Python

What this topic covers

Use Scapy to read, inspect, and manipulate captured network packets. Check for layers with expressions such as IP in packet before accessing layer fields.

Why check IP in packet before reading packetIP in Scapy?

The membership check tells you whether the IP layer exists, so indexing never fails on frames without it. Example: if IP in pkt: print(pktIP.src). ARP packets, for instance, have no IP layer.

1 free GPYC practice question on Packet Analysis with Python

Python Basics

What this topic covers

Create, run, and debug Python programs that handle user input and file input and output. Iterate over files incrementally and use enumerate to track physical line numbers, including when blank lines are skipped.

How does enumerate's line number behave when blank lines are skipped?

enumerate assigns the number as each line comes off the file, before any blank-line check. Skipping blank lines with continue therefore keeps the original physical line numbers. Example: for n, line in enumerate(f, start=1).

1 free GPYC practice question on Python Basics

Website Interaction

What this topic covers

Use Python to make URL requests and interact with websites as a browser. Connect a CookieJar through HTTPCookieProcessor so an opener stores received cookies and sends them on later requests.

What makes HTTPCookieProcessor keep cookies between urllib requests?

HTTPCookieProcessor links a CookieJar to the opener's request handling. Cookies received in responses are stored and sent on later requests made through that same opener. A new opener starts with an empty jar, so cookies do not carry over.

1 free GPYC practice question on Website Interaction

Related GIAC Exams

Continue to Free GPYC Exam Questions