
Practice
Authored by Sakxam Shrestha
Other
Vocational training
Used 3+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
11 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
1. Which of the following is a valid variable name in Python?
. Cannot start with numbers, symbols.
. Cannot be any keywords.
1variable
@var
my_var
for
Answer explanation
Variable in Python must start with a letter or underscore and cannot be keywords. my_var is valid, while the others violate these rules.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following Python code?
print(type(3.14))
int
float
str
bool
Answer explanation
3.14 is a floating-point number in Python, and its type is float.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
3. What will be the output of this code?
3. What will be the output of this code?
x = 5
y = 10
print(x + y)
50
15
error
5 + 10
Answer explanation
The + operator adds the two integers, 5 and 10, resulting in 15.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is the correct way to declare a variable in Python?
var x = 10
x == 10
x = 10
None of the above
Answer explanation
Python uses = for variable assignment without needing a type declaration like in some other languages.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is invalid?
_a = 1
__a = 1
__str__ = 1
none of the mentioned
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following variable names is not valid in Python?
a) my_var
b) _myvar
c) 2myvar
d) myVar2
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the result of this arithmetic operation in Python?
10 // 3
3.33
3
4
None of the above
Answer explanation
The // operator performs integer division, discarding the decimal part, so 10 // 3 results in 3.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?