11. What does the following function return: len(['A','B',1]) ?

  • 3
  • 2
  • 4

12. What does the following function return: len([sum([0,0,1])]) ?

  • 1
  • 0
  • 3

13. What is the value of list L after the following code segment is run :

L=[1,3,2]

sorted(L)

  • L:[1,3,2]
  • L:[1,2,3]
  • L:[0,0,0]

14. From the video what is the value of c after the following:

c=add1(2)

c=add1(10)

  • 3
  • 11
  • 14

15. what is the output of the following lines of code:

def Print(A):

for a in A:

print(a+'1')

Print(['a','b','c'])

  • a

    b

    c

  • a1

    b1

    c1

  • a1

16. Why do we use exception handlers?

  • Read a file
  • Terminate a program
  • Write a file
  • Catch errors within a program

17. What is the purpose of a try…except statement?

  • Only executes if one condition is true
  • Crash a program when errors occur
  • Catch and handle exceptions when an error occurs
  • Executes the code block only if a certain condition exists

18. What is the type of the following?

["a"]

  • str
  • list

Shuffle Q/A 2

19. What does a method do to an object?

  • Changes or interacts with the object
  • Returns a new values

20. We create the object: Circle(3,'blue') What is the color attribute set to?

  • 2
  • ‘blue’

Leave a Reply