WorksheetsPython11
Total questions: 17
Worksheet time: 9mins
What is the output of print(type(10)) in Python?
<class 'int'>
<class 'float'>
<class 'number'>
<class 'decimal'>
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.
What is the output of print('Hello' + ' World') in Python?
Hello
HelloWorld
Hello World
Error
Which symbol is used to start a comment in Python?
//
#
/*
;
Which of the following is a valid string in Python?
"Hello'
'Hello'
Hello
"Hello
What type of literal is 5.5 in Python?
What is the data type of the variable x in the statement x = '5'
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 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.
