CodeBlockHub

Python Quiz for Data Types – 06

Python Quiz for Data Types

One of fundamental concepts of Python is the data type. Every value in Python has a datatype. Since everything is an object in Python, data types are actually classes, and variables are instances (objects) of these classes. Evaluate your skills by attempting Python quiz for data types.

Prepare yourself for the quiz: Integer, String, Float, List, Dictionary, Set, Tuple, Variables, Basic I/O, Keywords

0%
10

Python Data Types – 06

Level: Beginner

1 / 10

1. What is the type of the following data type – (‘a’, ‘b’, ‘c’)?

2 / 10

2. What is the output of the following code –

tup1 = (2, 4, 3, 5, 4, 6, 7)
print(len(tup1))

3 / 10

3. From the following example

tup1 = (‘Alpha’, ‘Beta’, 1997, 2000)

which of the following is the third element of the tuple tup1?

4 / 10

4. for i in (1,2,3,4):
  
  if i == 4:
    break
  else:
    print(i)

 

5 / 10

5. What is the output of the following code?

tup1 = (2, 4, 3, 5, 4, 6, 7)
tup2 = (1, 2, 3)
print(tup1 + tup2)

 

6 / 10

6. How the membership operator is used in tuples?

7 / 10

7. What is the output of the following code

tup1 = (2, 4, 3, 5, 4, 6, 7)
tup2 = (1, 2, 3)
print(tup1 * 3)

8 / 10

8. What is the output of the following code?

tup1 = ('Alpha', 'for', 'Beta')
print(tup1[-1])

9 / 10

9. What is the output of the following code?

tup1 = (2, 4, 3, 5, 4, 6, 7)
print(tup1[::-1])

10 / 10

10. What is the output of the following code

tup1 = (2, 4, 3, 5, 4, 6, 7)
print(tup1[1:4])

Your score is

0%

Leave a Reply

Your email address will not be published. Required fields are marked *