Which of the following is true about primary memory in a computer system?
Which of the following is NOT a data storage device?
1 Crore+ students have signed up on EduRev. Have you? Download the App |
Which of the following indexing techniques is commonly used for fast searching in a database?
What is the purpose of indexing in a database management system?
In a hash table, collisions can occur when two different keys hash to the same:
my_list = [1, 2, 3, 4, 5]
print(my_list[3])
What will be the output of the above code?
my_dict = {'name': 'John', 'age': 25}
print(my_dict.get('gender'))
What will be the output of the above code?
my_set = {1, 2, 3, 4, 5}
my_set.add(3)
print(len(my_set))
What will be the output of the above code?
my_tuple = (1, 2, 3)
print(my_tuple[1:])
What will be the output of the above code?
my_string = "Hello, World!"
print(my_string.lower())
What will be the output of the above code?
employees = [
{'name': 'John', 'age': 25, 'department': 'Sales'},
{'name': 'Emma', 'age': 30, 'department': 'HR'},
{'name': 'Mike', 'age': 35, 'department': 'IT'}
]
department_names = [employee['department'] for employee in employees]
department_set = set(department_names)
print(len(department_set))
What will be the output of the above code?
def hash_function(key):
return key % 5
hash_table = [[] for _ in range(5)]
keys = [15, 7, 22, 3, 12]
for key in keys:
index = hash_function(key)
hash_table[index].append(key)
print(hash_table)
What will be the output of the above code?
class Student:
def __init__(self, name, roll_number):
self.name = name
self.roll_number = roll_number
students = [Student('John', 1), Student('Emma', 2), Student('Mike', 3)]
student_dict = {student.roll_number: student for student in students}
print(student_dict[2].name)
What will be the output of the above code?
class Database:
def __init__(self):
self.data = []
def insert(self, value):
self.data.append(value)
def search(self, value):
return value in self.data
db = Database()
db.insert(10)
db.insert(20)
db.insert(30)
print(db.search(20))
What will be the output of the above code?
import hashlib
def hash_string(s):
return hashlib.md5(s.encode()).hexdigest()
hash_table = [[] for _ in range(5)]
keys = ['apple', 'banana', 'cherry', 'date']
for key in keys:
index = int(hash_string(key), 16) % 5
hash_table[index].append(key)
print(hash_table)
What will be the output of the above code?
75 videos|44 docs
|
75 videos|44 docs
|