stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
Python Flashcards | StudBud
Explore
/
Python
Python
25 terms
·
StudBud Administration
·
40 plays
Imported from external platform
Flashcards
25 cards
F
Practice quiz
P
Host live
L
Questions
25
Answers
1
Identify the data type of the value
"Hello, World!".
string
float
boolean
integer
2
What is the correct syntax to declare a variable in Python?
variable = my_variable
my_variable = value
var my_variable
variable := my_variable
3
What is the data type of the value
["apple", "banana", "cherry"]
str
float
int
list
4
Which of the following is the correct way to comment a single line in Python?
<!-- This is a comment -->
/* This is a comment */
// This is a comment
# This is a comment
5
The elements of a tuple can be accessed using indices.
True
False
6
Which of the following statements is true regarding tuples in Python?
Tuples are enclosed in square brackets [ ]
Tuples can only contain items of the same data type
Tuples are mutable
(1, 2, 3) is not a valid tuple in Python
7
Determine the data type of the value
('apple', 'banana', 'cherry').
list
float
tuple
integer
8
Which of the following correctly initializes an empty dictionary in Python?
my_dict = dict()
my_dict = []
my_dict = {}
my_dict = {()}
9
Which symbol is used to enclose a list in Python?
[ ]
( )
< >
{ }
10
What does the print() function do in Python?
Prints output to the console
Reads input from the user
Performs mathematical operations
Declares variables
11
Determine the data type of the value
True
.
integer
string
float
boolean
12
Which function is used to take input from the user in Python?
input()
user_input()
get_input()
read_input()
13
Python is a case-sensitive language.
False
True
14
What is the data type of the value
42
in Python?
boolean
string
integer
float
15
What will the following code print?
TypeError: unsupported operand type(s) for +: 'int' and 'str
Hello5
SyntaxError: invalid syntax
5Hello
16
What is the correct way to check the type of a variable in Python?
variable.type()
type(variable)
typeOf(variable)
typeof(variable)
17
Which symbol is used to enclose a tuple in Python?
( )
< >
[ ]
{ }
18
Tuples are faster than lists in Python.
True
False
19
Python lists are mutable, meaning their elements can be changed after creation.
False
True
20
Which of the following is NOT a data type in Python?
float
integer
all the above are data types of python
boolean
21
Which of the following Python code snippets will correctly
print "Hello, World!"
?
Print("Hello, World!")
Print("Hello, World!")
print("Hello, World!")
print(Hello, World!)
22
Which of the following is a valid Python variable name?
$variable
variable_123
123_variable
my_variable
23
Which symbol is used to enclose a dictionary in Python?
[ ]
< >
{ }
( )
24
What is Python?
a hardware component
programming language
A software
a data structure
25
What is the data type of the value
3.14
?
float
string
boolean
integer