python Unit 1

45 flashcards · Programming Languages · by Sikkandharbatcha J

  1. Which Python mode allows you to execute code line by line immediately? A) Interactive mode B) Script mode C) Batch mode D) Compile mode

    Interactive mode

  2. Which Python mode is used to execute an entire file of code? A) Script mode B) Interactive mode C) Debug mode D) Live mode

    Script mode

  3. What is the main feature of Python's interactive mode? A) Immediate execution of commands B) It compiles programs C) It runs only .py files D) It is faster than script mode

    Immediate execution of commands

  4. In script mode, code is generally written and saved in which type of file? A) Saved in .py file B) .txt C) .docx D) .exe

    Saved in .py file

  5. What prompt symbol is shown in Python interactive mode? A) >>> prompt B) $$ C) ?? D) ::

    >>> prompt

  6. Which of the following is a popular Python IDE? A) PyCharm B) MS Word C) Photoshop D) Notepad

    PyCharm

  7. Which IDE comes bundled with Python? A) IDLE B) Eclipse C) NetBeans D) Jupyter

    IDLE

  8. Which Python IDE is most used for data science and visualization? A) Jupyter Notebook B) Turbo C C) NetBeans D) Atom

    Jupyter Notebook

  9. Which code editor is widely used for Python and supports extensions? A) Visual Studio Code B) MS Excel C) Google Docs D) Outlook

    Visual Studio Code

  10. What does IDE stand for? A) Integrated Development Environment B) Internal Data Editor C) Integrated Data Executor D) Internet Development Engine

    Integrated Development Environment

  11. Which data type is used to represent whole numbers in Python? A) int B) float C) str D) list

    int

  12. Which data type is used to represent decimal numbers? A) float B) int C) bool D) tuple

    float

  13. Which data type is used to represent text in Python? A) str B) list C) dict D) tuple

    str

  14. Which data type is ordered, mutable, and allows duplicates? A) list B) tuple C) set D) dict

    list

  15. Which data type is ordered, immutable, and allows duplicates? A) tuple B) list C) set D) dict

    tuple

  16. Which data type is unordered, mutable, and does not allow duplicates? A) set B) list C) tuple D) str

    set

  17. Which data type stores key-value pairs? A) dict B) list C) tuple D) set

    dict

  18. What is the output of bool(5)? A) True B) False C) 0 D) Error

    True

  19. Which data type is used to represent numbers with real and imaginary parts? A) complex B) float C) set D) dict

    complex

  20. Lists in Python are? A) mutable B) immutable C) constant D) static

    mutable

  21. Which operator is used for assignment in Python? A) = B) == C) === D) <-

    =

  22. Which operator is used for addition in Python? A) + B) & C) % D) //

    +

  23. Which operator checks equality between two values? A) == B) = C) != D) is

  24. Which logical operator returns True if both conditions are True? A) and B) or C) not D) xor

    and

  25. Which logical operator returns True if at least one condition is True? A) or B) and C) not D) is

    or

  26. Which logical operator negates a condition? A) not B) and C) or D) xor

    not

  27. Which bitwise operator performs AND operation? A) & B) | C) ^ D) ~

    &

  28. Which bitwise operator performs OR operation? A) | B) & C) not D) xor

    |

  29. Which operator is used to check membership in lists, tuples, or sets? A) in B) is C) == D) ===

    in

  30. Which operator checks object identity? A) is B) in C) == D) !=

    is

  31. Which function is used to read input from the user? A) input() B) print() C) read() D) scan()

    input()

  32. Which function is used to display output to the console? A) print() B) input() C) echo() D) display()

    print()

  33. Which parameter in print() is used to specify separator between values? A) sep B) end C) split D) join

    sep

  34. Which parameter in print() is used to specify what is printed at the end? A) end B) sep C) close D) finish

    end

  35. Which format specifier is used for integers? A) %d B) %f C) %s D) %c

    %d

  36. Which format specifier is used for floating-point numbers? A) %f B) %d C) %s D) %x

    %f

  37. Which format specifier is used for strings? A) %s B) %d C) %f D) %c

    %s

  38. Which function converts a string to an integer? A) int B) str C) float D) eval

    int

  39. Which function converts a string to a floating-point number? A) float B) int C) str D) ord

    float

  40. Which function converts a number to a string? A) str B) int C) float D) chr

    str

  41. What is the output type of split() method in Python? A) list B) tuple C) set D) dict

    list

  42. Which data type is created using curly braces with key-value pairs? A) dictionary B) set C) list D) tuple

    dictionary

  43. What is the index of the first element in a Python list? A) 0 B) 1 C) -1 D) None

  44. Which function is used to find the number of items in a list? A) len() B) count() C) size() D) length()

    len()

  45. Which function generates a sequence of numbers? A) range() B) list() C) tuple() D) map()

    range()