• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Python Data Type

Question 1

Which of these is not a core data type?
  • Lists
  • Dictionary
  • Tuples
  • Class

Question 2

What data type is the object below ? L = [1, 23, ‘hello’, 1]
  • List
  • Dictionary
  • Tuple
  • Array

Question 3

Which of the following function convert a string to a float in python?
  • int(x [,base])
  • long(x [,base] )
  • float(x)
  • str(x)

Question 4

Question 1: Find the output of the following program: Python3
nameList = [\'Harsh\', \'Pratik\', \'Bob\', \'Dhruv\'] 

pos = nameList.index(\"GeeksforGeeks\") 

print (pos * 3)
  • GeeksforGeeks GeeksforGeeks GeeksforGeeks
  • Harsh
  • Harsh Harsh Harsh
  • ValueError: \'GeeksforGeeks\' is not in list

Question 5

Question 1:Find the output of the following program: Python3
D = dict() 
for x in enumerate(range(2)): 
	D[x[0]] = x[1] 
	D[x[1]+7] = x[0] 
print(D) 
  • {0: 1, 7: 0, 1: 1, 8: 0}
  • {1: 1, 7: 2, 0: 1, 8: 1}
  • {0: 0, 7: 0, 1: 1, 8: 1}
  • KeyError

Question 6

Question 6:Find the output of the following program: Python3
a = {i: i * i for i in range(6)} 
print (a) 
  • Dictionary comprehension doesn’t exist
  • {0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6:36}
  • {0: 0, 1: 1, 4: 4, 9: 9, 16: 16, 25: 25}
  • {0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25}

Question 7

Which of the following statement(s) is TRUE?

  1. A hash function takes a message of arbitrary length and generates a fixed length code.
  2. A hash function takes a message of fixed length and generates a code of variable length.
  3. A hash function may give the same hash value for distinct messages.
  • I only

  • II and III only

  • I and III only

  • II only

There are 7 questions to complete.

Last Updated :
Take a part in the ongoing discussion