Introduction to Machine Learning and Basics of Python
14 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Which data structure is considered mutable in Python?

  • String
  • List (correct)
  • Tuple
  • Set
  • What is the primary difference between a set and a list in Python?

  • Set allows for duplicate elements, while list strictly enforces uniqueness
  • List allows indexing of elements, while set does not allow indexing
  • List elements are ordered and can contain duplicates, while set elements are unordered and unique (correct)
  • Set elements are ordered and can contain duplicates, while list elements are unordered and unique
  • Which of the following is true about dictionaries in Python?

  • Dictionaries can contain only numeric keys and string values
  • Dictionaries are unordered collections of key-value pairs (correct)
  • Dictionaries allow duplicate keys but not duplicate values
  • Dictionaries store elements in a sorted manner
  • In Python, which of the following data structures has constant time complexity for checking the presence of an element?

    <p>Set</p> Signup and view all the answers

    Which data structure in Python is immutable?

    <p>Tuple</p> Signup and view all the answers

    What is a key characteristic of lists in Python?

    <p>List elements can be changed after creation.</p> Signup and view all the answers

    Which data structure in Python is used for testing membership and eliminating duplicate values?

    <p>Set</p> Signup and view all the answers

    What is a key characteristic of dictionaries in Python?

    <p>Values can be of any data type.</p> Signup and view all the answers

    Which Python operator is used for exponentiation?

    <p>**</p> Signup and view all the answers

    What do assignment operators do in Python?

    <p>Assign values to variables and perform arithmetic operations.</p> Signup and view all the answers

    Which type of operators are used to compare values in Python?

    <p>Relational Operators</p> Signup and view all the answers

    In Python, what is a key difference between sets and lists?

    <p>Lists are mutable, while sets are immutable.</p> Signup and view all the answers

    Which characteristic applies to logical operators in Python?

    <p>and, or, not</p> Signup and view all the answers

    What is the primary purpose of dictionaries in Python?

    <p>Accessing values using keys quickly</p> Signup and view all the answers

    More Like This

    Use Quizgecko on...
    Browser
    Browser