Skip to content

Punjab (PTB) · Chapter test · Free

2nd Year Computer Chapter 4 TestDEVELOPMENT OF GRAPHICAL USER INTERFACE (GUI)

30 marks · 40 minutes · 21 questions. Covers: CHAP 4: DEVELOPMENT OF GRAPHICAL USER INTERFACE (GUI).

Your school name

2nd Year Computer Chapter 4 Test

2nd Year · Computer · Punjab (PTB)

Name: ____________Roll No: ________Class/Section: ________Date: ________Total marks: 30Time: 40 minutes

Q1. Multiple choice questions (Attempt all · 10 × 1 = 10)

  1. Where does sqlite3 store its database data on the system?

    1. In local RAM cache

    2. In a single file on the system

    3. On a remote server automatically

    4. In the Python installation folder

  2. When does a function linked to an event run?

    1. Continuously while the application is open

    2. Before the GUI window loads

    3. Only when the event happens

    4. When the program is compiled

  3. GUIs improve usability primarily by providing:

    1. Complex command lines

    2. Visual feedback and reducing the need to remember complex commands

    3. Faster compilation times

    4. Automatic database integration

  4. What elements characterize a clean interface?

    1. Well-arranged widgets and enough space between them

    2. Heavy graphical animations and fast network speeds

    3. Database connections and complex backend logic

    4. Full-screen background images and dark themes

  5. What parameter in tk.Frame() sets the background color of a frame?

    1. color

    2. bg

    3. background_color

    4. fill

  6. What is the role of the mainloop() function in a Tkinter application?

    1. It compiles the Python code into an executable.

    2. It runs the GUI event loop to keep the window open and listening for events.

    3. It resets all widget inputs to default values.

    4. It creates new child windows automatically.

  7. How are relationships between tables maintained in a relational database?

    1. Using variables

    2. Using functions

    3. Using keys

    4. Using widgets

  8. Why does a Roll Number function as an identifier for the Student entity?

    1. Because every student shares the same roll number

    2. Because each student has a unique roll number

    3. Because roll numbers change automatically

    4. Because roll numbers are stored as text

  9. What key benefit does using databases provide regarding data quality?

    1. It helps maintain data accuracy and consistency

    2. It automatically fixes code syntax errors

    3. It encrypts code files automatically

    4. It speeds up network bandwidth

  10. How is the title of a Tkinter application window set?

    1. window.set_title("Title")

    2. window.title("Title")

    3. window.header("Title")

    4. window.caption("Title")

Q2. Short questions (Attempt any 6 of 8 · 6 × 2 = 12)

  1. What happens if connection.commit() is omitted after a delete operation?

  2. How user input is processed using widgets and connected functions?

  3. What is meant by an attribute?

  4. Summarize the key advantages of database.

  5. What is meant by responsive interfaces in application design?

  6. What is the role of pady=10 when calling .pack() on a widget?

  7. How does layout management assist in GUI application design?

  8. What is the role of a database cursor in executing SQL commands from Python?

Q3. Long questions (Attempt any 2 of 3 · 2 × 4 = 8)

  1. Write a program to create Simple Login Form in tkinter.

  2. Write out a complete Python program using Tkinter that creates an application window with a title, custom size, label, entry box, and button.

  3. Write a python program to demonstrate the steps to Connect to a Database (sqlite3). Also write code to fetch and display data and steps to Close the connection.