Data Type

1
Question 1
Which of these is not a core data type?
A
Lists
B
Dictionary
C
Tuples
D
Class
Data Type    
Discuss it


Question 1 Explanation: 
Class is a user defined data type
Question 2
What data type is the object below ? L = [1, 23, ‘hello’, 1]
A
List
B
Dictionary
C
Tuple
D
Array
Data Type    
Discuss it


Question 2 Explanation: 
[ ] defines a list
Question 3
Which of the following function convert a string to a float in python?
A
int(x [,base])
B
long(x [,base] )
C
float(x)
D
str(x)
Data Type    
Discuss it


Question 3 Explanation: 
float(x) − Converts x to a floating-point number
Question 4
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.
 
A
I only
B
II and III only
C
I and III only
D
II only
Hash    GATE IT 2006    Data Type    
Discuss it


Question 4 Explanation: 
  Hash function is defined as any function that can be used to map data of arbitrary size of data to a fixed size data.. The values returned by a hash function are called hash values, hash codes, digests, or simply hashes  :  Statement 1 is correct Yes, it is possible that a Hash Function maps a value to a same location in the memmory that's why collision occurs and we have different technique to handle  this problem : Statement 3 is coorect. eg : we have hash function, h(x) = x mod 3 Acc to Statement 1, no matter what the value of 'x' is h(x) results in a fixed mapping location. Acc. to Statement 3, h(x) can result in same mapping mapping location for different value of 'x' e.g. if x = 4 or x = 7 , h(x) = 1 in both the cases, although collision occurs.   This solution is contributed by Mohit Gupta.
There are 4 questions to complete.
1

Company Wise Coding Practice    Topic Wise Coding Practice