GIAC Python Coder (GPYC) Exam Prep
Free practice questions

Free GPYC Practice Questions

10 exam-style questions with answers and explanations, straight from our 1,054-question bank. Tap an answer to check yourself. When you're ready, take the scored version in the free practice test.

Start the free practice test → ★★★★★4.9/5 from 2,400+ candidates · No signup

The GPYC exam has 75 questions and runs 2 hours.

These 10 free GPYC questions are organized by exam domain, so you can see how each part of the GIAC Python Coder (GPYC) blueprint is tested. Reveal the answer and explanation under each question.

Domain 1: Control Structures and Iteration

Question 1

What is the output of the following code? print(~100)

Show answer & explanation

Correct answer: C - -101

Question 2

A script contains the line: age = input('Enter your age: ') The user types 42 and presses Enter. What is the data type of age?

Show answer & explanation

Correct answer: B - str

Domain 2: Creation of Executables

Question 3

What is the output of the following code? data = [10, 20, 30, 40, 50] print(data[1:4])

Show answer & explanation

Correct answer: A - [20, 30, 40]

Question 4

What is the output of the following code? print(b'\x48\x49'.decode())

Show answer & explanation

Correct answer: D - HI

Domain 3: Data Analysis with Python

Question 5

What does the following code print? for n in [1, 2, 3]: if n == 5: break else: print('done')

Show answer & explanation

Correct answer: B - done

Domain 4: Data Structures

Question 6

What is the output of the following code? def add(item, lst=[]): lst.append(item) return lst print(add(1)) print(add(2))

Show answer & explanation

Correct answer: C - [1] then [1, 2]

Question 7

What does the following code print? def greet(name): print('Hello ' + name) result = greet('Sam') print(result)

Show answer & explanation

Correct answer: A - Hello Sam then None

Domain 5: Database Interaction

Question 8

What is the output of the following code? try: x = 10 / 2 except ZeroDivisionError: print('error') else: print('else') finally: print('finally')

Show answer & explanation

Correct answer: D - else then finally

Question 9

Which exception is raised by the following code? number = int('twelve')

Show answer & explanation

Correct answer: B - ValueError

Domain 6: Exception Handling

Question 10

In Python's re module, which function attempts to match a pattern ONLY at the beginning of the string?

Show answer & explanation

Correct answer: A - re.match()

The rest of the GPYC blueprint

The GPYC exam also covers these domains. Drill them in the full free practice test:

That's 10 of 1,054

The full bank has 1,044 more GPYC questions with explanations.

Continue in the free practice test →

View plans