Alien head

Simple Python Quiz

Description: Simple Python Quiz
Number of Questions: 7
Created by:
Tags: python
Attempted 0/7 Correct 0 Score 0

numbers= [1,2,3,4] numbers.append([5,6,7,8]) print len(numbers)

  1. 4

  2. 5

  3. 8

  4. 12

  5. An exception is thrown


Correct Option: B

for i in range(2): print i for i in range(4,6): print i

  1. 2, 4, 6

  2. 0, 1, 2, 4, 5, 6

  3. 0, 1, 4, 5

  4. 0, 1, 4, 5, 6, 7, 8, 9

  5. 1, 2, 4, 5, 6


Correct Option: C

foo = {1:'1', 2:'2', 3:'3'} del foo[1] foo[1] = '10' del foo[2] print len(foo)

  1. 2

  2. 7

  3. 3

  4. 4

  5. An exception is thrown


Correct Option: A

Which of the following data structures can be used with the "in" operator to check if an item is in the data structure?

  1. List

  2. Set

  3. Dictionary

  4. None of the above

  5. All of the above


Correct Option: E

my_tuple = (1, 2, 3, 4) my_tuple.append( (5, 6, 7) ) print len(my_tuple)

  1. 1

  2. 6

  3. 4

  4. 5

  5. An exception is thrown


Correct Option: D

print type([1,2]).The output is:


Correct Option: D

names =['Amir', 'Barry', 'Chales', 'Dao'] print names [-1][-1] The output is:

  1. A

  2. r

  3. Amir

  4. Dao

  5. O


Correct Option: E
+ View questions