Skip to main content

Lists

Lists Quiz

  1. What type is [1, 2, 3]?
    String
    List
    Tuple
    Dictionary
  2. How do you access the second item in list a = [5,6,7]?
    a[1]
    a(1)
    a{1}
    a.second
  3. Which method adds an item to a list?
    add()
    append()
    insert()
    push()
  4. What will print(len([1,2,3])) output?
    3
    2
    1
    0
  5. What will this return?
    a = [1,2,3]  
    
    print(a[0])  
    
    
    1 2 3 Error
  6. Which method removes an item from a list?
    delete()
    remove()
    pop()
    both b and c
  7. Can lists store different data types?
    Yes
    No
  8. What data structure does a = [] create?
    Empty list
    Empty dictionary
    Empty tuple
    None
  9. What is the index of last element in list a = [2,4,6]?
    2
    3
    -1
    a and c are correct
  10. How to check if an item exists in a list?
    in
    exists
    has
    find

Comments

Popular posts from this blog

Fun time

Projects and Fun Activities Quiz Which module helps in drawing shapes? turtle draw graphics paint What is a simple project idea for beginners? Calculator Operating system Database Web browser Which helps create interactive quizzes? input() print() loops all of these What does the turtle.forward() command do? Moves turtle forward Turns turtle right Pauses program Changes color What structure stores quiz questions? List Tuple String Integer What can you use to track scores? Variable List Function Module Turtle graphics is used for: Drawing Networking File handling Calculations What command clears the screen in turtle? turtle.clear() turtle.reset() turtle.er...

Answers in detail

 Introduction to Python (10 Questions)Who developed Python? a) Dennis Ritchie b) Guido van Rossum c) James Gosling d) Bjarne Stroustrup Answer: bWhich year was Python created? a) 1989 b) 1991 c) 2000 d) 2010 Answer: bWhat type of language is Python? a) Compiled b) Interpreted c) Assembly d) Machine Answer: bWhich is the correct extension for Python files? a) .py b) .java c) .txt d) .exe Answer: aWhat is the first command used to print in Python? a) print() b) echo() c) console.log() d) output() Answer: aPython is named after: a) A snake b) Monty Python's Flying Circus c) A programmer d) A city Answer: bWhich symbol is used to comment in Python? a) // b) -- c) # d) /* Answer: cWhat does PEP stand for in Python? a) Python Enhancement Proposal b) Python Easy Programming c) Programming Environment Protocol d) Programmer’s Education Path Answer: aWhich IDE is commonly used for Python coding? a) Visual Studio Code b) Eclipse c) PyCharm d) Notepad Answer: cWhat will print("Hello...

Variables & Data Types (Questions 11–20)

Variables & Data Types Quiz Which is a valid variable name? 1var var_1 var-2 @var Choose the correct data type for: 45 String Integer Float Boolean True or False values are called: Strings Booleans Integers Floats What will type("Hello") return? int float str bool Which of these is a floating-point number? 10 '10' 10.5 True How to take input from user in Python? input() scan() get() read() What is the value of variable x after x = 5 + 2? 7 "7" 52 Error Can variable names start with a number? Yes No Which is NOT a Python data type? List Set Number Array Is Python case-sensitive i...