PYTHON PROGRAMMING CERTIFICATION –QUESTIONS AND CORRECT ANSWERS (VERIFIED ANSWERS) PLUS RA, Exams of Computer Programming

PYTHON PROGRAMMING CERTIFICATION –QUESTIONS AND CORRECT ANSWERS (VERIFIED ANSWERS) PLUS RATIONALES 2026 Q&A | INSTANT DOWNLOAD PDF.

Typology: Exams

2025/2026

Available from 05/22/2026

linus-macharia-2
linus-macharia-2 🇺🇸

754 documents

1 / 63

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
PYTHON PROGRAMMING CERTIFICATION –QUESTIONS AND CORRECT
ANSWERS (VERIFIED ANSWERS) PLUS RATIONALES 2026 Q&A | INSTANT
DOWNLOAD PDF.
SECTION ONE: QUESTIONS 1–100
CORE DOMAINS
*Python Syntax and Fundamentals*
*Data Structures and Algorithms*
*Object-Oriented Programming (OOP)*
*Exception Handling and Debugging*
*Libraries and Frameworks*
*Security and Compliance*
*Professional Ethics and Data Privacy*
*File I/O and System Operations*
INTRODUCTION
*The purpose of this Python Programming Certification exam is to validate the techn
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f

Partial preview of the text

Download PYTHON PROGRAMMING CERTIFICATION –QUESTIONS AND CORRECT ANSWERS (VERIFIED ANSWERS) PLUS RA and more Exams Computer Programming in PDF only on Docsity!

PYTHON PROGRAMMING CERTIFICATION –QUESTIONS AND CORRECT

ANSWERS (VERIFIED ANSWERS) PLUS RATIONALES 2026 Q&A | INSTANT

DOWNLOAD PDF.

SECTION ONE: QUESTIONS 1–

 

CORE DOMAINS

Python Syntax and Fundamentals Data Structures and Algorithms Object-Oriented Programming (OOP) Exception Handling and Debugging Libraries and Frameworks Security and Compliance Professional Ethics and Data Privacy File I/O and System Operations

INTRODUCTION

*The purpose of this Python Programming Certification exam is to validate the techn

  1. What is the output of print(type(1/2)) in Python 3? A. 🟢 B. C. D. 🔴 RATIONALE: In Python 3, the division operator / always returns a float, even if the result is a whole number.
  2. Which PEP 8 guideline is recommended for variable naming? A. CamelCase 🟢 B. snake_case C. SCREAMING_SNAKE_CASE D. PascalCase 🔴 RATIONALE: PEP 8 recommends snake_case for functions and variables.
  3. How do you handle a generic exception in Python? A. except Error: B. except Exception: 🟢 C. except: D. except catch: 🔴 RATIONALE: An empty except clause catches all exceptions, although it is generally discouraged for specific error handling.
  1. How do you declare a private variable in a class? A. Using a single underscore prefix 🟢 B. Using a double underscore prefix C. Using the private keyword D. Using the # prefix 🔴 RATIONALE: A double underscore prefix triggers name mangling, which is the standard way to indicate private class members.
  2. What is the difference between == and is? A. No difference B. == checks type, is checks value 🟢 C. == checks equality, is checks identity D. == checks identity, is checks equality 🔴 RATIONALE: == compares values (equality), while is compares object identity (memory address).
  3. Which module is standard for handling CSV files? A. data B. json 🟢 C. csv D. file 🔴 RATIONALE: The csv module implements classes to read and write tabular data in CSV format.
  1. What is a generator in Python? A. A function that returns a list 🟢 B. A function that returns an iterator via yield C. A class that generates random numbers D. A specific type of class method 🔴 RATIONALE: A generator uses the yield keyword to return values one at a time, pausing execution between calls.
  2. What is the effect of the GIL (Global Interpreter Lock)? A. It prevents multiple Python processes B. It makes code run faster 🟢 C. It allows only one thread to execute Python bytecode at once D. It manages memory automatically 🔴 RATIONALE: The GIL is a mutex that prevents multiple threads from executing Python bytecodes at once, limiting concurrency in CPU-bound tasks.
  3. Which method is used to remove an item from a list by index? A. remove() B. delete() 🟢 C. pop() D. clear() 🔴 RATIONALE: pop() removes and returns an item at a given index.

B. dict 🟢 C. str D. set 🔴 RATIONALE: Strings in Python are immutable; once created, they cannot be changed.

  1. How do you start a docstring? A. # B. // 🟢 C. """ D. ''' 🔴 RATIONALE: Triple quotes are the standard convention for multi-line docstrings in Python.
  2. What is the use of the init method? A. To define a constant B. To handle exceptions 🟢 C. To initialize an object's state D. To delete an object 🔴 RATIONALE: init is the constructor method in Python classes, used to initialize new objects.
  3. Which function gets the current time? A. time.now()

🟢 B. time.time() C. time.get() D. time.current() 🔴 RATIONALE: time.time() returns the current time in seconds since the Epoch.

  1. What is a decorator? A. A design pattern B. A way to change variable scope 🟢 C. A function that modifies the behavior of another function D. A specific class structure 🔴 RATIONALE: A decorator is a function that takes another function and extends its behavior without modifying it explicitly.
  2. Which library is best for data manipulation? A. Flask 🟢 B. pandas C. requests D. sys 🔴 RATIONALE: Pandas is the industry standard library for data manipulation and analysis.
  3. When should you use a set? A. When you need ordered data B. When you need duplicate items

C. os.files() D. os.dir() 🔴 RATIONALE: os.listdir() returns a list containing the names of the entries in the directory.

  1. What is a lambda function? A. A function with no arguments 🟢 B. An anonymous function C. A function with multiple return values D. A function that uses recursion 🔴 RATIONALE: Lambda functions are small, anonymous functions defined with the lambda keyword.
  2. Which of the following handles HTTP requests? A. math 🟢 B. requests C. os D. re 🔴 RATIONALE: The requests library is the de facto standard for making HTTP requests in Python.
  3. What is a list comprehension? A. A way to create a dictionary B. A function to filter a list

🟢 C. A concise way to create lists D. A method to sort a list 🔴 RATIONALE: List comprehensions provide a concise way to create lists based on existing iterables.

  1. How do you delete an object in Python? A. delete obj B. obj.delete() 🟢 C. del obj D. obj.remove() 🔴 RATIONALE: The del statement is used to remove an object reference.
  2. What is the result of 5 // 2? A. 2. 🟢 B. 2 C. 3 D. 2. 🔴 RATIONALE: // is the floor division operator in Python.
  3. Which exception is raised if a key is missing in a dictionary? A. IndexError 🟢 B. KeyError C. AttributeError D. ValueError

🔴 RATIONALE: pass is a null statement used when syntax requires a statement but no action is needed.

  1. Which library is used for regex? A. string 🟢 B. re C. regex D. text 🔴 RATIONALE: The re module provides support for regular expressions in Python.
  2. How do you define a class in Python? A. class MyClass: B. def MyClass(): C. class MyClass(): 🟢 D. Both A and C are acceptable 🔴 RATIONALE: While class MyClass: is standard, class MyClass(): is also valid syntax (though brackets are usually omitted for new-style classes).
  3. What is an iterator? A. A data structure 🟢 B. An object that enables traversal of a container C. A loop construct D. A type of function

🔴 RATIONALE: An iterator is an object that implements the iterator protocol, consisting of the iter() and next() methods.

  1. Which of these is a valid way to create a dictionary? A. {1, 2, 3} 🟢 B. {'a': 1, 'b': 2} C. [1, 2, 3] D. (1, 2, 3) 🔴 RATIONALE: Dictionaries are created using curly braces with key-value pairs separated by colons.
  2. What does the 'break' statement do? A. Skips the current iteration 🟢 B. Exits the loop C. Exits the program D. Raises an error 🔴 RATIONALE: break terminates the innermost loop.
  3. What does the 'continue' statement do? A. Terminates the loop 🟢 B. Skips the current iteration C. Repeats the loop D. Pauses execution

D. setup install 🔴 RATIONALE: pip is the standard package manager for Python.

  1. Which of the following is true about lists? A. They are immutable B. They store unique elements 🟢 C. They are ordered and mutable D. They use curly braces 🔴 RATIONALE: Lists are mutable, ordered sequences, defined with square brackets.
  2. How do you find the length of a string? A. s.length() 🟢 B. len(s) C. s.size() D. s.count() 🔴 RATIONALE: len() is the built-in function used to get the size of sequences.
  3. What is virtualenv used for? A. Writing code 🟢 B. Isolating project dependencies C. Debugging D. Documentation

🔴 RATIONALE: Virtual environments isolate Python project dependencies to prevent version conflicts.

  1. What is the difference between shallow and deep copy? A. No difference 🟢 B. Shallow copies references, deep copies objects C. Shallow copies objects, deep copies references D. Only deep copy works for lists 🔴 RATIONALE: A shallow copy creates a new object but references the original elements, while a deep copy recursively duplicates everything.
  2. How do you import a module? A. use module B. require module 🟢 C. import module D. load module 🔴 RATIONALE: import is the standard keyword to bring a module into the current namespace.
  3. What is the result of 2 3? A. 6 🟢 B. 8 C. 5
  1. Which of the following represents a boolean in Python? A. True B. False 🟢 C. Both A and B D. 1 🔴 RATIONALE: Python booleans are defined as True and False.
  2. How do you concatenate strings? A. s1.add(s2) 🟢 B. s1 + s C. s1.append(s2) D. s1.join(s2) 🔴 RATIONALE: The + operator is the standard way to concatenate strings.
  3. What is a docstring? A. A comment 🟢 B. A string literal occurring as the first statement in a module, function, class, or method definition C. A type of documentation file D. A print statement 🔴 RATIONALE: Docstrings are used to document the purpose and behavior of code blocks.
  1. Which of the following is thread-safe? A. list B. dict 🟢 C. queue.Queue D. int 🔴 RATIONALE: The queue.Queue module provides synchronized, thread-safe queues.
  2. What is the purpose of the 'self' parameter? A. To access global variables 🟢 B. To refer to the current instance of the class C. To access the parent class D. To define a static method 🔴 RATIONALE: self represents the instance on which the method is called.
  3. How do you create an empty dictionary? A. dict = [] 🟢 B. dict = {} C. dict = () D. dict = set() 🔴 RATIONALE: {} creates an empty dictionary.
  4. What is the output of bool(0)? A. True