# What will be the output of the following Python code snippet total={} def insert(items): if items in total: total[items] += 1 else: total[items] = 1 insert('Apple') insert('Ball') insert('Apple') print (len(total))

1.  3

2.  1

3.  2

4.  0

4

2

Explanation :
No Explanation available for this question

# What will be the output of the following Python code snippet a = {} a[1] = 1 a['1'] = 2 a[1]=a[1]+1 count = 0 for i in a: count += a[i] print(count)

1.  1

2.  2

3.  4

4.  Error, the keys can’t be a mixture of letters and numbers

4

4

Explanation :
No Explanation available for this question

# What will be the output of the following Python code snippet numbers = {} letters = {} comb = {} numbers[1] = 56 numbers[3] = 7 letters[4] = 'B' comb['Numbers'] = numbers comb['Letters'] = letters print(comb)

1.  Error, dictionary in a dictionary can’t exist

2.  ‘Numbers’: {1: 56, 3: 7}

3.  {‘Numbers’: {1: 56}, ‘Letters’: {4: ‘B’}}

4.  {‘Numbers’: {1: 56, 3: 7}, ‘Letters’: {4: ‘B’}}

4

{‘Numbers’: {1: 56, 3: 7}, ‘Letters’: {4: ‘B’}}

Explanation :
No Explanation available for this question

# What will be the output of the following Python code snippet test = {1:'A', 2:'B', 3:'C'} test = {} print(len(test))

1.  0

2.  None

3.  3

4.  An exception is thrown

4

0

Explanation :
No Explanation available for this question

# What will be the output of the following Python code snippet test = {1:'A', 2:'B', 3:'C'} del test[1] test[1] = 'D' del test[2] print(len(test))

1.  0

2.  2

3.  Error as the key-value pair of 1:’A’ is already deleted

4.  1

4

2

Explanation :
No Explanation available for this question

# What will be the output of the following Python function len(["hello",2, 4, 6])

1.  4

2.  3

3.  error

4.  6

4

4

Explanation :
No Explanation available for this question

# What will be the output of the following Python function oct(7) oct(‘7’)

1.  Error07

2.  0o7Error

3.  0o7Error

4.  070o7

4

0o7
Error

Explanation :
No Explanation available for this question

# The following Python code is invalid. class demo(dict): def __test__(self,key): return [] a = demo() a['test'] = 7 print(a)

1.  True

2.  False

2

False

Explanation :
No Explanation available for this question

# What will be the output of the following Python code count={} count[(1,2,4)] = 5 count[(4,2,1)] = 7 count[(1,2)] = 6 count[(4,2,1)] = 2 tot = 0 for i in count: tot=tot+count[i] print(len(count)+tot)

1.  25

2.  17

3.  16

4.  Tuples can’t be made keys of a dictionary

4

16

Explanation :
No Explanation available for this question

# What will be the output of the following Python code a={} a[2]=1 a[1]=[2,3,4] print(a[1][1])

1.  [2,3,4]

2.  2

3.  3

4.  An exception is thrown

4