PCEP · topic practice

Data Types, Variables, Basic I/O and Operators practice questions

Practise Certified Entry-Level Python Programmer PCEP Data Types, Variables, Basic I/O and Operators practice questions — original exam-style scenarios with answer choices, explanations, and analysis of common mistakes.

Courseiva uses original exam-style practice questions designed for learning and revision. The goal is to understand the concepts, recognise exam patterns, and improve through explanations — not memorise copied exam dumps.

Reviewed byJohnson Ajibi· MSc IT Security
20 questionsDomain: Data Types, Variables, Basic I/O and Operators

What the exam tests

What to know about Data Types, Variables, Basic I/O and Operators

Data Types, Variables, Basic I/O and Operators questions test whether you can apply the concept in context, not just recognise a definition.

How the topic appears in realistic exam-style scenarios.

Which detail in the question changes the correct answer.

How to eliminate plausible but wrong options.

How to connect the question back to the wider exam objective.

Watch out for

Common Data Types, Variables, Basic I/O and Operators exam traps

  • Answering from memory before reading the full scenario.
  • Missing a constraint such as cost, availability, security, scope or command context.
  • Choosing a broad answer when the question asks for the most specific fix.
  • Ignoring why the wrong options are tempting.

Practice set

Data Types, Variables, Basic I/O and Operators questions

20 questions · select your answer, then reveal the explanation

A developer writes the following code: x = 5; y = 2; print(x // y). What is the output?

A junior developer writes: x = 10; y = 3; print(x % y). What will be printed?

A developer needs to convert a string '25' to an integer and then add 10. Which code correctly performs this?

What is the correct way to read a floating-point number from user input and store it in a variable?

A developer wants to assign the value 3.14 to a variable and later change it to the integer 3. Which of the following is true?

Which of the following is a valid variable name in Python?

A developer writes: print(10 * '5'). What is the output?

What is the result of the expression: print(2 ** 3 ** 2) ?

A beginner writes: x = '10'; y = 20; print(x + y). What happens?

Question 10mediummultiple choice
Study the full Python automation breakdown →

Which operator is used to check if two values are equal in Python?

A developer writes: a = 3; b = 4; c = a + b / 2. What is the value of c?

Which TWO of the following are valid ways to create a variable with the integer value 100?

Which THREE of the following expressions evaluate to True?

Which TWO of the following are valid Python data types?

Which THREE of the following are correct uses of the print() function?

What is the output of the code?

Exhibit

Refer to the exhibit.

x = 7
y = 2
result = x / y
print(type(result))

A user enters 'Alice' for name and '30' for age. What is the output?

Exhibit

Refer to the exhibit.

name = input('Enter name: ')
age = input('Enter age: ')
print(name + ' is ' + age + ' years old.')

What is the data type of z?

Exhibit

Refer to the exhibit.

x = 10
y = 3.0
z = x * y
print(z)

You are a junior developer at a logistics company. Your team is building a system to calculate shipping costs based on package weight. The system reads weight from user input. A colleague wrote the following code: weight = input('Enter weight in kg: '); cost = weight * 2.5; print('Shipping cost:', cost). However, when testing with weight 10, the output is 'Shipping cost: 10101010101010101010' (the string '10' repeated 2.5 times? Actually, 2.5 is float, but string multiplied by float causes TypeError? Wait, string * float raises TypeError. But the symptom described suggests the code runs but produces unexpected output. Let me re-read: The output shows '10101010101010101010' which is the string '10' repeated 10 times? That would happen if weight is string and multiplied by int 10. But the code multiplies by 2.5. Actually, string * float raises TypeError, so the code would crash. The symptom must be plausible. Let me adjust: The code actually has weight = input(...), then cost = weight * 2.5, but if weight is '10', then '10' * 2.5 raises TypeError. So the symptom cannot be that output. I need to fix the stem to make sense. Instead, let's say the code is: weight = input('Enter weight: '); cost = float(weight) * 2.5; print('Cost:', cost). But then no issue. I'll create a scenario where the developer forgot to convert input to float, and then tries to multiply string by float, which causes TypeError. The correct action is to convert input to float. I'll adjust the stem accordingly. Let me rewrite the stem properly.

Stem: You are a developer at a shipping company. The system calculates shipping cost as weight (kg) times rate 2.5. A colleague wrote: weight = input('Enter weight: '); cost = weight * 2.5; print('Cost:', cost). When testing with weight 10, the program crashes with TypeError. Which action should you take to fix the code?

You are a data analyst at a retail company. You have a list of sales figures stored as strings in a list: sales = ['100', '200', '300']. You need to calculate the total sum. A colleague suggests using: total = sum(sales). However, this raises a TypeError because sum() requires numeric values. Which approach should you take to correctly calculate the total as an integer?

Free account

Track your progress over time

Create a free account to save your results and see which topics improve across sessions.

Focused Data Types, Variables, Basic I/O and Operators sessions

Start a Data Types, Variables, Basic I/O and Operators only practice session

Every question in these sessions is drawn from the Data Types, Variables, Basic I/O and Operators domain — nothing else.

Related practice questions

Related PCEP topic practice pages

Move into related areas when this topic feels solid.

Frequently asked questions

What does the PCEP exam test about Data Types, Variables, Basic I/O and Operators?
Data Types, Variables, Basic I/O and Operators questions test whether you can apply the concept in context, not just recognise a definition.
How should I use these practice questions?
Select your answer before revealing the explanation. Then read why each option is right or wrong — this active recall approach builds retention far faster than re-reading notes.
Can I practise just Data Types, Variables, Basic I/O and Operators questions in a focused session?
Yes — the session launcher on this page draws every question from the Data Types, Variables, Basic I/O and Operators domain. Use a 10-question session first to gauge your baseline, then move to 20 or 30 once the weak spots are clear.
Where can I practise other PCEP topics?
Use the topic links above to move to related areas, or go back to the PCEP question bank to see all topics.
Are these real exam questions or dumps?
These are original practice questions written to test the same concepts the PCEP exam covers. They are not copied from any real exam or dump site.