stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
AGS-Python _grade10 Flashcards | StudBud
Explore
/
AGS-Python _grade10
AGS-Python _grade10
31 terms
·
StudBud Administration
·
36 plays
Imported from external platform
Flashcards
31 cards
F
Practice quiz
P
Host live
L
Questions
31
Answers
1
What is the purpose of the else block in an if statement?
a) It is used to handle exceptions.
d) It is a synonym for elif.
b) It executes when the if condition is false.
It is used to create a loop.
2
Which of the following is not a valid data type in Python?
b) float
c) double
a) int
d) str
3
In Python, what is an infinite loop?
d) A loop that has too many iterations
b) A loop that never starts c
c) A loop that executes only once
a) A loop that has no exit condition
4
What is the purpose of the range() function in Python loop control?
a) It generates a sequence of numbers that can be iterated over.
d) It checks if a loop condition is met.
b) It defines the starting value of a loop.
c) It calculates the sum of all numbers in a loop.
5
What is the output of the following code?
c) Loop completed.
d) Error
b) 0 1 2 Loop completed.
a) 0 1 2
6
How is an if statement terminated in Python?
a) With a semicolon (;)
c) With a colon (:)
b) With the endif keyword
d) With a double slash (//)
7
What does the print() function do in Python?
b) Perform mathematical operations
c) Display output on the console
a) Read user input
d) Define a variable
8
What is the output of the following code?
c) Nothing
a) Hello
b) HelloHelloHello...
d) Error
9
Which of the following is not a valid Python comparison operator?
d) <>
a) >=
b) <=
c) !=
10
.Which of the following is used to define a block of code in Python?
c) Semicolons
b) Parentheses
a) Indentation
d) Brackets
11
Which of the following is a valid Python comparison operator for checking equality?
d) <>
c) !=
a) =
b) ==
12
What is the output of the following code?
a) x is greater than 5
c) x is equal to 5
d) Error
b) x is not greater than 5
13
What is the output of 3 // 2 in Python?
1
1.5
1.0
2
14
What is the purpose of an if statement in Python?
b) To create a loop )
a) To define a function
c) To make a decision based on a condition
d) To define a class
15
Which statement is used to skip the rest of the current iteration and move to the next iteration in a loop?
b) break
c) continue
a) pass
16
Which logical operator checks if both conditions are true?
a) OR
c) AND
d) XOR
b) NOT
17
. Which loop is used to iterate over a sequence (such as a list, tuple, or string) in Python?
a) for loop
b) while loop
c) do-while loop
d) if loop
18
2.How do you terminate a loop prematurely in Python?
d) Terminate statement
b) Exit statement
a) Break statement
c) Halt statement
19
What is the output of the following code?
a) 0 1 2 3 4
c) 5 4 3 2 1
d) Error
b) 1 2 3 4 5
20
How do you comment a single-line comment in Python?
d) <!-- This is a comment
c) # This is a comment
a) /* This is a comment */
b) // This is a comment
21
.What is the Python keyword for creating a loop?
d) loop
c) if
a) repeat
b) for
22
.In Python, which keyword is used to check if a value is present in a list?
c) in
d) contains
b) present
a) exists
23
What is the result of the expression 3 + 5 * 2?
d) 11
c) 13
a) 16
b) 26
24
.What is the result of the expression True and False?
b) False
a) True
c) None
d) Error
25
Which loop type is better suited when you need to execute a block of code a fixed number of times?
c) do-while loop
b) while loop
a) for loop
26
.What is the purpose of the elif keyword in an if statement?
d) It is a synonym for else.
a) It indicates the end of the if statement.
b) It is used to create a loop.
c) It is used to check multiple conditions in sequence.
27
What is the output of the following code?
d) Nothing
a) x is greater than 5
c) x is equal to 5
b) x is less than 5
28
What will be the output of the code snippet len("Python")?
5
7
4
6
29
.How many times will a while loop execute if the condition is initially False?
a) Zero times
b) One time
c) Until an error occurs
d) Infinite
30
.What is the output of the following code?
a) 1 2 3 4 5
b) 1 2 4 5
c) 1 2 3
d) 3 4 5
31
In Python, what happens if you use an if statement without an else or elif block?
b) The program will terminate.
d) It will skip the if block.
a) It will result in a syntax error.
c) It will execute the code inside the if block and continue.