Tuesday, 3 December 2024

10-Question quiz on Python Data Types

 

1.Which of the following is a mutable data type in Python?


Options:

a) List

b) Tuple

c) String

d) All of the above

2. What is the data type of True and False in Python?


Options:

a) Integer

b) Boolean

c) String

d) Float

3. Which data type allows duplicate values?


Options:

a) Set

b) Dictionary

c) List

d) None of the above

4. Which Python data type is used to store key-value pairs?


Options:

a) List

b) Tuple

c) Dictionary

d) Set

Intermediate Questions

5. What does the type() function do in Python?


Options:

a) Checks the length of a variable

b) Returns the data type of a variable

c) Converts a variable to another type

d) Prints the variable's value

6. Which of the following Python data types is ordered and immutable?


Options:

a) List

b) Tuple

c) Set

d) Dictionary

7. What is the default data type of a number with a decimal point in Python?


Options:

a) Integer

b) Float

c) Complex

d) Boolean

Advanced Questions

8. What is the main difference between a list and a tuple in Python?


Options:

a) Lists are ordered, tuples are not

b) Tuples are immutable, lists are mutable

c) Lists are faster than tuples

d) There is no difference

9. Which of the following data types does not allow duplicate values?


Options:

a) List

b) Tuple

c) Set

d) Dictionary

10.What data type will the expression 5 > 3 return?


Options:

a) Integer

b) Boolean

c) String

d) None


Basic Questions

  1. Which of the following is a mutable data type in Python?
    Answer: a) List

  2. What is the data type of True and False in Python?
    Answer: b) Boolean

  3. Which data type allows duplicate values?
    Answer: c) List

  4. Which Python data type is used to store key-value pairs?
    Answer: c) Dictionary


Intermediate Questions

  1. What does the type() function do in Python?
    Answer: b) Returns the data type of a variable

  2. Which of the following Python data types is ordered and immutable?
    Answer: b) Tuple

  3. What is the default data type of a number with a decimal point in Python?
    Answer: b) Float


Advanced Questions

  1. What is the main difference between a list and a tuple in Python?
    Answer: b) Tuples are immutable, lists are mutable

  2. Which of the following data types does not allow duplicate values?
    Answer: c) Set

  3. What data type will the expression 5 > 3 return?
    Answer: b) Boolean

0 Comments:

Post a Comment

Popular Posts

Categories

100 Python Programs for Beginner (10) AI (33) Android (24) AngularJS (1) Assembly Language (2) aws (17) Azure (7) BI (10) book (4) Books (156) C (77) C# (12) C++ (82) Course (67) Coursera (223) Cybersecurity (24) data management (11) Data Science (121) Data Strucures (8) Deep Learning (20) Django (14) Downloads (3) edx (2) Engineering (14) Excel (13) Factorial (1) Finance (6) flask (3) flutter (1) FPL (17) Google (34) Hadoop (3) HTML&CSS (47) IBM (25) IoT (1) IS (25) Java (93) Leet Code (4) Machine Learning (53) Meta (22) MICHIGAN (5) microsoft (4) Nvidia (1) Pandas (3) PHP (20) Projects (29) Python (914) Python Coding Challenge (297) Questions (2) R (70) React (6) Scripting (1) security (3) Selenium Webdriver (2) Software (17) SQL (42) UX Research (1) web application (8)

Followers

Person climbing a staircase. Learn Data Science from Scratch: online program with 21 courses