Python Interview Questions
  • Python - Tkinter module
    1. What function creates your main window? (Python Tkinter)
    A) Tkinter()
    B) Tk()
    C) main()

    Answer: Tk()
    2. Create a Tkinter string variable named num_1
    A) num_1 = strvar()
    B) num_1 = StrVar()
    C) num_1 = StringVar()

    Answer: num_1 = StringVar()
    3. What function is used to define an entry box? (Python Tkinter)
    A) tk.entry()
    B) tk.Entry()
    C) ttk.Entry()

    Answer: ttk.Entry()
    4. What function is used to create a label? (Python Tkinter)
    A) ttk.Label()
    B) tk.label()
    C) tk.Label()

    Answer: ttk.Label()
    5. What command ties the event of clicking return to the execution of the function get_sum? (Python Tkinter)
    A) root.bind("Return", get_sum)
    B) root.bind('', get_sum)
    C) root.bind('[Return]', get_sum)

    Answer: root.bind('', get_sum)
    6. What command forces your application to loop until it is closed? (Python Tkinter)
    A) root.mainloop()
    B) root.loop()
    C) root.main_loop()

    Answer: root.mainloop()

datai analytics