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 3 subjective questions Strings and Lists; Tuples and Dictionaries

ECE181 — Introduction To Python 20 questions with model answers. Write yours first, then compare.

Read the notes Practice MCQs
  1. Question 1 of 20

    Explain why a string is called a compound data type in Python. Illustrate with an example how individual characters can be accessed using indexing.

  2. Question 2 of 20

    Describe how the length of a string is determined in Python. How can you use the length to access the last character safely?

  3. Question 3 of 20

    Explain string traversal in Python. Write programs to traverse a string using both a while loop and a for loop.

  4. Question 4 of 20

    What are string slices? Explain the slicing syntax s[start:stop:step] with suitable examples covering default values and negative indices.

  5. Question 5 of 20

    Explain how string comparison works in Python. Describe the role of lexicographic ordering with examples.

  6. Question 6 of 20

    Describe the find() function for strings. Explain its parameters and return values, and write a function of your own that mimics find().

  7. Question 7 of 20

    Explain the concept of looping and counting in strings. Write a program to count the number of occurrences of a particular character in a string.

  8. Question 8 of 20

    What are lists in Python? Explain the different types of list values they can store, and how lists differ from strings.

  9. Question 9 of 20

    Explain membership and length operations on lists. Illustrate with the in, not in operators and the len() function.

  10. Question 10 of 20

    Describe the various list operations in Python including concatenation, repetition, and slicing with suitable examples.

  11. Question 11 of 20

    Explain the different ways to perform deletion of elements from a list in Python. Describe del, remove(), and pop() with examples.

  12. Question 12 of 20

    Explain how to access elements of a list and traverse a list using for loops. Demonstrate accessing by index and by value.

  13. Question 13 of 20

    Explain list as parameters to functions. Discuss with an example how lists are passed and why changes inside a function affect the original list.

  14. Question 14 of 20

    What are nested lists? Explain how to create and access elements of a nested list, and write a program to print a matrix using nested lists.

  15. Question 15 of 20

    Define a tuple. Explain how tuples are created and describe why tuples are considered immutable, comparing them with lists.

  16. Question 16 of 20

    Explain the various operations on tuples such as indexing, slicing, concatenation, repetition, and tuple assignment (packing and unpacking) with examples.

  17. Question 17 of 20

    What is a dictionary in Python? Explain how to create a dictionary and add, modify, and retrieve values with examples.

  18. Question 18 of 20

    Explain how to delete items from a dictionary. Describe del, pop(), popitem(), and clear() with examples.

  19. Question 19 of 20

    Describe the important dictionary methods in Python such as keys(), values(), items(), get(), update(), and copy() with examples.

  20. Question 20 of 20

    Discuss the common operations on dictionaries including traversal, membership testing, and building a dictionary from data. Write a program to count the frequency of each character in a string using a dictionary.

That's unit 3

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.