0% found this document useful (0 votes)
2 views2 pages

Unit 3 (Python)

This document is a set of questions related to Data Structures in Python, specifically focusing on Lists, Tuples, Sets, and Dictionaries. It covers various aspects such as defining data structures, accessing elements, and using methods to manipulate these structures. The questions are designed for students studying Scripting Language in the 2nd semester of a Computer Engineering program.

Uploaded by

husbysjdudbev
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Unit 3 (Python)

This document is a set of questions related to Data Structures in Python, specifically focusing on Lists, Tuples, Sets, and Dictionaries. It covers various aspects such as defining data structures, accessing elements, and using methods to manipulate these structures. The questions are designed for students studying Scripting Language in the 2nd semester of a Computer Engineering program.

Uploaded by

husbysjdudbev
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PACIFIC SCHOOL OF ENGINEERING

Department of Computer Engineering

====================================================================

Semester:2nd Subject: Scripting Language (DI02000101)

CHAPTER 3 : Data Structure In Python

1. Which symbol is used to define a List in Python?


a. {} b.() c.[] d.<>

2. Which of the following is a valid List?


a. list = (1,2,3) b. list = [1,2,3] c. list = {1,2,3} d. list = <1,2,3>

3. How do you access the first element of a list a=[10,20,30]?

a. a(0) b. a[1] c. a[0] d. a{0}

4. Which method removes an element from a list?


[Link]() [Link]() [Link]() [Link] b and c

5. What does len(list) return?


[Link] element [Link] of list [Link] of elements [Link] value

6. Lists in Python are:


[Link] [Link] [Link] [Link]

7. Which of the following defines a Tuple?


a. A) tuple = [1,2,3] b. tuple = {1,2,3} c. tuple = (1,2,3) d. tuple = <1,2,3>

8. Tuples are:
[Link] [Link] [Link] [Link]

9. Which function counts occurrences in a tuple?


[Link]() [Link]() [Link]() [Link]()

10. Which function returns index in a tuple?


[Link]() [Link]() [Link]() [Link]()

11. Sets are defined using:


a.[] b.{} c.<> d.()

12. Which property is true for Sets?


[Link] values allowed [Link] [Link] element only [Link] allowed
13. Which method adds an element to a set?
[Link]() [Link]() [Link]() [Link]()

14. Which operation combines two sets?


[Link]() [Link]() [Link]() [Link]()

15. Which method removes an element from a set?


[Link]() [Link]() [Link]() [Link]()

16. Dictionary is defined using:


a.[] b.{} c.<> d.()

17. Dictionary stores data in:


[Link]-value pair [Link]-value pair [Link] key [Link] value

How do you access dictionary value?


18.
For d={"a":10,"b":20}

a. d(a) b. d["a"] c. d{a} d. d.a

19. Which method returns dictionary keys?


[Link]() [Link]() [Link]() [Link]()

20. Which method returns dictionary values?


[Link]() [Link]() [Link]() [Link]()

21. Which method deletes all dictionary items?


[Link]() [Link]() [Link]() [Link]()

22. Which method updates dictionary values?


[Link]() [Link]() [Link]() [Link]()

23. Which function returns number of elements in a tuple?


[Link]() [Link]() [Link]() [Link]()

24. Which data structure does NOT allow duplicate values?


[Link] [Link] [Link] [Link]

25. Which method adds element at end of list?


[Link]() [Link]() [Link]() [Link]()

You might also like