---
# System prepended metadata

title: Assignment 1 Answers

---

0. Edit this page to add questions. Ensure you number your question correctly.
**[AC]** - View the answers on this page

1. Can I use ipynb notebooks?
**[AC]** - No, you must only edit the boilerplate code provided in the repository.

2. Is it necessary to initialize the repo as a uv project? Can't we just use the installed python interpreter to test our solutions?
**[AT]** - It is necessary to use `uv` so you get used to it, and it comes naturally to you in the future.

3. in the first question does the directory contain only files or sub directories+files?
**[AS]** - Contains both subdirectories and files.

4. Can we use big calculator in part A qn2? Bash is unable to handle 128 bit integers.
**[AS]** - Sure. (Although it is possible without `bc`/`dc`)

5. should we also backup empty directories in q1?
**[AS]** - Yes

6. What is the correct format for backup.log out of the 3 below?
```
[2026-02-02 18:37:27] file1 - REASON NEW
[2026-02-02 18:37:30] file2 - REASON MODIFIED
```
```
[2026-02-02 18:37:27] file1 - REASON (NEW)
[2026-02-02 18:37:30] file2 - REASON (MODIFIED)
```
```
[2026-02-02 18:37:27] file1 - NEW
[2026-02-02 18:37:30] file1 - MODIFIED
```
**[YL]** - Use this format 

```
[2026-02-02 18:37:27] file1 - NEW
[2026-02-02 18:37:30] file1 - MODIFIED
```

7. How should backing up of empty directories be logged? (as in answer 5)
**[YL]** - ``` [TIMESTAMP] empty_dir/ - EMPTY_DIR_NEW ```

8. In problem1 of part B how would we know the value of Tk from n/2 to n-1 in the second half if the phase alignment formula is only till n/2-1. In each recursion are we supposed to be returning the current result?
**[AC]** - You are supposed to use the value of $T_k$ from $0$ to $\frac{n}{2} - 1$ for the second half of the conquer step as well, as also given in the formula.

9. In part(a) q1 detect ghost files, do we need to log a file missing from source only once or everytime when the script is run ?
**[YL]** - Everytime the script is run

10. If I initialize the project with uv then there will be some extra files in the directory like hello.py , main.py and pyproject.toml. Do i need to delete these files after uv init or kepping these files as it is fine ?
**[AC]** - Ensure that you keep `pyproject.toml`, `uv.lock` and `.python-version`. You may delete the other files.

11. In part A problem 2, the .enc file is being decrypted by the generated checksum and is throwing bad decrypt error.
**[AC]** - We have fixed this problem. Please accept the PR on the repository.

12. For Problem 2 Part A, after decrypting secret.enc into secret_revealed.jpg, should the resulting file be a valid, viewable image that opens in a standard image viewer? Or is not opening due to ‘bad decrypt’? 
**[AC]** - We have fixed this problem. Please accept the PR on the repository.

13. For part(a) question 1 in copy_file function is the source and the destination (given as arguments), full paths of the source and destination files ? If so then, when calling the log function do i need to pass the whole source path (the given source file argument in the copy_file function) that will be given to the copy function or only the file name?
**[AS]** - It's up to you whether to pass full or relative paths as arguments to the ⁠`copy_file` function. How you implement it doesn't matter as long as the functionality is correct. Note that the logs should only show the filename, not the path (see my answer to question 20)

14. In part B q3, should the punctuations be just removed or replaced by a space, as in the text there are instances like sleep.that, which convert to a single word sleepthat on removing the punctuation?
**[AC]** - A case like `sleep.that` should produce 2 separate words, `sleep` and `that`.

15. In partB q3, the plot_frequency_vs_rank function prints to the stdout (`print(f"Saved plot: {filename}")`). Should we remove this line as the problem states to only print the analysis to the stdout?
**[AC]** - You should remove that line.

16. In part B Q3, there are no bigrams or trigrams starting with fest. Is this intentional?
**[AC]** - If you think so, you may put an if condition and print a blank line if the frequency is 0 for line 2. Ensure that it gives the correct output even if the text file is changed, or if we manually change the word.

<a id="17"></a>

17. For the dry flag in q1 part (a), what are the outputs that we should print ? Also do we still need to log the data in backup.log even if we have the dry run flag ?
**[AS]** - Print the same log messages as you would without the dry-run flag to standard output, but do not write to the log file.

18. For question 1 part(a) do we need to log backup.log as ghost file as well ?
**[AS]** - No, the backup log file should be excluded when detecting ghost files.

19. In part B Q2, should we plot the graphs using the training data or testing data?
**[AC]** - Put both the training and testing data in the same plot, ideally distinguishable by different colours as indicated by a key.

20. In part A Q1, how should we log filename
`[2026-02-02 18:37:27] /home/source/folder1/example1.txt`
or
`[2026-02-02 18:37:27] folder1/example1.txt`
or
`[2026-02-02 18:37:27] example1.txt`
**[AS]** - The log entry should display just the filename (e.g., `[2026-02-02 18:37:27] example1.txt`)

21. What is the expected output for the test script in Part B- Q2?
**[AC]** - The expected out is 
```
=== Test Case 1 ===
0.000000 0.000000
-4.000000 0.000000

=== Test Case 2 ===
-0.056000 -1.312000
-0.158714 0.194976
-0.489001 0.048496
-0.003151 -0.015495
```

22. For part b q3 does starting with fest means first element of the tuple starts with "fest" or does it mean a key where one of the string starts with fest which will include "fest" and words like "festival" as well?
**[AC]** - First element is "fest".

23. For questions like part b q2,q3 do we need to run the code and upload the files generated as well?
**[AC]** - Yes.

24. In q4 partB can i assume The prof has to leave the current building before entering another building ? and if the time elapsed has some seconds, how should the time_spent be calculated ? and if the prof has entered LIBRARY and has not exited so how will the time elapsed be calculated ?
**[YL]** - 

25. For q5 partB should i modify this line "parser.add_argument("image", nargs="?", default="input_meme.jpg", help="Input image")" to change default to "secet_revealed.jpg" or should i change the name of secret_revealed.jpg to input_meme.jpg and what is the expected output of q5 ?
**[YL]** - 

26. For q5 partB , when running the program i am getting this error "DeprecationWarning: Image.Image.getdata is deprecated and will be removed in Pillow 14 (2027-10-15). Use get_flattened_data instead. pixels = gray.getdata()" . Is this fine ?
**[YL]** - 

27. For question 1 part A in the log function there is a comment  # Args: $1=message. What does this refer to. Is $1 not source directory. Also do we log while doing dry run.
**[AS]** - We expect the log function to work like this:
    ```bash
    > log "example1.txt"
    [2026-02-02 18:37:27] example1.txt
    > log "hi"
    [2026-02-02 18:37:32] hi
    ```
    See [doubt 17](#17)
