python for data science ai & development coursera week 1 quiz answers

Practice Quiz

1. What is the type of the following: 0

  • Int
  • float

2. What is the type of the following number: 3.12323

  • Int
  • Float

3. What is the result of the following: int(3.99)

  • 3
  • 3.99

4. What is the result of the following operation: 11//2

  • 5
  • 5.5

5. What is the value of x after the following is run:

x=4

x=x/2

  • 4.0
  • 2.0

6. What is the result of the following: Name[0]

  • “i”
  • “n”
  • “M”

7. What is the result of the following: Name[-1]

  • “n”
  • “o”
  • “M”

8. What is the output of the following: print("AB\nC\nDE")

  • AB

    C

    DE

  • ABC

    DE

  • AB

    CD

    E

9. What is the result of following?

"hello Mike".find("Mike")

If you are unsure, copy and paste the code into Jupyter Notebook and check.

  • 6
  • 6,7,8
  • 5

Module 1 Graded Quiz

10. What is the value of x after the following lines of code?

x=2

x=x+2

  • 4
  • 2

11. What is the result of the following operation 3+2*2 ?

  • 3
  • 7
  • 9

12. What is the result of the following code segment: type(int(12.3))

  • float
  • str
  • int

13. What is the result of the following code segment: int(True)

  • 1
  • 0
  • error

14. In Python, what is the result of the following operation: '1'+'2' ?

  • 3
  • ‘3’
  • ’12’

15. Given myvar = 'hello' , how would you return myvar as uppercase?

  • len(myvar)
  • myvar.find(‘hello’)
  • myvar.upper()

16. What is the result of the following : str(1+1) ?

  • ‘2’
  • ’11’

17. What is the result of the following: "ABC".replace("AB", "ab") ?

  • ‘abC’
  • ‘ABc’

18. In Python 3, what is the type of the variable x after the following: x=1/1 ?

  • float
  • int

Leave a Reply