WorksheetsPython Fundamentals for Grade 9 Students
Total questions: 10
Worksheet time: 5mins
What is the output of 'print(5 + 3)' in Python?
8
7
2
10
Explain the difference between '==' and 'is' in Python.
'==' compares values, 'is' compares types.
'==' compares values, 'is' compares memory addresses.
'==' compares memory addresses, 'is' compares values.
'==' compares memory addresses, 'is' compares types.
What data type is 'True' in Python?
list
integer
string
boolean
How do you write an if-else statement in Python?
if condition: code_block_for_false_condition else: code_block_for_true_condition
if condition: code_block_for_true_condition else: code_block_for_false_condition
if condition: code_block_for_true_condition
if condition: code_block_for_true_condition else: code_block_for_false_condition
What is the purpose of a 'for' loop in Python?
To iterate over a sequence and execute a block of code for each item in the sequence.
To perform mathematical calculations
To define classes and objects
To create conditional statements
Define a function in Python that takes two parameters and returns their sum.
def sum_two_numbers(a, b): return a + b
def add_numbers(a, b): return a + b
def calculate_sum(a, b): return a + b
def sum(a, b): return a + b
How do you take user input in Python?
get_input() method
user_input() function
read_input() function
input() function
Explain the concept of a list in Python.
A list in Python is a data structure that holds an unordered collection of items.
A list in Python is a data structure that holds an ordered collection of items. It is denoted by square brackets [] and can contain elements of different data types. Lists are mutable, meaning their elements can be changed after creation.
A list in Python is denoted by curly brackets {}.
Lists in Python can only contain elements of the same data type.
What is a dictionary in Python and how is it different from a list?
A dictionary in Python is a collection of key-value pairs, where each key is unique. It is different from a list in that lists are ordered collections of items accessed by index, while dictionaries are ordered collections accessed by keys.
A dictionary in Python is a collection of key-value pairs, where each key is unique. It is different from a list in that lists are unordered collections of items accessed by index, while dictionaries are ordered collections accessed by keys.
A dictionary in Python is a collection of key-value pairs, where each key is unique. It is different from a list in that lists are ordered collections of items accessed by index, while dictionaries are unordered collections accessed by keys.
A dictionary in Python is a collection of key-value pairs, where each key is unique. It is different from a list in that lists are ordered collections of items accessed by index, while dictionaries are ordered collections accessed by values.
What are the fundamentals of programming that every Python programmer should know?
Operators, memory management, recursion, error handling
Syntax, algorithms, debugging, testing
Loops, classes, inheritance, libraries
Variables, data types, control structures, functions, basic input/output operations
