wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Call by Reference Vs Call by Value

Total questions: 30

Worksheet time: 15mins

Name
Class
Date
1.
How does Python pass primitive data types to a function?
a)
By reference
b)
By value
c)
By pointer
d)
By memory address
2.
What happens when an integer is passed to a function?
a)
The original value can be changed
b)
The value remains unchanged
c)
The value is deleted
d)
The value is multiplied
3.
What does "pass by reference" mean in Python?
a)
Copying the entire data
b)
Passing a reference to mutable data types
c)
Passing data by memory location
d)
Deleting the original data
4.
Which data types are passed by value in Python?
a)
Lists and dictionaries
b)
Tuples and strings
c)
Integers and booleans
d)
Sets and lists
5.
What is the purpose of the .copy() method?
a)
To delete a list
b)
To create a new copy of a list
c)
To modify a list
d)
To sort a list
6.
How can you check if two variables reference the same data?
a)
Using '=='
b)
Using 'is' operator
c)
Using 'type()'
d)
Using 'id()'
7.
What does the 'id()' function do in Python?
a)
Deletes a variable
b)
Generates a random number
c)
Provides a unique identifier for an object
d)
Counts list elements
8.
What is 'None' used to represent in Python?
a)
A zero value
b)
The absence of a value
c)
An empty list
d)
A boolean false
9.
How is 'None' different from other values?
a)
It can be changed
b)
It has multiple instances
c)
There's only one 'None'
d)
It's a complex data type
10.
What happens when you assign a variable to 'None'?
a)
The variable is deleted
b)
The variable exists but has no value
c)
The program crashes
d)
A random value is assigned
11.
Can you use 'is' to compare two variables with 'None'?
a)
Never
b)
Only with lists
c)
Yes
d)
Only with integers
12.
What is the data type of 'None'?
a)
Object type
b)
None type
c)
Value type
d)
Reference type
13.
How do you initially handle a variable that might not be assigned a value?
a)
Leave it undefined
b)
Assign it to zero
c)
Assign it to 'None'
d)
Delete it
14.
What distinguishes mutable from immutable data types in Python?
a)
Mutable types can be changed
b)
Immutable types can be modified
c)
Mutable types are always lists
d)
Immutable types are always integers
15.
When you pass a list to a function in Python
a)
The entire list is copied
b)
Only a reference is passed
c)
The list is deleted
d)
The list is encrypted
16.
What occurs when you modify a list inside a function?
a)
The original list remains unchanged
b)
The list is changed in the original scope
c)
A new list is created
d)
The function fails
17.
How can you prevent a list from being modified in a function?
a)
Use .copy()
b)
Use .deepcopy()
c)
Use .clone()
d)
Use .duplicate()
18.
What does the 'is' operator compare in Python?
a)
Values
b)
References
c)
Types
d)
Memory locations
19.
What represents the unique identifier of an object in Python?
a)
Memory address
b)
id() function result
c)
Variable name
d)
Data type
20.
Can two different lists with same elements be considered the same?
a)
Yes
b)
No
c)
Only if they're sorted
d)
Only if they're the same length
21.
Which of these is NOT a primitive data type in Python?
a)
List
b)
Integer
c)
String
d)
Boolean
22.
How does Python handle boolean data type passing?
a)
By reference
b)
By value
c)
By pointer
d)
By memory address
23.
What is the primary characteristic of immutable data types?
a)
They can be modified
b)
They cannot be changed
c)
They can be deleted
d)
They can be expanded
24.
In which scenario would you use 'None'?
a)
When you want to delete a variable
b)
When you want to set a default value
c)
When you want to create a list
d)
When you want to start a loop
25.
What happens if you don't assign an initial value to a variable?
a)
Python assigns zero
b)
Python assigns 'None'
c)
Python throws an error
d)
Python creates a default value
26.
Can you perform operations on a 'None' type?
a)
Yes
b)
No
c)
Only mathematical operations
d)
Only comparison operations
27.
What does passing by assignment mean in Python?
a)
Copying entire data
b)
Passing references based on data type
c)
Deleting original data
d)
Encrypting data
28.
How do you check if two variables reference the same object?
a)
Using '=='
b)
Using 'is'
c)
Using 'type()'
d)
Using 'isinstance()'
29.
What is unique about the 'None' object in Python?
a)
Multiple instances exist
b)
Only one instance exists
c)
It can be modified
d)
It changes value
30.
Which method creates a true independent copy of a list?
a)
.copy()
b)
.duplicate()
c)
.clone()
d)
.deepcopy()