Basic Flashcards
11 cards from real PCAP practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 11 Basic flashcards as text
What is the correct file extension for Python files?
Answer: .py
Python files have the extension .py
Which of the following is a correct syntax to output "Hello World" in Python?
Answer: print("Hello World")
In Python, the print function is used to output text to the console.
Which data type is used to store text in Python?
Answer: str
The str data type is used to store text in Python
How do you start a comment in Python?
Answer: B) #
In Python, comments are started with the # symbol.
Which of the following is a valid variable name in Python?
Answer: variable_ name
Variable names in Python must start with a letter or underscore and cannot contain spaces or hyphens.
What is the output of the following code?
Answer: 8
The ** operator in Python is used for exponentiation. 2 ** 3 equals 8.
Which of the following is used to define a function in Python?
Answer: def
The def keyword is used to define a function in Python.
What will be the output of the following code?
Answer: Hello World
The + operator concatenates strings in Python, and adding " " between x and y results in "Hello World".
Which of the following statements will correctly check if a variable a is equal to 10?
Answer: if a == 10:
The == operator is used to check equality, and the correct syntax for an if statement in Python ends with a colon.
How do you create a list in Python?
Answer: list = [1, 2, 3]
Lists in Python are created using square brackets, with elements separated by commas.
What does the following code print?
Answer: 12
The range(3) function generates numbers from 0 to 2, and the for loop prints each number in this range.
How this page was made: written with AI tools and published by Nathan Beja, founder of Practice Test Geeks, who is responsible for its content. Exam facts are checked against the official sources listed below. Not reviewed by a subject-matter expert. Editorial policy
Sources & references
Exam facts on this page (fees, format, dates, passing scores) are checked against these official sources; the date is our last check. Editorial policy
- pythoninstitute.org — Eligibility, fees, exam format, passing score, retake fee, retake policy, score release, time limit, score validity, exam information · verified Oct 2026
- home.pearsonvue.com — Test delivery · verified Oct 2026