wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Programming Basics - Multiple Choice Questions

Total questions: 31

Worksheet time: 16mins

Name
Class
Date
1.

Which term describes a memory location used to store data that can change while the program is running?

a)

Operator

b)

Variable

c)

Function

d)

Syntax

2.

In Python, which data type is used to represent whole numbers without a fractional component?

a)

String

b)

Float

c)

Integer

d)

Boolean

3.

Which of these words is a Python keyword used for defining a reusable block of code that performs a specific task?

a)

Code

b)

Subroutine

c)

DEF

d)

Return

4.

What is the name for the ordered, mutable collection of items in Python, defined using square brackets?

a)

String

b)

List

c)

Array

d)

Program

5.

What kind of statement is executed when one of several different paths is chosen depending on a condition (e.g., using IF, ELIF, and ELSE)?

a)

Iteration

b)

Sequence

c)

Selection

d)

Assignment

6.

What is the process of finding and fixing mistakes or flaws in the code?

a)

Concatenation

b)

Debugging

c)

Code

d)

Compilation

7.

Which Python function is used to convert a value into a decimal number?

a)

INT()

b)

STR()

c)

FLOAT()

d)

LEN()

8.

What is the term for the part of a list or string that holds a specific value, accessed by its index?

a)

Variable

b)

Element

c)

Argument

d)

Parameter

9.

Which type of Operator includes symbols like +, -, *, and /?

a)

Logical

b)

Relational

c)

Arithmetic

d)

Assignment

10.

What is the control flow structure that involves repeating a block of code a certain number of times or until a condition is met?

a)

Selection

b)

Iteration

c)

Sequence

d)

Debugging

11.

What is a String?

a)

A number with a decimal point

b)

A sequence of characters (e.g., text) enclosed in quotes

c)

A whole number only

d)

A true or false value

12.

Which Python statement is used to display output on the screen for the user to see?

a)

INPUT()

b)

Print

c)

Return

d)

LEN()

13.

What is the term for combining two or more strings into a single longer string?

a)

Arithmetic

b)

Assignment

c)

Concatenation

14.

What data type can only hold the values True or False?

a)

String

b)

Float

c)

Integer

d)

Boolean

15.

What is the correct term for the variable listed inside the parentheses of a function definition (def my_func(x, y):)?

a)

Argument

b)

Return

c)

Parameter

d)

Index

16.

In the code score = 0, what is the = symbol called?

a)

Comparison Operator

b)

Logical Operator

c)

Arithmetic Operator

d)

Assignment Operator

17.

What does the Python function LEN() do?

a)

Converts a value to a string

b)

Returns the number of items in an object (e.g., a string or list)

c)

Reads user input from the keyboard

d)

Rounds a number to the nearest integer

18.

Which term describes the rules for how statements must be structured in a programming language to be valid?

a)

Logic

b)

Algorithm

c)

Syntax

d)

Debugging

19.

The WHILE structure is a type of Iteration that repeats a block of code as long as a certain...?

a)

Parameter is defined

b)

Function is called

c)

Variable is assigned

d)

Condition is True

20.

Which operator is used to check if two values are equal in Python, often used in an IF statement?

a)

=

b)

==

c)

=>

d)

!=

21.

What is the term for a specific, ordered position of an element within a List or String, starting from 0?

a)

Element

b)

Input

c)

Index

d)

Argument

22.

The use of IF and ELSE statements is an example of what core programming concept?

a)

Conditional statements

b)

Loops

c)

Variables

d)

Functions

23.

What is the name for a separate piece of pre-written code that you can import and use in your program, such as the RANDOM one?

a)

Library

b)

Program

c)

Module

d)

IDE

24.

Which term describes a step-by-step procedure or set of rules for solving a problem or completing a task?

a)

Code

b)

Algorithm

c)

Debugging

d)

Syntax

25.

In Python, which function is used to convert an input value into an Integer data type?

a)

STR()

b)

INPUT()

c)

INT()

d)

LEN()

26.

What is the Logical Operator that reverses a Boolean condition (changes True to False, and False to True)?

a)

A. AND

b)

B. OR

c)

C. NOT

d)

D. XOR

27.

What is the primary role of a Comment in a program?

a)

To execute a block of code repeatedly

b)

To store a temporary value

c)

To provide explanations and documentation for human programmers

d)

To define a function's return value

28.

Which List method is used to add a single new element to the end of an existing list?

a)

LEN()

b)

INSERT()

c)

APPEND()

d)

RETURN

29.

What is the purpose of the ELIF statement in an IF selection structure?

a)

To specify code that runs only if the initial IF condition is False

b)

To run a code block a set number of times

c)

To test an alternative condition only if the previous IF or ELIF conditions were False

d)

To give a value to a variable

30.

The Python INPUT() function always returns the data entered by the user as which data type by default?

a)

Float

b)

Integer

c)

Boolean

d)

String

31.

What term describes an algorithm that solves a problem by systematically checking every single possible solution or combination until the correct one is found?

a)

Recursion

b)

Brute Force

c)

Selection

d)

Compilation