





























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 Practice Questions Python Certified Entry-Level Programmer Exam Prep & Study Guide 2026-37.docx
Typology: Exams
1 / 37
This page cannot be seen from the preview
Don't miss anything!






























What will be the output of the following Python code? print("Hello") print() print("Dear") - ✔✔Hello Dear Select the correct output of the following Python statement: prin("Hello, World!") - ✔✔no output, an error is displayed on the console What is the correct output of the statement shown below: print("Today", "is", "a", "great", "day.") - ✔✔Today is a great day. Which operations have the highest precedence? (select all that apply) multiplication division subtraction addition - ✔✔-multiplication -division What will be the output of the following Python code? print("I like\nPython") - ✔✔I like Python
The 0x prefix means that a number is: - ✔✔hexadecimal The Python name comes from ________. - ✔✔Monty Python's Flying Circus Select the correct output of the Python code shown below: print("Python is\ngreat.") print("Python is\great.") - ✔✔Python is\ngreat. Python is\great. Select the correct output for the code snipped shown below. print("This", "code", "is", "being", end= " ") print("interpreted.") - ✔✔This code is being interpreted. Select the correct output for the code snipped shown below. print("This", "code", "is", "being", "interpreted.", sep= "#") - ✔✔This#code#is#being#interpreted. Select the correct statements regarding the following code snippet: print(4//3*2) A. The // and * operators use left-side binding B. The output of this statement is 2. C. The output of this statement is 0. D. The // and * operators use right-side binding - ✔✔A. The // and * operators use left-side binding B. The output of this statement is 2.
A tool which executes Python programs one statement at a time as each statement is read is called a/an ________. A. compiler B. debugger C. translator D. interpreter - ✔✔D. interpreter Select the correct output from the following Python statement: print(round(7.689, 2)) A. 7. B. 7. C. 7. D. 8 - ✔✔B. 7. What does the backslash ( \ ) mean when used in Python strings? Select all correct statements. A. The backslash does not have any impact on the code output B. The backslash tells the console to start a new output line C. The backslash is called the escape character D. The backslash is a hint to Python that the next character has a different meaning - ✔✔C. The backslash is called the escape character D. The backslash is a hint to Python that the next character has a different meaning
What is the result of the following addition operation: 123 + 0. A. cannot be evaluated B. Type error C. 123. D. 123 - ✔✔C. 123. An interpreter is a computer program that directly executes instructions written in a programming language one at a time without previously compiling them into a machine language program. (T/F) - ✔✔True Given a print operation with comma-separated arguments similar to the one provided here, select the correct statements from the choices provided below. print("This", "is", "a", "test") A. print() with more than one argument prints an error B. print() invoked with more than one argument outputs the arguments on separate lines C. print() invoked with more than one argument outputs the arguments all in one line D. print() puts a space between output arguments by default - ✔✔C. print() invoked with more than one argument outputs the arguments all in one line D. print() puts a space between output arguments by default Which of the following is a valid file extension for a Python source code file?
The number 6 is included in range(0, 15, 3) (T/F) - ✔✔True The 0x prefix indicates that a numeric literal is displayed in ________ format. A. abbreviated B. non-numeric C. hexadecimal D. extended - ✔✔C. hexadecimal The number 6 is included in range(1, 15, 3) (T/F) - ✔✔False The return value of the input function ________. A. is an integer B. is a string C. is a character D. depends on the context in which it is called - ✔✔B. is a string What is the output of the following snippet? firstName1 = "david" firstName2 = "bob" lastName1 = "smith" lastName2 = "smith" print(firstName1 == firstName2 or lastName1 == lastName2) - ✔✔True
What will be the output when the following snippet runs? x = 1y = False print(x or y) - ✔✔ 1 The escape character ________. A. increases the efficiency of the code B. prevents assignment of the literal to a variable C. causes Python code to be directly inserted from source code into memory D. changes the meaning of the character following it - ✔✔D. changes the meaning of the character following it A keyword may not be used as a variable name, but it may be used as a function name. (T/F) - ✔✔False What is the result of evaluating the following expression in Python? 2 ** 2 ** 3 - ✔✔ 256 What is the output of the following snippet? number = 5 if number in [ 1, 2, 3, 4, 5 ]: print("number is in range") - ✔✔number is in range What is the output of the following snippet? number = 5 if number in range(1, 5):
What is the output of the following code? not not 1 - ✔✔True What is the output of the following snippet? firstName1 = "david" firstName2 = "bob" lastName1 = "smith" lastName2 = "Smith" print(firstName1 == firstName2 or lastName1 == lastName2) - ✔✔False What is the output of the following snippet? firstName1 = "david" firstName2 = "bob" totalAge = 93 if (firstName1 == firstName2): print("if executed") elif (firstName1 == "david" and not(totalAge < 90 or totalAge > 100)): print("elif executed") else: print("else executed") - ✔✔elif executed Select the correct output that will be produced by the code snippet shown here: x = "7"
if x == 7: print("seven") elif x == "1": if int(x) > 1: print("two") elif int(x) < 1: print("three") else: print("four") if int(x) == 1: print("five") else: print("no match") - ✔✔no match Which one of the following statements is true? A. In Python, division precedes subtraction B. Neither of these statements are true C. In Python, subtraction precedes division - ✔✔A. In Python, division precedes subtraction What will be the output when the following snippet runs? x = 1 y = 0 print (x or y) print(x and y) - ✔✔ 1 0
The final value for x in the following snippet is equal to x = 1 x = x == x - ✔✔True The range() function can accept three arguments, where the third argument is an increment value. (T/F) - ✔✔True (Start, Stop, Step) Which of the following are the correct ways to create tuple? A. tuple=(2,4,6,8) B. tuple={2,4,6,8} C. tuple=[2,4,6,8] D. tuple=2,4,6,8 - ✔✔A. tuple=(2,4,6,8) D. tuple=2,4,6, What is the output of the following code: n = range(4) for num in n: print(num - 1) else: print(num) - ✔✔- 0 1 2
What is the output of the following snippet? languages = ["Python"] for language in ['Java', 'C++', 'C#']: languages.append(language) print(languages[languages.len()- 1]) - ✔✔AttributeError What is the output of the following code? tup=(8,16,22) tup.append(30) print(tup) - ✔✔AttributeError: 'tuple' object has no attribute 'append' What is the output of the following snippet? for n in range(2, 10):for x in range(2, n):if n % x == 0:print(n, 'equals', x, '*', n/x)break - ✔✔4 equals 2 * 2. 6 equals 2 * 3. 8 equals 2 * 4. 9 equals 3 * 3. What is the output of the following snippet? count = 0 while (count < 5): count *= 2 print(count) - ✔✔ 0 0
count = 1 while (count < 5): count *= 2 print(count) - ✔✔ 2 4 8 What is the output of the following code: for i in range(0, 6, 3): print(i) - ✔✔ 0 3 Which of the following statements are correct? (select two) A. When an else clause in a Python for loop executes it means that a break statement was encountered B. When an else clause in a Python for loop executes it means that a break statement was not encountered C. The else clause in a Python for loop executes if the loop does not execute completely D. The else clause in a Python for loop executes after the loop completes normally - ✔✔B. When an else clause in a Python for loop executes it means that a break statement was not encountered D. The else clause in a Python for loop executes after the loop completes normally Python lists are mutable. (T/F) - ✔✔True
What is the output of the following snippet? lst = [] del lst print(lst) - ✔✔NameError: name 'lst' is not defined What is the output of the following snippet? languages = ("Python") for language in ['Java', 'C++', 'C#']: languages.append(language) print(languages[len(languages)-1]) - ✔✔AttributeError What is the output of the following snippet? a = 3 b = 1 c = 2 lst = [a, c, b] lst.sort() print(lst) - ✔✔[1, 2, 3] What is the output of the following snippet? lst = [1, 2, 3, 4, 5] lst.insert(1, 6) del lst[0] lst.append(1) print(lst) - ✔✔[6, 2, 3, 4, 5, 1]
Tuples are a type of sequence list, this means that A. they can be modified using the del instruction B. they can be indexed and sliced like lists C. they are actually lists D. they can be extended using the .append() method - ✔✔B. they can be indexed and sliced like lists What is the output of the following snippet: lst = [1, [2, 3], 4] print(lst[1]) print(len(lst)) - ✔✔[2, 3] 3 The range() function can accept three arguments, where the third argument is an increment value. (T/F) - ✔✔True A tuple is an immutable sequence type in Python. (T/F) - ✔✔True What is the output of the following snippet? for n in range(2, 10): for x in range(2, n): if n % x == 0: print( n, 'equals', x, '*', n/x)breakelse:
print(n, 'is a prime number') - ✔✔2 is a prime number 3 is a prime number 4 equals 2 * 2.
5 is a prime number 6 equals 2 * 3. 7 is a prime number 8 equals 2 * 4. 9 equals 3 * 3. This Python statement: if name == "main": is known as a ________. A. syntax error B. global variable check C. global scope check D. top level scope check - ✔✔D. top level scope check A ________ function is a function which calls itself. - ✔✔recursive A function defined in the following way: (select two) def function(x = 0): return x A. must be invoked with exactly one argument B. may be invoked without any argument C. may be invoked with exactly one argument D. must be invoked without any argument - ✔✔B. may be invoked without any argument C. may be invoked with exactly one argument