Unitechtransfer-german Centre For Automation And Robotics,Germany

13 Questions | Total Attempts: 310

SettingsSettingsSettings
German Quizzes & Trivia

Python Quiz-2


Questions and Answers
  • 1. 
    What is the output of print list[2:] if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]?
  • 2. 
    Which function capitalizes first letter of string?
  • 3. 
    Which function merges elements in a sequence?
  • 4. 
    What is round(6.5)?
  • 5. 
    __________ approach is to implement one function in the structure chart at a time from the top to the bottom.
  • 6. 
    Python supports the creation of anonymous functions at runtime, using a construct called __________?
  • 7. 
    What is the output of this program?
    1. y = 6
    2.  
    3. z = lambda x: x * y
    4. print z(8)
  • 8. 
    What is the output of below program?
    1. def writer():
    2. title = 'Sir'
    3. name = (lambda x:title + ' ' + x)
    4. return name
    5.  
    6. who = writer()
    7. who('Arthur')
  • 9. 
    What is the output of the following? print('abcdef'.partition('cd'))
  • 10. 
    What will be the output?
    1. >>>m = [[x, x + 1, x + 2] for x in range(0, 3)]
  • 11. 
    What is the output of the following?def foo(i, x=[]): x.append(x.append(i)) return x for i in range(3): y = foo(i) print(y)
    • A. 

      [[[0]], [[[0]], [1]], [[[0]], [[[0]], [1]], [2]]]

    • B. 

      [[0], [[0], 1], [[0], [[0], 1], 2]]

    • C. 

      [[0], None, [1], None, [2], None]

    • D. 

      [[[0]], [[[0]], [1]], [[[0]], [[[0]], [1]], [2]]]

  • 12. 
    Which function overloads the // operator?
  • 13. 
    What will be the output?
    1. d = {"john":40, "peter":45}
    2. print(list(d.keys()))
    • A. 

      [“john”, “peter”]

    • B. 

      [“john”:40, “peter”:45]

    • C. 

      (“john”, “peter”)

    • D. 

      (“john”:40, “peter”:45)

Back to Top Back to top