Question
Which of the following best describes the input() function?
Select one:
a.
Asks the user a question and returns a string answer
b.
Displays a multiple choice question and returns a letter answer
c.
Asks the user a question and returns a list of possible answers
d.
Asks the user a question and returns a numeric answer within a specific range
Select one:
a.
Asks the user a question and returns a string answer
b.
Displays a multiple choice question and returns a letter answer
c.
Asks the user a question and returns a list of possible answers
d.
Asks the user a question and returns a numeric answer within a specific range
Answers
Answer
How long will the input() function wait for user input?
Select one:
a.
For up to 1 minute
b.
For as long as you specify in the "timeout" parameter
c.
Forever, until the user enters a value and hits "Enter"
d.
For up to 10 seconds
Select one:
a.
For up to 1 minute
b.
For as long as you specify in the "timeout" parameter
c.
Forever, until the user enters a value and hits "Enter"
d.
For up to 10 seconds
Answer
Which of the following statements will ask the user for a favorite color and store the answer in the "color" variable?
Select one:
a.
print("What is your favorite color? ") = color
b.
color = input("What is your favorite color? ")
c.
input("What is your favorite color? ", color)
d.
input = color("What is your favorite color? ")
Select one:
a.
print("What is your favorite color? ") = color
b.
color = input("What is your favorite color? ")
c.
input("What is your favorite color? ", color)
d.
input = color("What is your favorite color? ")
Answer
What is wrong with the following code?
ageInYears = input("How old are you? ")
ageInDays = ageInYears * 365
Select one:
a.
* is not the correct symbol for multiplication
b.
ageInYears is a string and can't be used in a mathematical expression
c.
input() is missing a required timeout parameter
d.
The question inside the input() parentheses should not be surrounded by double quotes
ageInYears = input("How old are you? ")
ageInDays = ageInYears * 365
Select one:
a.
* is not the correct symbol for multiplication
b.
ageInYears is a string and can't be used in a mathematical expression
c.
input() is missing a required timeout parameter
d.
The question inside the input() parentheses should not be surrounded by double quotes
Answer
If the "heightString" variable contains the string "6.2", which of the following statements would convert that to a floating point value stored in a variable named "height"?
Select one:
a.
height = string(heightString)
b.
height = float(heightString)
c.
heightString = convert(height)
d.
height = int(heightString)
Select one:
a.
height = string(heightString)
b.
height = float(heightString)
c.
heightString = convert(height)
d.
height = int(heightString)
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.