
GIAC Python Coder
Domain 1Objective 4
Functions, Classes and Objects GPYC Practice Questions (Page 2)
Part of the Python Fundamentals domain, which makes up ~43% of our current practice bank. GIAC (SANS) does not publish an official question count, but from its 120-minute exam (~50–80 total, ~22–34 in this domain), expect 4–7 from this objective — we provide 45 practice questions to prepare you well beyond it. (estimate)
45questions here
9free pages
14concepts
Questions 6–10
- 6
Which special method is called when an object is created?
Select an answer first - 7
Which type of argument is passed to a function by specifying the parameter name and value, like `func(name="Alice")`?
Select an answer first - 8
A security analyst is writing a Python script to parse log lines. They need a function that accepts a variable number of key-value pairs (e.g., 'src_ip=10.0.0.1', 'dst_port=443') and returns a formatted string for each pair. The function must also accept an optional 'separator' argument that defaults to '='. Which function signature and implementation satisfies the requirement?
Select an answer first - 9
A developer is creating a 'Resource' class that holds a file handle. They want to ensure that when an instance is garbage collected, the file handle is closed. Which special method should they implement?
Select an answer first - 10
A developer is debugging a script that processes network packets. The script defines a global variable 'packet_count' and a function 'process_packet()' that increments it. The developer notices that after calling the function, the global variable remains unchanged. Which code change correctly fixes the issue?
Select an answer first
Finished these 5 questions?
Review the revealed explanations, or continue through the curriculum.
Free Basic Practice is a study aid with revealable answers — not a scored exam. Examers.io is independent and not affiliated with or endorsed by GIAC (SANS). “GPYC” is a trademark of its owner, used for identification only.