NEW
Font size
WorksheetsPython Programming Basics - Multiple Choice Questions
Total questions: 31
Worksheet time: 16mins
Which term describes a memory location used to store data that can change while the program is running?
Operator
Variable
Function
Syntax
In Python, which data type is used to represent whole numbers without a fractional component?
String
Float
Integer
Boolean
Which of these words is a Python keyword used for defining a reusable block of code that performs a specific task?
Code
Subroutine
DEF
Return
What is the name for the ordered, mutable collection of items in Python, defined using square brackets?
String
List
Array
Program
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)?
Iteration
Sequence
Selection
Assignment
What is the process of finding and fixing mistakes or flaws in the code?
Concatenation
Debugging
Code
Compilation
Which Python function is used to convert a value into a decimal number?
INT()
STR()
FLOAT()
LEN()
What is the term for the part of a list or string that holds a specific value, accessed by its index?
Variable
Element
Argument
Parameter
Which type of Operator includes symbols like +, -, *, and /?
Logical
Relational
Arithmetic
Assignment
What is the control flow structure that involves repeating a block of code a certain number of times or until a condition is met?
Selection
Iteration
Sequence
Debugging
What is a String?
A number with a decimal point
A sequence of characters (e.g., text) enclosed in quotes
A whole number only
A true or false value
Which Python statement is used to display output on the screen for the user to see?
INPUT()
Return
LEN()
What is the term for combining two or more strings into a single longer string?
Arithmetic
Assignment
Concatenation
What data type can only hold the values True or False?
String
Float
Integer
Boolean
What is the correct term for the variable listed inside the parentheses of a function definition (def my_func(x, y):)?
Argument
Return
Parameter
Index
In the code score = 0, what is the = symbol called?
Comparison Operator
Logical Operator
Arithmetic Operator
Assignment Operator
What does the Python function LEN() do?
Converts a value to a string
Returns the number of items in an object (e.g., a string or list)
Reads user input from the keyboard
Rounds a number to the nearest integer
Which term describes the rules for how statements must be structured in a programming language to be valid?
Logic
Algorithm
Syntax
Debugging
The WHILE structure is a type of Iteration that repeats a block of code as long as a certain...?
Parameter is defined
Function is called
Variable is assigned
Condition is True
Which operator is used to check if two values are equal in Python, often used in an IF statement?
=
==
=>
!=
What is the term for a specific, ordered position of an element within a List or String, starting from 0?
Element
Input
Index
Argument
The use of IF and ELSE statements is an example of what core programming concept?
Conditional statements
Loops
Variables
Functions
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?
Library
Program
Module
IDE
Which term describes a step-by-step procedure or set of rules for solving a problem or completing a task?
Code
Algorithm
Debugging
Syntax
In Python, which function is used to convert an input value into an Integer data type?
STR()
INPUT()
INT()
LEN()
What is the Logical Operator that reverses a Boolean condition (changes True to False, and False to True)?
A. AND
B. OR
C. NOT
D. XOR
What is the primary role of a Comment in a program?
To execute a block of code repeatedly
To store a temporary value
To provide explanations and documentation for human programmers
To define a function's return value
Which List method is used to add a single new element to the end of an existing list?
LEN()
INSERT()
APPEND()
RETURN
What is the purpose of the ELIF statement in an IF selection structure?
To specify code that runs only if the initial IF condition is False
To run a code block a set number of times
To test an alternative condition only if the previous IF or ELIF conditions were False
To give a value to a variable
The Python INPUT() function always returns the data entered by the user as which data type by default?
Float
Integer
Boolean
String
What term describes an algorithm that solves a problem by systematically checking every single possible solution or combination until the correct one is found?
Recursion
Brute Force
Selection
Compilation
