Visit Official SkillCertPro Website :-
For a full set of 540 questions. Go to
https://skillcertpro.com/product/python-pcep-30-02-exam-questions/
SkillCertPro offers detailed explanations to each question which helps to understand the concepts better.
It is recommended to score above 85% in SkillCertPro exams before attempting a real exam.
SkillCertPro updates exam questions every 2 weeks.
You will get life time access and life time free updates
SkillCertPro assures 100% pass guarantee in first attempt.
Question 1:
How many at signs (@) will be printed after the following code snippet?
a = 0
while a <= 5:
a += 2
print(‘@‘)
A. 2
B. 4
C. 3
D. 1
Answer: C
Explanation:
1st iteration: a = 0, print @, a + 2 = 2
2nd iteration: a = 2, print @, a + 2 = 4
3rd iteration: a = 4, print @, a + 2 = 6
4th iteration: a = 6, condition not satisfied, so we terminate the loop
Question 2:
Which of the following statement(s) is/are true?
numbers = [1, 2, 3]
values = numbers
del values[1:2]
A. numbers is longer than values
B. numbers and values refer to two different lists
C. numbers and values are of the same length
D. numbers and values refer to the same list
Answer: C and D
Explanation:
When we assign values = numbers, both variables point to the same list object in memory.
The operation del values[1:2] removes the element at index 1 (which is 2) from the list.
Since numbers and values are references to the same list, both reflect the deletion.
Therefore, they remain the same length and point to the same object.
Correct answers: Option C and Option D
Question 3:
What do you call a file that contains instructions written in Python?
A. machine file
B. binary file
C. source file
D. target file
Answer: C
Explanation:
Correct:
C. source file A file that contains instructions written in a high-level programming language like Python is called a source file. This is the original, human-readable code written by a programmer, and it is the input for the Python interpreter.
Incorrect:
A. machine file A machine file contains instructions in machine code, which is a low-level language composed of binary digits (0s and 1s) that a computer‘s processor can execute directly. A Python source file must be interpreted before it can be executed.
B. binary file A binary file is a generic term for any file that is not a text file. It is a sequence of bytes and can contain any type of data, including images, audio, or compiled programs, but the term does not specifically refer to a human-readable program.
D. target file A target file is the output of a compiler or assembler. It contains the machine code that is ready to be executed. In the context of Python, this is not a standard term, as Python is an interpreted language.
Question 4:
What will be the output after the following code snippet?
val = true
if val is True:
print(‘True‘)
else:
print(‘False‘)
A. TRUE
B. FALSE
C. Python will show an error.
D. True
Answer: C
Explanation:
n Python, the boolean values are True and False, with the first letter capitalized.
Writing true (all lowercase) is invalid, and Python will raise a NameError because true is not defined.
Correct answer: Option C
Question 5:
What will be the output of the following code?
def func(x):
x = 4
return x + 5
func()
A. 5
B. 9
C. Python will show an error
D. 4
Answer: C
Explanation:
Python expects a single argument, but we provide none, so we get an error.
For a full set of 540 questions. Go to
https://skillcertpro.com/product/python-pcep-30-02-exam-questions/
SkillCertPro offers detailed explanations to each question which helps to understand the concepts better.
It is recommended to score above 85% in SkillCertPro exams before attempting a real exam.
SkillCertPro updates exam questions every 2 weeks.
You will get life time access and life time free updates
SkillCertPro assures 100% pass guarantee in first attempt.
Question 6:
Which of the following does the Python interpreter verify before executing Python code??
A. Alphabetic, lexical, analytical and syntactical corectness
B. Alphabetic, lexical, syntactical and semantic corectness
C. Alpahebetic, lexical, syntactical and infromal corectness
D. Binary, lexical, syntactical and semantic corectness
Answer: B
Explanation:
B. Alphabetic, lexical, syntactical and semantic corectness The Python interpreter performs a series of checks on the code before it can be executed. This process includes four key phases:
Alphabetic correctness: This is the most basic check, ensuring that the code only contains characters from the valid character set (e.g., Unicode).
Lexical correctness: The interpreter divides the code into a series of meaningful units called tokens (e.g., keywords, identifiers, literals, and operators).
Syntactical correctness: The interpreter checks that the tokens are arranged in a valid order, according to the rules of Python grammar. For example, it ensures that a function definition starts with def and ends with a colon.
Semantic correctness: The interpreter verifies that the program‘s statements make sense logically. This ensures that the code has meaning and can be executed. For example, it checks that a variable is defined before it is used.
Incorrect:
A. Alphabetic, lexical, analytical and syntactical corectness This is incorrect because “analytical correctness“ is not a standard term used to describe a phase of the interpreter‘s verification process.
C. Alphabetic, lexical, syntactical and informal corectness This is incorrect. “Informal correctness“ is not a recognized term in this context. The interpreter checks for formal, well-defined correctness.
D. Binary, lexical, syntactical and semantic corectness This is incorrect. The interpreter does not verify “binary correctness.“ Python code is written in a high-level language and is not in binary form. It is the compiler or interpreter‘s job to convert the code to binary, but that process happens after these checks.
Question 7:
What will be the output of the following program when the user enters the number 2?
val = int(input(‘Give me a number: ‘))
print(65 / val // 2)
A.Tuples in Python are sequences. Which of the following is a consequence of that?
B. Tuple elements must all have the same type.
C. Tuple elements can be modified.
D. Tuples can be indexed.
E. Tuple elements can be deleted.
Answer: C
Explanation:
Correct:
C. Tuples can be indexed. This is a direct consequence of tuples being a sequence type in Python. Sequence types, which also include strings and lists, are ordered collections of elements. Because they are ordered, you can access individual elements by their position, or index, using square bracket notation, e.g., my_tuple[0].
Incorrect:
A. Tuple elements must all have the same type. This is incorrect. Tuples are heterogeneous, meaning they can contain elements of different data types. For example, a tuple could contain an integer, a string, and a float, like (1, ‘hello‘, 3.14).
B. Tuple elements can be modified. This is incorrect. Tuples are immutable, which is the opposite of modifiable. Once a tuple is created, its elements cannot be changed, added, or removed.
D. Tuple elements can be deleted. This is incorrect. As a consequence of their immutability, elements cannot be deleted from a tuple. You can delete the entire tuple using the del keyword, but you cannot delete a single element.
Question 8:
What is the result of calculating 2 ** 2 ** 3 in Python?
A. 256
B. 64
C. 256
D. 64
Answer: A
Explanation:
The ** operator uses right-side binding, so it‘ll become: 2 ** (2 ** 3 ) = 2 ** 8 = 256
Question 9:
What will be the output of the following code?
y = {
‘nick‘: ‘Kate‘,
‘friends‘: [‘Anne‘, ‘John‘]
}
for f in y[‘friends‘]:
y[f] = f
print(y)
A.{‘nick‘: ‘Kate‘, ‘friends‘: [‘Anne‘, ‘John‘], ‘Anne‘: ‘Anne‘, ‘John‘: ‘John‘}
B. Python will show an error
C. {‘Anne‘: ‘Anne‘, ‘John‘: ‘John‘}
D. {‘nick‘: ‘Kate‘, ‘friends‘: [‘Anne‘, ‘John‘]}
Answer: A
Explanation:
For each element in the friends list, we add a new key to the dictionary. This new key will be the same as its value. In the end, we have the initial list plus two new entries, one for each friend.
Question 10:
What will be the output of the following code?
list1 = [‘one‘, ‘two‘, ‘three‘]
def changelist(my_list):
del my_list[1]
my_list[1] = ‘zero‘
changelist(list1)
print(list1)
A. [‘one‘, ‘zero‘, ‘three‘]
B. [‘one‘, ‘two‘, ‘three‘, ‘zero‘]
C. [‘one‘, ‘zero‘]
D. [‘one‘, ‘two‘, ‘three‘]
Answer: C
Explanation:
When passing lists to functions, we modify the actual lists (the concept of shadowing/local copies doesn‘t apply here). First, we delete the element with index 1 (i.e. the second element). We end up with [‘one‘, ‘three‘]. Then, we modify the second element to be equal to ‘zero‘. In the end, we get [‘one‘, ‘zero‘].
For a full set of 540 questions. Go to
https://skillcertpro.com/product/python-pcep-30-02-exam-questions/
SkillCertPro offers detailed explanations to each question which helps to understand the concepts better.
It is recommended to score above 85% in SkillCertPro exams before attempting a real exam.
SkillCertPro updates exam questions every 2 weeks.
You will get life time access and life time free updates
SkillCertPro assures 100% pass guarantee in first attempt.