WorksheetsPython Test10
Total questions: 27
Worksheet time: 14mins
Which of the following is not a Python keyword?
pass
eval
assert
lambda
What is the output of print(type(10)) in Python?
<class 'int'>
<class 'float'>
<class 'number'>
<class 'decimal'>
What does the following code print: print(5 // 2)?
2
2.5
3
Error
Which of the following is a correct statement about Python indentation?
Indentation is optional.
Indentation is used to define blocks of code.
Indentation can be mixed (tabs and spaces).
Python ignores indentation.
Which of the following is not a valid Python variable name?
my_var
_myvar
2myvar
myvar2
Which of the following operators in Python is used for exponentiation?
^
**
*
%
Which symbol is used to start a comment in Python?
//
#
/*
;
What is the output of print('Hello' + ' World') in Python?
Hello
HelloWorld
Hello World
Error
Which of the following is a valid string in Python?
"Hello'
'Hello'
Hello
"Hello
What does the 'is' operator check in Python?
If two variables point to the same object in memory
If two variables have the same value
If a value is not null
If a variable exists
What is the result of 3 % 2 in Python?
What type of literal is 5.5 in Python?
What is the output of the following: print(2 ** 3)?
Which of the following can be used as a variable name in Python?
for
1_var
_myvar
if
What is the data type of the variable x in the statement x = '5'
Which of the following is a membership operator in Python?
is
==
Which of the following statements is correct regarding Python?
Python is case-insensitive.
Python is case-sensitive.
Python uses semicolons to end statements.
Python is compiled, not interpreted.
What will the following code print: print('10' + '5')?
10 5
10 50
What is the return type of the input() function in Python?
What will the following code print if the user enters 25
age = input("Enter your age: ")
print(type(age))
<class 'int'>
<class 'str'>
<class 'float'>
Error
Which of the following is the correct syntax to get an integer input from a user?
age = input(int("Enter your age: "))
age = int(input("Enter your age: "))
age = int("Enter your age: ")
input = int("age")
What happens if you call input() without any arguments?
It raises an error.
It waits for user input without any message.
It provides a default prompt message.
It returns None.
What is bytecode in Python?
Where does Python store the compiled bytecode files?
In the same directory as the source code, with a .pyc extension.
In a temporary directory with a .byte extension.
In the system's memory.
It doesn't store bytecode files.
What is the function of the Python Virtual Machine (PVM)?
To interpret and execute the bytecode.
To compile the Python source code.
To generate bytecode.
To handle memory management during code execution.
What role does the Python garbage collector play in the code lifecycle?
It compiles the code to bytecode.
It manages memory allocation and deallocation during program execution.
It converts the bytecode into machine code.
It optimizes code during compilation.
Which of the following statements is true about the print() function in Python?
print() can only print string data types.
print() can print any data type.
print() only works with numeric data types.
print() requires at least one argument.
