# Python Tuples MCQs

Python Tuples MCQs: This section contains multiple-choice questions and answers on Python Tuples. These MCQs are written for beginners as well as advanced, practice these MCQs to enhance and test the knowledge of Python Tuples.

## List of Python Tuples MCQs

1. What do you mean by python tuples?

1. An immutable type of data type which can store anything
2. A mutable type of data type which can only store string
3. An immutable type of data type which can store only stored string
4. A mutable type of data type which can only store numbers

Answer: A) An immutable type of data type which can store anything.

Explanation:

A tuple is the immutable nature of data type which can store anything i.e., numbers, strings, characters, etc.

2. Python tuples are IMMUTABLES. What does this statement mean?

1. An immutable nature of python tuples states that it allows us to store the element at the creation time only
2. An immutable nature of python tuples states that it allows us to store the data whenever we want after its creation

Answer: A) An immutable nature of python tuples states that it allows us to store the element at the creation time only.

Explanation:

An immutable nature of python tuples states that it allows us to store the element at the creation time only.

3. In python tuples, different elements are separated by which symbol?

1. :
2. ,
3. ::
4. None of the above

Explanation:

In python tuples, elements are separated by a comma ( , ) symbol.

4. What is the nature of the python tuples data type?

1. In python, tuples are of ordered nature
2. In python, tuples are of unordered nature

Answer: B) In python, tuples are of unordered nature.

Explanation:

In python, tuples are of ordered nature.

5. What do you mean by the ordered nature of python tuples?

1. The ordered nature of tuples indicates that you can only store the data in sequence
2. The ordered nature of tuples indicates that the items are retained in the order in which they are inserted
3. The ordered nature of tuples indicates that the elements which you will put after the creation of the tuples will be added from the last index
4. The ordered nature of tuples indicates that the elements which you will put after the creation of the tuples will be added from the first index

Answer: B) The ordered nature of tuples indicates that the items are retained in the order in which they are inserted.

Explanation:

The ordered nature of tuples indicates that the items are retained in the order in which they are inserted.

6. Can you create a single-element tuple?

1. Yes
2. No

Explanation:

To create a single-element tuple you have to write an element inside parentheses and after the element, you have to put the comma. For example T= (98,) will create a single element tuple.

7. Is it possible to create an empty tuple?

1. Yes
2. No

Explanation:

Yes, you can create an empty tuple. For example, T=().

8. Is parentheses important to store elements inside a tuple?

1. Yes
2. No

Explanation:

No, parentheses are not important to store elements inside a tuple. But it is suggested to use parentheses when storing elements of the tuple.

9. Which of the following will show an error when creating a tuple?

1. T1= "ram", "hello"," include help"
2. T1=("ram",)
3. T1=("ram")
4. Three of them are correct

Explanation:

Among the given options, the third option is wrong. As to create a single element you have to put a comma after the element, else it would be a challenging job.

10. What will be the output of the following code?

```tuple1 = ("tuple")
print(type(tuple1))
```
1. <class 'str'>
2. <class 'tuple'>
3. Error

Explanation:

If you will create a single element tuple without a comma it will be considered a string.

11. To access the element of a tuple through indexing which symbol is used?

1. {}
2. []
3. ()
4. None

Explanation:

To access the elements of a tuple through indexing we have to use square brackets [].

12. What will be the output of the following code,

```T1=("hello","everyone","include helps","welcomes","you","all")
print(T1[0],T1[-2])
```
1. Hello
2. Hello all
3. Hello you
4. Error

Explanation:

"Hello you" will be the output.

13. Do tuples follow the concept of negative indexing?

1. YES
2. NO
3. In special conditions only

Explanation:

Yes, tuples also follow the concept of negative indexing.

14. What do you mean by negative indexing?

1. Negative indexing in python helps us to traverse the list from the end
2. Negative indexing in python helps us to traverse the list from the starting
3. There is no such thing as negative indexing in python

Answer: A) Negative indexing in python helps us to traverse the list from the end.

Explanation:

Negative indexing in python helps us to traverse the list from the end.

15. Can you create a tuple inside a tuple?

1. Yes
2. No

Explanation:

We can create a tuple inside a tuple.

16. What will be the output of the following code?

```T1=("hello","include help",-1)
print(T1[-1])
```
1. Error
2. Hello
3. -1

Explanation:

Negative index will access the element from the last element there -1 index means the last element of the tuple which means -1 is the answer.

17. What will be the output of the following code?

```T1=("hello",[1,2,3,4],("Namastey","Bonjour"))
print(T1[1])
```
1. Hello
2. 1
3. [1,2,3,4]
4. 1,2,3,4
ol>

Explanation:

Since the index 1 list is started so all the elements of the list will be printed.

18. If you are writing a single element inside parentheses in double quotations what it will be considered as?

1. String
2. Tuple
3. List

Explanation:

If you will write a single element in double quotation inside parentheses it will be considered a string data type.

19. Will it be considered a tuple?

```T1= "include help",
print(type(T1))
```
1. Yes
2. No
3. It will show you the error

Explanation:

Yes, it will be considered a tuple as a comma is inserted after the first element.

20. Will the fourth index element will be included in the result?
Suppose you have the following code,

```t1=("hello","everyone","include helps","welcomes","you","all")
print(t1[2:4])
```
1. Yes
2. No

Explanation:

No, the fourth index element will not be included in the result, as the slicing operator only works for the end-1 index, that means in this case it will work only till the third index.

21. What will be the output of the following code?

```t1=("hello","everyone","include helps","welcomes","you","all")
print(t1[2:4])
```
1. ("everyone", "include helps" ," welcomes", "you")
2. ("everyone", "include helps" ," welcomes")
3. ("include helps" ," welcomes")

Answer: C) ("include helps" ," welcomes")

Explanation:

The result would be: ("include helps" ," welcomes") , because indexing starts from 0.

22. In python tuples, what is the syntax of the slicing operator?

1. Tuple[start:end]
2. Tuple[start:end:steps]
3. Only A
4. Only B
5. Both A and B

Answer: E) Both A and B

Explanation:

Both Tuple[start:end] and Tuple[start:end:steps] are the correct syntaxes of the slicing operator in python tuples.

Consider the following example:

```tpl = (10, 20, 30, 40, 50)

print(tpl)  # Prints (10, 20, 30, 40, 50)
print(tpl[0:5])  # Prints (10, 20, 30, 40, 50)
print(tpl[0:5:2])  # Prints (10, 30, 50)
```

23. What will be the output of the following code?

```T1=(88,99,77,11,22,33,44)
print([:])
```
1. Entire tuple will be printed
2. Tuple will be printed in reverse order
3. the Same tuple will be printed
4. It will show you the error

Answer: A) Entire tuple will be printed

Explanation:

Entire tuple will be printed.

24. Which function is used to delete the particular element of the tuple?

1. Remove()
2. Delete()
3. Del()
4. It is not possible to delete the particular element of the tuple

Answer: D) It is not possible to delete the particular element of the tuple

Explanation:

Since tuples are immutable, therefore you can not delete a particular element from the tuple.

25. Which keyword is used to delete the entire tuple?

1. Remove
2. Delete
3. Del

Explanation:

The del keyword will delete the entire tuple.

26. What will be the output of the following code?

```t1=("hello","everyone","include helps","welcomes","you","all")
del t1
print(t1)
```
1. name 't1' is not defined
2. ("hello","everyone","include helps","welcomes","you","all")
3. Hello, everyone, include helps

Answer: A) name 't1' is not defined

Explanation:

Since the del t1 command is there so it will delete the entire t1 tuple so when you will print the t1 it will show you the- name 't1' is not defined.

27. Which python function will get you the size of the python tuple?

1. size()
2. len()
3. lenln()
4. list_len()

Explanation:

The len() function will give you the total number of elements present in the tuple.

28. What will be the syntax to use the Len function to get the size of the following tuple?

```t1=(["hello",1,2,3], ["Hi"," everyone"," How"," Are"," You"])
```
1. print(len(t1))
2. print(len[t1])
3. print([len(t1)])

Explanation:

To get the size of any tuple we will use the following syntax: - print(len(t1)), where t1 is the name of the tuple.

29. What will be the size of the following tuple?

```t1=(["hello",1,2,3], ["Hi"," everyone"," How"," Are"," You"])
```
1. 9
2. 3
3. 5
4. 2

Explanation:

The size of the tuple would be 2, as the tuple included 2 lists therefore the total size would be 2.

30. What will be the output of the following code?

```t1=([22,1,2,3],)
print(t1*2)
```
1. ([22, 1, 2, 3], [22, 1, 2, 3])
2. ([44,1,4,6])
3. Error
4. Not defined

Answer: A) ([22, 1, 2, 3], [22, 1, 2, 3])

Explanation:

When you multiply any integer with the tuple it repeats the elements of the tuple that number of times.

31. What does count() function do in python tuples?

1. It gives you the sum of the entire tuple
2. It counts the occurrence of an element
3. It gives the sum of all the integers present inside the tuples

Answer: B) It counts the occurrence of an element

Explanation:

The count() functions help us to find the total occurrence of a particular element inside a tuple.

32. What is the output of the following code?

```t1=("Can","you","can","a","can","as","a","canner","can","can","a","can")
print(t1.count("can"))
```
1. 5
2. 4
3. 3
4. 1

Explanation:

A total of 5 times the "can" word has occurred inside a tuple.

33. Which keyword is used to check the particular element inside the tuple?

1. Is
2. In
3. Is_there
4. Is_present

Explanation:

In keyword is used to check whether the particular element is inside the tuple.

34. What will be the output of the following code?

```t1=("Can","you","can","a","can","as","a","canner","can","can","a","can")
print("can" in t1)
```
1. Yes
2. True
3. False
4. 5

Explanation:

In Keyword returns the result in true or false, If the particular element is there in the list then it returns you the true, else false.

35. What will be the output of the following code?

```t1=("hello","hi",[100,1000,10000])
t1[2][1]=2000
print(t1)
```
1. It will show you the error as tuples are immutable
2. It will change Hi to 2000
3. ('hello', 'hi', [100, 2000, 10000])
4. ('hello', '2000', [100, 2000, 10000])

Answer: C) ('hello', 'hi', [100, 2000, 10000])

Explanation:

Tuples are immutable but if there is any list inside a tuple then you can easily update the value of that list or mutable data type.

36. What will be the output of the following code?

```t1=("hello","hi")
print(t1+("Include helps","Welcome you all"))
```
1. It will show you the error as tuples are immutable
2. ('hello', 'hi', 'Include helps', 'Welcome you all')
3. ('hello', 'hi') ('Include helps', 'Welcome you all')

Answer: B) ('hello', 'hi', 'Include helps', 'Welcome you all')

Explanation:

Tuples are immutable but you can concatenate another tuple inside a tuple.

37. Among the tuple and list which of the creation is faster?

1. Tuple
2. List
3. Both are equal

Explanation:

Creating tuples is faster in python compared to the list.

38. How do you find the total of all the elements of the tuple?

1. total() function
2. sum() function
3. aggregate() function
4. sum_total function

Explanation:

The sum() function will help you to find out the sum of all the elements in the tuple.

39. What is the functionality of the Not in the keyword in a python tuple?

1. Not in keyword returns true if a specific element is not there in the tuple
2. Not in keyword returns false if a specific element is not there in the tuple

Answer: A) Not in keyword returns true if a specific element is not there in the tuple

Explanation:

not in is a Python membership operator that returns true if a specific element is not there in the tuple.

40. Among tuples and lists which takes less memory?

1. Tuples
2. List

Explanation:

Since tuples are immutable therefore it takes less memory than the list.