Free GPYC: GIAC Python Coder Exam Questions and Answers
GIAC Python Coder is exam GPYC, part of GIAC certification from GIAC, the affiliated certification body to SANS Institute. GIAC exams are open book but hard copy only, run two to five hours, and many include CyberLive tasks performed on a live virtual machine rather than answered from memory. Codes are letters rather than numbers — G plus the subject for practitioner certifications, GX- for the Applied Knowledge tier.
Candidates comparing GPYC exam dumps, ExamTopics and other GPYC practice tests use this page for the answers and explanations behind each question. Download the free GPYC PDF, then sit the timed GPYC exam simulation before booking with GIAC.
Last updated: October 25, 2026
- Exam code
- GPYC
- Provider
- GIAC
- Questions in our bank
- 1000+
- Free to read
- First 10, with answers
- Official page
- Official Exam website
- Our test mode duration & pass mark
- 130 mins · 70%
Recommended: Switch to Test Mode to start a practice test that simulates the real exam experience.
Question #1
A script builds a binary packet header with the following code: import struct print(struct.pack(">HB", 513, 7)) What is the output?
Correct answer: C
Explanation
The > prefix selects big-endian byte order with standard sizes and no padding. H packs 513 (0x0201) into two bytes, most significant first, giving \x02\x01, and B adds the single byte \x07. Little-endian would reverse the first two bytes, and padding is only added with native alignment.
Continue with GPYC: GIAC Python Coder
Unlock the full question bank
You have read the first 10 questions. A subscription opens every question in GPYC: GIAC Python Coder, the full timed practice test, and your progress and weak-topic reporting.
Single exam
$19.99for 30 days
Full question bank and practice test for one exam, for 30 days.
Single exam
$49.99for 1 year
One exam for a full year. Nothing renews and nothing to cancel.
Full access
$39.99/mo
Every exam in the catalogue, month to month.
Full access
$199.99/yr
Every exam in the catalogue for a year.
Already subscribed? Sign in to pick up where you left off.
Question #2
What is the output of the following code? import hashlib h = hashlib.sha1(b"test") print(len(h.digest()), len(h.hexdigest()))
Correct answer: A
Explanation
SHA-1 produces a 20-byte digest, so digest() returns 20 bytes. hexdigest() writes each byte as two hexadecimal characters, giving a 40-character string. The value 160 is the digest size in bits, not bytes.
Continue with GPYC: GIAC Python Coder
Unlock the full question bank
You have read the first 10 questions. A subscription opens every question in GPYC: GIAC Python Coder, the full timed practice test, and your progress and weak-topic reporting.
Single exam
$19.99for 30 days
Full question bank and practice test for one exam, for 30 days.
Single exam
$49.99for 1 year
One exam for a full year. Nothing renews and nothing to cancel.
Full access
$39.99/mo
Every exam in the catalogue, month to month.
Full access
$199.99/yr
Every exam in the catalogue for a year.
Already subscribed? Sign in to pick up where you left off.
Question #3
A script accepts a hostname from a user and must ping it once. Which call avoids shell command injection if host contains a value such as "8.8.8.8; cat /etc/passwd"?
Correct answer: C
Explanation
Passing an argument list without shell=True runs ping directly, so the whole value of host is delivered as one argument and the semicolon has no special meaning. The other calls hand a single string to a shell, which interprets the semicolon and runs the second command. An f-string does not sanitize input.
Continue with GPYC: GIAC Python Coder
Unlock the full question bank
You have read the first 10 questions. A subscription opens every question in GPYC: GIAC Python Coder, the full timed practice test, and your progress and weak-topic reporting.
Single exam
$19.99for 30 days
Full question bank and practice test for one exam, for 30 days.
Single exam
$49.99for 1 year
One exam for a full year. Nothing renews and nothing to cancel.
Full access
$39.99/mo
Every exam in the catalogue, month to month.
Full access
$199.99/yr
Every exam in the catalogue for a year.
Already subscribed? Sign in to pick up where you left off.
Question #4
What is the output of the following code? import re s = "<a><b><c>" print(len(re.findall(r"<.+>", s)), len(re.findall(r"<.+?>", s)))
Correct answer: B
Explanation
The pattern <.+> is greedy, so .+ consumes as much as possible and a single match spans the entire string. The pattern <.+?> is non-greedy and stops at the first closing bracket, producing three separate matches: <a>, <b> and <c>.
Continue with GPYC: GIAC Python Coder
Unlock the full question bank
You have read the first 10 questions. A subscription opens every question in GPYC: GIAC Python Coder, the full timed practice test, and your progress and weak-topic reporting.
Single exam
$19.99for 30 days
Full question bank and practice test for one exam, for 30 days.
Single exam
$49.99for 1 year
One exam for a full year. Nothing renews and nothing to cancel.
Full access
$39.99/mo
Every exam in the catalogue, month to month.
Full access
$199.99/yr
Every exam in the catalogue for a year.
Already subscribed? Sign in to pick up where you left off.
Question #5
What is the output of the following code in Python 3? data = b"AB" print(data[0], data[0:1])
Correct answer: D
Explanation
Indexing a bytes object returns an int, so data[0] is 65. Slicing returns a bytes object, so data[0:1] prints as b'A'. This difference is a common source of bugs when code written for Python 2 is ported.
Continue with GPYC: GIAC Python Coder
Unlock the full question bank
You have read the first 10 questions. A subscription opens every question in GPYC: GIAC Python Coder, the full timed practice test, and your progress and weak-topic reporting.
Single exam
$19.99for 30 days
Full question bank and practice test for one exam, for 30 days.
Single exam
$49.99for 1 year
One exam for a full year. Nothing renews and nothing to cancel.
Full access
$39.99/mo
Every exam in the catalogue, month to month.
Full access
$199.99/yr
Every exam in the catalogue for a year.
Already subscribed? Sign in to pick up where you left off.
Question #6
What is the output of the following code? import json rec = json.loads('{"port": 22, "open": true, "banner": null}') print(rec["open"], rec["banner"], type(rec["port"]).__name__)
Correct answer: C
Explanation
json.loads maps JSON true to Python True, null to None and a JSON number without a decimal point to int. Printing the objects shows the Python spellings, not the JSON ones.
Continue with GPYC: GIAC Python Coder
Unlock the full question bank
You have read the first 10 questions. A subscription opens every question in GPYC: GIAC Python Coder, the full timed practice test, and your progress and weak-topic reporting.
Single exam
$19.99for 30 days
Full question bank and practice test for one exam, for 30 days.
Single exam
$49.99for 1 year
One exam for a full year. Nothing renews and nothing to cancel.
Full access
$39.99/mo
Every exam in the catalogue, month to month.
Full access
$199.99/yr
Every exam in the catalogue for a year.
Already subscribed? Sign in to pick up where you left off.
Question #7
A port scanner calls s.connect_ex(("192.0.2.10", 443)) on a TCP socket. The target host is reachable but actively refuses the connection because nothing is listening on the port. What does the call do?
Correct answer: B
Explanation
connect_ex behaves like connect but reports failures from the underlying system call by returning the errno value instead of raising an exception. It returns 0 only when the connection succeeds, which makes it convenient for scanners.
Continue with GPYC: GIAC Python Coder
Unlock the full question bank
You have read the first 10 questions. A subscription opens every question in GPYC: GIAC Python Coder, the full timed practice test, and your progress and weak-topic reporting.
Single exam
$19.99for 30 days
Full question bank and practice test for one exam, for 30 days.
Single exam
$49.99for 1 year
One exam for a full year. Nothing renews and nothing to cancel.
Full access
$39.99/mo
Every exam in the catalogue, month to month.
Full access
$199.99/yr
Every exam in the catalogue for a year.
Already subscribed? Sign in to pick up where you left off.
Question #8
In Python 3, what does a call to sock.recv(1024) on a connected TCP socket return?
Correct answer: D
Explanation
recv() returns a bytes object, and the number is only a maximum. Fewer bytes may arrive in one call, so code must loop if it needs a full message. Decoding to str requires an explicit decode() call.
Continue with GPYC: GIAC Python Coder
Unlock the full question bank
You have read the first 10 questions. A subscription opens every question in GPYC: GIAC Python Coder, the full timed practice test, and your progress and weak-topic reporting.
Single exam
$19.99for 30 days
Full question bank and practice test for one exam, for 30 days.
Single exam
$49.99for 1 year
One exam for a full year. Nothing renews and nothing to cancel.
Full access
$39.99/mo
Every exam in the catalogue, month to month.
Full access
$199.99/yr
Every exam in the catalogue for a year.
Already subscribed? Sign in to pick up where you left off.
Question #9
What does len(hashlib.sha256(b"test").hexdigest()) return?
Correct answer: C
Explanation
SHA-256 produces a 256-bit digest, which is 32 bytes. hexdigest() writes each byte as two hexadecimal characters, giving 64 characters. 32 would be the length of digest(), and 256 is the size in bits.
Continue with GPYC: GIAC Python Coder
Unlock the full question bank
You have read the first 10 questions. A subscription opens every question in GPYC: GIAC Python Coder, the full timed practice test, and your progress and weak-topic reporting.
Single exam
$19.99for 30 days
Full question bank and practice test for one exam, for 30 days.
Single exam
$49.99for 1 year
One exam for a full year. Nothing renews and nothing to cancel.
Full access
$39.99/mo
Every exam in the catalogue, month to month.
Full access
$199.99/yr
Every exam in the catalogue for a year.
Already subscribed? Sign in to pick up where you left off.
Question #10
What is the output of the following code? counts = {"10.0.0.5": 7, "10.0.0.9": 12, "10.0.0.2": 7} top = sorted(counts.items(), key=lambda kv: kv[1], reverse=True)[0] print(top)
Correct answer: C
Explanation
items() yields (key, value) tuples, and the key function sorts them by the count in descending order. Index 0 is the whole tuple with the highest count, so it prints as a tuple. Only top[0] would give the bare address string.
Continue with GPYC: GIAC Python Coder
Unlock the full question bank
You have read the first 10 questions. A subscription opens every question in GPYC: GIAC Python Coder, the full timed practice test, and your progress and weak-topic reporting.
Single exam
$19.99for 30 days
Full question bank and practice test for one exam, for 30 days.
Single exam
$49.99for 1 year
One exam for a full year. Nothing renews and nothing to cancel.
Full access
$39.99/mo
Every exam in the catalogue, month to month.
Full access
$199.99/yr
Every exam in the catalogue for a year.
Already subscribed? Sign in to pick up where you left off.
Discussion
Explain your reasoning, not just the letterOther GIAC certifications
- GSEC: GIAC Security Essentials (opens in a new tab)
- GPEN: GIAC Penetration Tester (opens in a new tab)
- GCIH: GIAC Certified Incident Handler (opens in a new tab)
- GISF: GIAC Information Security Fundamentals (opens in a new tab)
- GEVA - GIAC Enterprise Vulnerability Assessor (opens in a new tab)
- GNFA - GIAC Network Forensic Analyst (opens in a new tab)
- GDSA - GIAC Defensible Security Architecture (opens in a new tab)
- GCFA: GIAC Certified Forensic Analyst (opens in a new tab)
- GICSP - Global Industrial Cyber Security Professional (opens in a new tab)
- GCIA: GIAC Certified Intrusion Analyst (opens in a new tab)
- GCED: GIAC Certified Enterprise Defender (opens in a new tab)
- GCPM: GIAC Certified Project Manager (opens in a new tab)
Reviews
Write a review★★★★★
Exam Practice is worth every penny. The mock exams are realistic, and the feedback helped me focus on key areas.
Amit SharmaVerified buyer
★★★★★
I highly recommend Exam Practice. The feedback after each test helped me improve significantly, and I passed my exams easily.
Oscar NyströmVerified buyer
★★★★★
This platform is a lifesaver. The practice questions and explanations are so detailed. It’s the best study tool I’ve ever used.
Hannah SmithVerified buyer
FAQ
Learn More: https://www.giac.org/
- Q1: What is the GPYC: GIAC Python Coder exam?
- A: GPYC: GIAC Python Coder is a GIAC certification exam. Judging by the questions in our bank, it concentrates on print, python, func, return and hello.
- Q2: What topics does the GPYC: GIAC Python Coder exam cover?
- A: Questions in our GPYC: GIAC Python Coder bank cluster around print, python, func, return, hello, giac, output and produce. Working through the full set is the quickest way to find which of these you are weakest on.
- Q3: How should I prepare for GPYC: GIAC Python Coder?
- A: Work through the GPYC: GIAC Python Coder practice questions here, checking your answer on each one, then sit the practice test to rehearse the exam under timed conditions before the real thing.
- Q4: Are these real GPYC: GIAC Python Coder exam questions?
- A: They are drawn from officially released past questions and from community members who have sat GPYC: GIAC Python Coder. Answers are verified and updated weekly.
- Q5: Where do I register for the GPYC: GIAC Python Coder exam?
- A: Register through GIAC directly at https://www.giac.org/. Exampractice is not affiliated with GIAC and does not administer the exam.
- Q6: Is there a free GPYC: GIAC Python Coder sample?
- A: Yes. Every GPYC: GIAC Python Coder page shows a free sample of real questions. Upgrading opens the full bank and the practice test.
- Q7: What are GIAC Certification Exams?
- A: GIAC (Global Information Assurance Certification) Exams validate your expertise in information security, cybersecurity, and IT risk management. These certifications demonstrate your proficiency in securing networks, systems, and data, and cover a wide range of specialized areas within cybersecurity.
- Q8: Why should I pursue GIAC Certification?
- A: GIAC Certification enhances your professional credibility, showcasing your skills and knowledge in cybersecurity. This can lead to better job opportunities, higher salaries, and career advancement in IT and cybersecurity industries.
- Q9: What are the benefits of GIAC Certification?
- A: Benefits include recognition as a certified cybersecurity professional, improved job performance, access to exclusive resources, continuing education opportunities, and staying current with the latest cybersecurity trends and best practices.
- Q10: Who should take GIAC Certification Exams?
- A: IT professionals, network administrators, security analysts, incident responders, penetration testers, and anyone involved in protecting and securing information systems should consider these certifications to validate their expertise and advance their careers.
- Q11: What types of GIAC Certification Exams are available?
- A: GIAC offers various certification paths, including:
- Q12: How do I prepare for GIAC Certification Exams?
- A: Preparation can include official GIAC training courses, study guides, practice exams, online tutorials, and hands-on experience in relevant cybersecurity practices.
- Q13: Where can I take GIAC Certification Exams?
- A: GIAC Certification Exams can be taken online with remote proctoring, providing flexibility to fit your schedule and location.
- Q14: How do GIAC Certifications impact my career?
- A: GIAC Certifications significantly boost your career by demonstrating your expertise to employers, making you a more competitive candidate for advanced roles and promotions in cybersecurity and IT.
- Q15: Are there any prerequisites for GIAC Certification Exams?
- A: Some exams may have prerequisites, such as foundational knowledge or prior experience in cybersecurity. Check the specific requirements for each certification path on the GIAC website.
- Q16: How often do I need to recertify for GIAC Certifications?
- A: GIAC Certifications typically require recertification every four years to ensure that certified professionals stay updated with the latest cybersecurity technologies and industry practices.



