

InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
1. |
Set members must not be hashable.(a) True(b) FalseThe question was posed to me in my homework.The doubt is from Sets in chapter Tuples and Sets of Python |
Answer» Right CHOICE is (b) False |
|
2. |
Which of these about a frozenset is not true?(a) Mutable data type(b) Allows duplicate values(c) Data type with unordered values(d) Immutable data typeI had been asked this question by my college professor while I was bunking the class.The doubt is from Sets in portion Tuples and Sets of Python |
Answer» RIGHT choice is (a) MUTABLE data TYPE Explanation: A FROZENSET is an immutable data type. |
|
3. |
If a={5,6,7}, what happens when a.add(5) is executed?(a) a={5,5,6,7}(b) a={5,6,7}(c) Error as there is no add function for set data type(d) Error as 5 already exists in the setI had been asked this question in an online interview.My question is taken from Sets topic in division Tuples and Sets of Python |
Answer» Correct option is (b) a={5,6,7} |
|
4. |
If a={5,6,7,8}, which of the following statements is false?(a) print(len(a))(b) print(min(a))(c) a.remove(5)(d) a[2]=45I got this question in quiz.The query is from Sets topic in section Tuples and Sets of Python |
Answer» The correct choice is (d) a[2]=45 |
|
5. |
Which of the following statements is used to create an empty set?(a) { }(b) set()(c) [ ](d) ( )I had been asked this question by my college professor while I was bunking the class.My query is from Sets topic in section Tuples and Sets of Python |
Answer» Correct OPTION is (b) SET() |
|
6. |
Which of the following is not the correct syntax for creating a set?(a) set([[1,2],[3,4]])(b) set([1,2,2,3,4])(c) set((1,2,3,4))(d) {1,2,3,4}I got this question in quiz.My doubt stems from Sets topic in division Tuples and Sets of Python |
Answer» Correct CHOICE is (a) SET([[1,2],[3,4]]) |
|
7. |
Which of these about a set is not true?(a) Mutable data type(b) Allows duplicate values(c) Data type with unordered values(d) Immutable data typeI got this question at a job interview.I'd like to ask this question from Sets in portion Tuples and Sets of Python |
Answer» Right ANSWER is (d) Immutable data type |
|
8. |
What type of data is: a=[(1,1),(2,4),(3,9)]?(a) Array of tuples(b) List of tuples(c) Tuples of lists(d) Invalid typeThe question was asked during a job interview.Question is taken from Tuples in portion Tuples and Sets of Python |
Answer» CORRECT option is (b) LIST of TUPLES Explanation: The variable a has tuples ENCLOSED in a list making it a list of tuples. |
|
9. |
If a=(1,2,3,4), a[1:-1] is _________(a) Error, tuple slicing doesn’t exist(b) [2,3](c) (2,3,4)(d) (2,3)This question was addressed to me in an internship interview.I'd like to ask this question from Tuples in portion Tuples and Sets of Python |
Answer» Right choice is (d) (2,3) |
|
10. |
What is the data type of (1)?(a) Tuple(b) Integer(c) List(d) Both tuple and integerI had been asked this question in an interview for job.My question comes from Tuples topic in chapter Tuples and Sets of Python |
Answer» RIGHT choice is (b) Integer For explanation: A TUPLE of ONE ELEMENT must be CREATED as (1,). |
|
11. |
Suppose t = (1, 2, 4, 3), which of the following is incorrect?(a) print(t[3])(b) t[3] = 45(c) print(max(t))(d) print(len(t))The question was asked during a job interview.This interesting question is from Tuples in section Tuples and Sets of Python |
Answer» CORRECT answer is (b) t[3] = 45 To explain: VALUES cannot be MODIFIED in the case of tuple, that is, tuple is IMMUTABLE. |
|
12. |
Which of the following is a Python tuple?(a) [1, 2, 3](b) (1, 2, 3)(c) {1, 2, 3}(d) {}I have been asked this question in an interview.The query is from Tuples topic in section Tuples and Sets of Python |
Answer» Correct OPTION is (B) (1, 2, 3) |
|