Data Structures QP
Data Structures QP
Assignment Questions
Data Types and Structures Questions
What are data structures, and why are they important
Explain the difference between mutable and immutable data types with examples
What are the main differences between lists and tuples in Python
Describe how dictionaries store data
Why might you use a set instead of a list in Python
What is a string in Python, and how is it different from a list
How do tuples ensure data integrity in Python
What is a hash table, and how does it relate to dictionaries in Python
Can lists contain different data types in Python
Explain why strings are immutable in Python
What advantages do dictionaries offer over lists for certain tasks
Describe a scenario where using a tuple would be preferable over a list
How do sets handle duplicate values in Python
How does the “in” keyword work differently for lists and dictionaries
Can you modify the elements of a tuple? Explain why or why not
What is a nested dictionary, and give an example of its use case
Describe the time complexity of accessing elements in a dictionary
In what situations are lists preferred over dictionaries
Why are dictionaries considered unordered, and how does that affect data retrieval
Explain the difference between a list and a dictionary in terms of data retrieval.
Practical Questions
Write a code to create a string with your name and print it
Write a code to find the length of the string "Hello World"
Write a code to slice the first 3 characters from the string "Python Programming"
Write a code to convert the string "hello" to uppercase
Write a code to replace the word "apple" with "orange" in the string "I like apple"
Write a code to create a list with numbers 1 to 5 and print it
Write a code to append the number 10 to the list [1, 2, 3, 4]
Write a code to remove the number 3 from the list [1, 2, 3, 4, 5]
Write a code to access the second element in the list ['a', 'b', 'c', 'd']
Write a code to reverse the list [10, 20, 30, 40, 50].
Java
Pwskills
+ DSA
11. Write a code to create a tuple with the elements 10, 20, 30 and print it.
12. Write a code to access the first element of the tuple ('apple', 'banana', 'cherry').
13. Write a code to count how many times the number 2 appears in the tuple (1, 2, 3, 2, 4, 2).
14. Write a code to find the index of the element "cat" in the tuple ('dog', 'cat', 'rabbit').
15. Write a code to check if the element "banana" is in the tuple ('apple', 'orange', 'banana').
16. Write a code to create a set with the elements 1, 2, 3, 4, 5 and print it.
17. Write a code to add the element 6 to the set {1, 2, 3, 4}.
18. Write a code to create a tuple with the elements 10, 20, 30 and print it.
19. Write a code to access the first element of the tuple ('apple', 'banana', 'cherry').
20. Write a code to count how many times the number 2 appears in the tuple (1, 2, 3, 2, 4, 2).
21. Write a code to find the index of the element "cat" in the tuple ('dog', 'cat', 'rabbit').
22. Write a code to check if the element "banana" is in the tuple ('apple', 'orange', 'banana').
23. Write a code to create a set with the elements 1, 2, 3, 4, 5 and print it.
24. Write a code to add the element 6 to the set {1, 2, 3, 4}.
Java
Pwskills
+ DSA