










Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
PCEP – Certified Entry-Level Python Programmer Study Cards Flashcards & Exam Prep Guide 2026-17.docx
Typology: Exams
1 / 18
This page cannot be seen from the preview
Don't miss anything!











Alphabet - ✔✔a set of symbols used to build words of a certain language (e.g., the Latin alphabet for English, the Cyrillic alphabet for Russian, Kanji for Japanese, and so on) Lexis - ✔✔(aka a dictionary) a set of words the language offers its users (e.g., the word "computer" comes from the English language dictionary, while "cmoptrue" doesn't; the word "chat" is present both in English and French dictionaries, but their meanings are different) Syntax - ✔✔a set of rules (formal or informal, written or felt intuitively) used to determine if a certain string of words forms a valid sentence (e.g., "I am a python" is a syntactically correct phrase, while "I a python am" isn't) Semantics - ✔✔a set of rules determining if a certain phrase makes sense (e.g., "I ate a doughnut" makes sense, but "A doughnut ate me" doesn't) Source code - ✔✔A program written in a high-level programming language (in contrast to the machine code executed by computers) Source file - ✔✔the file containing the source code What compositions must a computer program have to make sense? - ✔✔A computer program must make sense: alphabetically - a program needs to be written in a recognizable script, such as Roman, Cyrillic, etc.
lexically - each programming language has its dictionary and you need to master it; thankfully, it's much simpler and smaller than the dictionary of any natural language; syntactically - each language has its rules and they must be obeyed; semantically - the program has to make sense. What are two different ways of transforming a program from a high-level programming language into machine language? - ✔✔Compilation and Interpretation What is compilation? - ✔✔The translation of source code into machine code. What is interpretation? - ✔✔you (or any user of the code) can translate the source program each time it has to be run; the program performing this kind of transformation is called an interpreter. How is source code stored and what requirements must it meet? - ✔✔Source code is stored in a computer file, typically a text file. The text file must be a pure text file without any decorations like different fonts, colors, embedded images or other media. Advantages to compilation? - ✔✔- the execution of the translated code is usually faster;
What is an interpreter? - ✔✔a computer program that directly executes instructions written in a programming language. A function is able to... - ✔✔cause some effect (e.g., send text to the terminal, create a file, draw an image, play a sound, etc.); this is something completely unheard of in the world of mathematics; evaluate a value (e.g., the square root of a value or the length of a given text) and return it as the function's result; this is what makes Python functions the relatives of mathematical concepts. Where do the functions come from? - ✔✔They may come from Python itself; the print function is one of this kind; such a function is an added value received together with Python and its environment (it is built-in) they may come from one or more of Python's add-ons named modules you can write them yourself, placing as many functions as you want and need inside your program to make it simpler, clearer and more elegant. A function name should be... - ✔✔Significant What are the steps in a function invocation? - ✔✔First, Python checks if the name specified is legal (it browses its internal data in order to find an existing function of the name; if this search fails, Python aborts the code); second, Python checks if the function's requirements for the number of arguments allows you to invoke the function in this way (e.g., if a specific function demands exactly two arguments, any invocation delivering only one argument will be considered erroneous, and will abort the code's execution);
third, Python leaves your code for a moment and jumps into the function you want to invoke; of course, it takes your argument(s) too and passes it/them to the function; fourth, the function executes its code, causes the desired effect (if any), evaluates the desired result(s) (if any) and finishes its task; finally, Python returns to your code (to the place just after the invocation) and resumes its execution. What is the effect the print() function causes? - ✔✔takes its arguments (it may accept more than one argument and may also accept less than one argument) converts them into human-readable form if needed (as you may suspect, strings don't require this action, as the string is already readable) and sends the resulting data to the output device (usually the console); in other words, anything you put into the print() function will appear on your screen. What arguments does print() expect? - ✔✔print() is able to operate with virtually all types of data offered by Python. Strings, numbers, characters, logical values, objects - any of these may be successfully passed to print(). What value does the print() function return? - ✔✔print() returns no value, it simply outputs data to the console. When used in a string the backslash( \ ) is called an... - ✔✔escape character
What does the keyword argument sep do? - ✔✔instead of a space to separate the outputted arguments, the space will be replaced with the defined separator provided. Example: Code: print("Monty", "Python.", sep="-") Output: Monty-Python True or False: Are you allowed to use more than 1 keyword argument? - ✔✔True. Example: Code: print("My", "name", "is", sep="_", end="") Output: My_name_is What is a literal? - ✔✔A literal is data whose values are determined by the literal itself. True or False: You cannot use literals to encode data and to put them into your code. - ✔✔False: You CAN use literals to encode data and to put them into your code Numbers handled by modern computers are of what two types? - ✔✔integers, that is, those which are devoid of the fractional part; and floating-point numbers (or simply floats), that contain (or are able to contain) the fractional part. The characteristic of the numeric value which determines its kind, range, and application, is called the... - ✔✔type
How can you represent the number eleven million one hundred and eleven thousand one hundred and eleven in Python as an integer? - ✔✔You can write this number either like this: 11111111, or like that: 11_111_111. How do we code negative numbers in Python? - ✔✔As usual - by adding a minus. You can write: -11111111, or -11_111_ True or False: Positive numbers do not need to be preceded by the plus sign.
You cannot change anything - you have to take those symbols as they are, including case-sensitivity. What will be the result of print(2+2)? - ✔✔ 4 What are the following symbols? What does each one mean and what Type of value is returned? + : - : * : / : // : % : ** - ✔✔These are arithmetic operators.
What is the hierarchy of priorities? - ✔✔It determines how operators will act. Ex. multiplications precede additions What does the binding of an operator determine? What kind of binding do most Python operators use? - ✔✔The binding of the operator determines the order of computations performed by some operators with equal priority, put side by side in one expression. Most of Python's operators have left-sided binding, which means that the calculation of the expression is conducted from left to right. What kind of binding does the exponentiation operator use? - ✔✔The exponentiation operator uses right-sided binding. In an expression, parenthesis can be used to... - ✔✔Change the natural order of operations and or improve readability. What are the rules you must follow when giving a variable a name? - ✔✔1) the name of the variable must be composed of upper-case or lower-case letters, digits, and the character _ (underscore)
What is the not equal operator? - ✔✔!= What priority do these operators have <, <=, >, >= - ✔✔ 5 What priority do these operators have ==, != - ✔✔ 6 What are the operators for less than, less than equal to. greater than, greater than equal to? - ✔✔<, <=, >, >= What kind of binding do <, <=, >, >=, == and != have? - ✔✔Left side binding. What is needed to create a conditional statement? - ✔✔- the if keyword; -one or more white spaces; -an expression (a question or an answer) whose value will be interpreted solely in terms of True (when its value is non-zero) and False (when it is equal to zero); -a colon followed by a newline; -an indented instruction or set of instructions How is indentation achieved in Python? Can combine the indentation methods? - ✔✔You can either use 4 spaces or a tab character. The indentation choice must be consistent all throughout, no mixing.
If the first condition of a conditional statement is not met, what keywords can you use to indicate a "Plan B"? - ✔✔else, elif What is the format of a while loop? - ✔✔while conditional_expression: instruction What does the range() function do? What is the 3rd argument used for? - ✔✔the range() function generates a sequence of integers. The range() function starts its job from 0 and finishes it one step (one integer number) before the value of its argument. A third argument will choose what to increment the list by. What does a control variable do when used in a for loop? - ✔✔it counts the loop's turns, and does it automatically; What does the "pass" keyword do? - ✔✔Nothing. It is simply an empty instruction. How many instructions are required in an if, while or for statement? - ✔✔At least 1. What does the "break" keyword do? - ✔✔Exits the loop it is in immediately. What does the "continue" keyword do? - ✔✔behaves as if the program has suddenly reached the end of the body Can you use an else statement on a loop (while, for)? - ✔✔Yes. What are these operators and what do they do? &, |, ~, ^ - ✔✔These are bitwise operators.
del numbers[1] Can you use negative indices on a list? - ✔✔Yes. An element with an index equal to -1 is the last one in the list. The element with an index equal to -2 is the one before last in the list. Essentially, a negative index results in index[len(list) + i] where i is your negative index. What is the difference between a method and a function? - ✔✔A method is owned by the data it works for, while a function is owned by the whole code. result = function(arg) vs. result = data.method(arg) What does the append() method do when called on a list? - ✔✔It takes its argument's value and puts it at the end of the list which owns the method. What does the insert() method do when called on a list? - ✔✔it can add a new element at any place in the list. It takes 2 arguments: list.insert(location, value) How can you swap 2 variables without using a third auxiliary variable? - ✔✔variable_1 = 1 variable_2 = 2 variable_1, variable_2 = variable_2, variable_ What does the sort() method do when called on a list? - ✔✔sort() will sort a list as quickly as possible. What does the reverse() method do when called on a list? - ✔✔reverse() will reverse all the values in a list.
How do you declare a list with a set length? - ✔✔list_1 = [x] where x is the length of the list. What is the slice element of Python syntax? What is it used for? - ✔✔: - A slice is an element of Python syntax that allows you to make a brand new copy of a list, or parts of a list. What is the equivalent statement for the following statements? list(10:), list(:10) and list(:) - ✔✔list(10:(len(list)-1)), list(0:10) and list(0:(len(list)-1)) Can slices be used in combination with the del keyword? - ✔✔Yes. You can specify slices of a list to delete: del my_list[1:3] What do the "in" and "not in" operators do? - ✔✔(in) checks if a given element (its left argument) is currently stored somewhere inside the list (the right argument) elem in my_list The second (not in) checks if a given element (its left argument) is absent in a list elem not in my_list Can you use a for loop in a list? - ✔✔Yes. row = [WHITE_PAWN for i in range(8)]