Python GUI and File Handling Flashcards (24 cards)

All cards

1Question

Which inputs does the ajouter function read as text?

Answer

ISBN, title, and author.

2Question

How does the ajouter function convert the page count and price?

Answer

It converts the page count to an integer and the price to a float.

3Question

Where does the ajouter function place the new book dictionary?

Answer

At t[n].

4Question

What does the ajouter function do after placing the dictionary at t[n]?

Answer

It increments n and calls afficher.

5Question

What does the afficher function do with the first n records?

Answer

It displays their ISBN, title, author, page count, and price in form.aff.

6Question

What does the enregistrer function do with helicopter.txt?

Answer

It opens the file in write mode.

7Question

What does the enregistrer function write to helicopter.txt?

Answer

The plain text from form.txt.

8Question

What formula calculates the distance between an entered point and a helicopter point?

Answer

(xp−xh)2+(yp−yh)2\sqrt{(x_p-x_h)^2+(y_p-y_h)^2}

9Question

How does the search read helicopter.txt?

Answer

It opens the file in read mode and reads lines until an empty string.

10Question

How does the search parse helicopter coordinates from each line?

Answer

It splits each line around semicolons.

11Question

When does the search update the minimum distance?

Answer

When it finds a shorter distance.

12Question

What argument list initializes `QApplication` in the PyQt application pattern?

Answer

An empty argument list.

13Question

What starts the PyQt application event loop?

Answer

Calling `exec_()`.

14Question

Which function handles button clicks in the PyQt application pattern?

Answer

Connected functions handle button clicks.

15Question

What initial value does the book-record program assign to n?

Answer

0.

16Question

What does the book-record program create for t?

Answer

An array of 30 empty dictionaries.

17Question

Which keys does each book dictionary use?

Answer

ISBN, titre, auteur, nbpage, and prix.

18Question

How are the displayed book fields ordered?

Answer

ISBN, title, author, page count, then price.

19Question

What does the chercher function do with the entered point?

Answer

It splits the point at a semicolon and converts both coordinates to floats.

20Question

What value initializes the minimum distance, and what sets the final displayed value?

Answer

It starts at 10000000, and the displayed value is set from min.

21Question

Which files can the programs load their interface from using `loadUi`?

Answer

`interface-livre.ui` or `interface.ui`.

22Question

Which book-form button connects to `ajouter`?

Answer

`bt`.

23Question

Which helicopter-form button connects to `enregistrer`?

Answer

`bt1`.

24Question

Which helicopter-form button connects to `chercher`?

Answer

`bt2`.

Test yourself with the quiz

Answer 9 questions on Python GUI and File Handling.

1. A user enters ISBN, title, and author as text, followed by a page count and price. What does `ajouter` do with these values when it successfully adds the book?

2. Which set of dictionary keys should a newly created book record use?

Take the quiz →

Read the study guide

Go over the full study guide for Python GUI and File Handling.

Read the study guide →

Related classes

Make your own flashcards

Upload your class notes and Revizly writes your flashcards in about a minute.

Flashcard maker