Math Functions Quiz: Manipulating Floats
27 Questions
1 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

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</p> Signup and view all the answers

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

    <ul> <li>and /</li> </ul> Signup and view all the answers

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

    <p>float</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: '))</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</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?'))</p> Signup and view all the answers

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

    <p>Else if</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</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</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</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()</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+')</p> Signup and view all the answers

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

    <p>{}</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</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</p> Signup and view all the answers

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

    <p>Sunday</p> Signup and view all the answers

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

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

    What happens if the DVD is returned before 8 PM?

    <p>No charges apply</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</p> Signup and view all the answers

    Which code segment should go first?

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

    Which code segment should go second?

    <p>B p=2 while p&lt; 100 is_prime = True</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</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</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</p> Signup and view all the answers

    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
    Math Functions and Operations
    7 questions
    Use Quizgecko on...
    Browser
    Browser