24 Questions
What grade will a student receive if their mark is 80?
B
Which of the following variable names is correctly formatted?
user_name
In Python, which loop is used to repeat a block of code as long as a certain condition is true?
While loop
What will be the output of the following code snippet? num = 5 numstr = '5' print(num + int(numstr))
10
What will be the output of the following code snippet? num = 1 while num < 15: num += 1 print(num)
Prints numbers from 1 to 14
Which code format follows the best practice for variable naming?
x_y_z
Which grade will a student receive if their mark is 55?
D
What is the purpose of using formatted output in Python?
To create a custom string by combining text and values
What will be printed by the first program provided in the text?
i and j are equal: 0 0 i and j are equal: 1 1 i and j are equal: 2 2 i and j are not equal: 2 2
What is the sum printed by the second program provided in the text?
sum = 48
Which of the following is NOT a comparison operator in Python?
<>
What is the purpose of variable 'sum' in the second program provided?
To store the sum of range values
What grade will a student receive if their mark is 50?
D
In Python, what is the purpose of a while loop?
To repeat a block of code as long as a certain condition is true
What will be the output of the given 'while' loop statement: while num < 15: num += 1
if the initial value of 'num' is 10?
14
If a nested conditional statement inside a for loop is false, what happens?
The program skips the iteration and moves to the next one
What will be the output of the following code snippet? age = 3.75 age_int = int(age) print(age_int)
3
Which of the following conversions is NOT done correctly according to the provided text?
int('hello')
In Python, what is the result when trying to add a numeric value to a string value directly?
An error occurs
What is the correct way to repeat a block of code in Python as long as a certain condition is true?
Using 'while' loops
What will be the output of the code snippet below?
name = input('Enter name: ') print(nane)
It will result in an error because 'nane' is misspelled
What will be the value of 'result' in the following code snippet?
num = 5 numstr = '5' result = num + int(numstr) print(result)
10
What will be printed by the following code snippet?
x = 1 while x < 5: x += 1 print(x)
1 2 3 4 5
What happened when executing the code snippet:
str(5) + '5'
?
'55'
Learn how to determine and print out a grade based on specific criteria depending on the student's mark. Explore the different grade classifications from 'A' to 'F'.
Make Your Own Quizzes and Flashcards
Convert your notes into interactive study material.
Get started for free