Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 2 subjective questions Python data structures

ECAP776 20 questions with model answers. Write yours first, then compare.

Read the notes Practice MCQs
  1. Question 1 of 20

    Define a Python string. Explain string indexing and slicing with suitable examples.

  2. Question 2 of 20

    Explain commonly used Python string methods and demonstrate any five of them.

  3. Question 3 of 20

    Describe different techniques for formatting strings in Python. Compare f-strings, str.format(), and the % operator.

  4. Question 4 of 20

    Write and explain a Python program that determines whether a given string is a palindrome after ignoring spaces, punctuation, and letter case.

  5. Question 5 of 20

    Define a Python list. Explain list creation, indexing, slicing, and mutability with examples.

  6. Question 6 of 20

    Explain the differences among append(), extend(), insert(), remove(), pop(), and del when working with lists.

  7. Question 7 of 20

    What is list comprehension? Explain its syntax and use it to create filtered and transformed lists.

  8. Question 8 of 20

    Discuss shallow copying and deep copying of nested Python lists. Why can ordinary list copying produce unexpected results?

  9. Question 9 of 20

    Define a set in Python. Explain its main properties and the methods used to add and remove elements.

  10. Question 10 of 20

    Explain union, intersection, difference, and symmetric difference of sets using operators and methods.

  11. Question 11 of 20

    Distinguish among subset, proper subset, superset, and disjoint sets in Python.

  12. Question 12 of 20

    Describe practical applications of sets. Write a Python program that finds unique, common, and exclusive values in two lists.

  13. Question 13 of 20

    Define a tuple. Explain tuple creation, packing, unpacking, indexing, and immutability.

  14. Question 14 of 20

    Compare lists and tuples in Python. State situations in which a tuple is preferable to a list.

  15. Question 15 of 20

    Explain extended tuple unpacking and swapping of variables with suitable Python examples.

  16. Question 16 of 20

    Analyze immutability and hashability in relation to tuples. Under what conditions can a tuple be used as a dictionary key?

  17. Question 17 of 20

    Define a Python dictionary. Explain how key-value pairs are created, accessed, updated, added, and deleted.

  18. Question 18 of 20

    Explain important dictionary methods and different ways to iterate over a dictionary.

  19. Question 19 of 20

    What is dictionary comprehension? Use it to create, transform, and filter dictionary entries.

  20. Question 20 of 20

    Design and explain a Python program that counts word frequencies in a sentence using a dictionary, and discuss its complexity.

That's unit 2

Long answers stick best when they're tested again soon. Run the MCQs on this unit, then come back to the questions you found hardest.