stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
Python01 - Variables Flashcards | StudBud
Explore
/
Python01 - Variables
Python01 - Variables
20 terms
·
StudBud Administration
Imported from external platform
Flashcards
20 cards
F
Practice quiz
P
Host live
L
Questions
20
Answers
1
Which of the following formatting characters is used for an integer?
%f
%d
%i
%s
2
What symbol is used to start a comment in Python?
/*
#
//
<!--
3
Which module is used to track execution time in Python?
time
os
datetime
sys
4
Which operator is used to multiply values in Python?
+
/
**
*
5
What is the output of the following code?
2.5
2
1
2.0
6
What is the correct way to calculate the area of a circle with radius r using the math module in Python?
area = math.pi * r
area = math.pi * r * r
area = pi * r * r
area = 3.14 * r * r
7
What is the purpose of the math.pi constant in Python?
To get the square root of a number
To represent infinity
To represent the value of Pi (3.14159…)
To calculate exponents
8
What is the correct way to import a module in Python?
use module
load module
import module
include module
9
Which symbol is used for string concatenation in Python?
.
&
+
,
10
What does \n represent in Python strings?
Tab
n
New line
Backslash
11
Which function prints output to the console in Python?
write()
display()
print()
show()
12
Which function can you use to convert a string to lowercase in Python?
to_lowercase()
downcase()
string.lowercase()
lower()
13
Which Python function is used to get the cosine of a value?
cos()
cosine()
math.cosine()
math.cos()
14
Which of the following operations can be used to find the remainder of a division in Python?
*
**
//
%
15
How can you assign the value of 100 to a variable x in Python?
x == 100
x -> 100
x = 100
100 = x
16
Which of the following is a valid float in Python?
10.5
10
"10.5"
10f
17
What type of values can be stored in a Python variable?
All of the above
Lists
Numbers
Strings
18
What does the following code do?
Reads input and stores it as a float
Prints a value
Reads input and stores it as a string
Reads input and stores it as an integer
19
Which of the following is NOT a valid mathematical operator in Python?
+
//
-
@@
20
Which of the following is a valid Python variable name?
3variable
variable-name
_variable3
variable#3