27 Questions
What is the data type of the variable 'name' in line 16?
str
What would be the result of the expression 'int(a / b)' where a=11 and b=4?
3
Why does the code at line 03 fail to find the rooms?
misnamed variable(s)
What does 'Brown = False' imply about the data type of 'Brown'?
bool
Which mathematical operation is performed first according to the order of operations (PEMDAS/BODMAS)?
- and /
What would be the data type of 'ounce' in line 17?
float
What is the correct way to request the user to enter a numeric grade in Python?
grade = int(input('Enter a numeric grade: '))
How should you escape an iteration through a list when a target product ID is found in Python?
break
Which code segment should be used if you need the user's input to be treated as a whole number in Python, even if they enter a decimal value?
totalItems = int(input('How many items would you like?'))
In Python, what does the elif
keyword stand for in conditional statements?
Else if
What do you need to troubleshoot in the program based on the provided text?
Data types stored in the rooms list
What is the purpose of using letter_grade
variable in the provided code snippet?
To store the student's letter grade
To import the square root function as 'squareRoot' in Python, how should you write the import statement?
from math import sq t as squareRoot
What should you write at line 02 to accept user input and store it in a variable named 'name'?
name = input()
In Python, to read and write data to a text file, including creating the file if it does not exist and clearing its content if it does exist, what code should you use?
open('file.txt', 'w+')
What is the correct way to create an empty dictionary in Python?
{}
What is the cost per night for renting a DVD from the ABC Video company?
$1.59
If a customer returns the DVD after 8 PM, how will they be charged?
An extra day's charge
On which day does the customer get a 30% discount when renting a DVD?
Sunday
How much discount do customers get when renting on a Thursday?
50%
What happens if the DVD is returned before 8 PM?
No charges apply
How long do customers receive the discount for if they rent on a Sunday?
For as long as they keep the video
Which code segment should go first?
A open("local_data", " ")
Which code segment should go second?
B p=2 while p< 100 is_prime = True
Which code segment should go third?
A for I in range(2, p): if p% I = 0 is_prime = False
Which code segment should go last?
D for I in range(2, p): if p% I = 0 is_prime = False
If a DVD is returned after 8 PM, how much extra does the customer get charged?
$3.18 per night
Test your knowledge on math functions for manipulating floats. Identify the correct functions to take the absolute value and remove decimal points after the integer. Choose two correct answers out of the given options.
Make Your Own Quizzes and Flashcards
Convert your notes into interactive study material.
Get started for free