Math Functions Quiz: Manipulating Floats

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

What is the data type of the variable 'name' in line 16?

  • str (correct)
  • int
  • bool
  • float

What would be the result of the expression 'int(a / b)' where a=11 and b=4?

  • 3 (correct)
  • 2.75
  • 2
  • 7

Why does the code at line 03 fail to find the rooms?

  • wrong function used
  • mismatched data types
  • invalid syntax
  • misnamed variable(s) (correct)

What does 'Brown = False' imply about the data type of 'Brown'?

<p>bool (B)</p> Signup and view all the answers

Which mathematical operation is performed first according to the order of operations (PEMDAS/BODMAS)?

<ul> <li>and / (A)</li> </ul> Signup and view all the answers

What would be the data type of 'ounce' in line 17?

<p>float (B)</p> Signup and view all the answers

What is the correct way to request the user to enter a numeric grade in Python?

<p>grade = int(input('Enter a numeric grade: ')) (B)</p> Signup and view all the answers

How should you escape an iteration through a list when a target product ID is found in Python?

<p>break (A)</p> Signup and view all the answers

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?

<p>totalItems = int(input('How many items would you like?')) (A)</p> Signup and view all the answers

In Python, what does the elif keyword stand for in conditional statements?

<p>Else if (A)</p> Signup and view all the answers

What do you need to troubleshoot in the program based on the provided text?

<p>Data types stored in the rooms list (A)</p> Signup and view all the answers

What is the purpose of using letter_grade variable in the provided code snippet?

<p>To store the student's letter grade (D)</p> Signup and view all the answers

To import the square root function as 'squareRoot' in Python, how should you write the import statement?

<p>from math import sq t as squareRoot (B)</p> Signup and view all the answers

What should you write at line 02 to accept user input and store it in a variable named 'name'?

<p>name = input() (C)</p> Signup and view all the answers

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?

<p>open('file.txt', 'w+') (C)</p> Signup and view all the answers

What is the correct way to create an empty dictionary in Python?

<p>{} (B)</p> Signup and view all the answers

What is the cost per night for renting a DVD from the ABC Video company?

<p>$1.59 (D)</p> Signup and view all the answers

If a customer returns the DVD after 8 PM, how will they be charged?

<p>An extra day's charge (D)</p> Signup and view all the answers

On which day does the customer get a 30% discount when renting a DVD?

<p>Sunday (A)</p> Signup and view all the answers

How much discount do customers get when renting on a Thursday?

<p>50% (C)</p> Signup and view all the answers

What happens if the DVD is returned before 8 PM?

<p>No charges apply (A)</p> Signup and view all the answers

How long do customers receive the discount for if they rent on a Sunday?

<p>For as long as they keep the video (A)</p> Signup and view all the answers

Which code segment should go first?

<p>A open(&quot;local_data&quot;, &quot; &quot;) (A)</p> Signup and view all the answers

Which code segment should go second?

<p>B p=2 while p&lt; 100 is_prime = True (A)</p> Signup and view all the answers

Which code segment should go third?

<p>A for I in range(2, p): if p% I = 0 is_prime = False (D)</p> Signup and view all the answers

Which code segment should go last?

<p>D for I in range(2, p): if p% I = 0 is_prime = False (D)</p> Signup and view all the answers

If a DVD is returned after 8 PM, how much extra does the customer get charged?

<p>$3.18 per night (B)</p> Signup and view all the answers

Flashcards are hidden until you start studying

More Like This

Math Solver Apps: Functions and Features
6 questions
Math Functions Chapter 1-3
10 questions
Relations and Functions in Math
7 questions
Use Quizgecko on...
Browser
Browser