Qn: Edit this page to add questions. Q1: Can we get list of all fucntions or function types which are not allowed?? Q2[](https://): For Assignment 0, are we supposed to push both the codes in the main branch, or create separate branches for each question on github? Q3: Also are we supposed to push the code to github at every few lines of code we write, or just at the end? Is there any rule to it? Q4: Is sprintf allowed for concatenating strings, not I/O? Q5: Is getline() allowed for I/O? It seems impossible to read an entire line in INPUT with just scanf(), with a variable number of words in the line. Q6: Is fopen allowed? Q7: Can we use freopen? Q8: If files are to be opened with open(), then is write() allowed? Q9: Can we use freopen for redirecting input output streams though? apart from just opening or closing files? Q10 : Can we use sprintf or itoa function to concert pid from integer to string Q11: can we use mkdir()? Q12: Can we use fputc? Q13: The part 2 has 3 tasks. The submission format mentions 2 files processManagement.c and writer.c. While its clear that task 2 executes writer.c code are the tasks suppsed to be written as separate functions in processmanagement.c so they can be executed individually? Q14: printf and scanf generally writes to stdin and stdout. To redirect that to a specific file, we need to use freopen(), and then use printf and scanf to write or read from any file. There is no other way to use only printf and scanf to write to a file when it only writes to stdin and stdout. Could you pls confirm that freopen() can not be used for this task only? Q15: Can we use ```dup()``` and ```dup2()``` for Part-1? Q16: In what order do the ```LAST <n>``` lines from content.txt have to appear? latest first or latest last? similarly for the ```LOG <n>``` questions. Q17: Can we use ```syscall()``` for part-1 ? Q18: Can we pass arguments while executing writer in part-2 task 2? Q19: Can we use to_string() to convert integers to strings? Q20: Can the constraints for n in part-1 be mentioned? Q21: Can we use `strcat()`? Q22: In the ```exec()``` syscall, are we allowed to utilize any bash command to accomplish a task or are there any restrictions? Q23: Are we allowed to use <string.h>? functions like strcat, strlen,etc, as required? Q24: As a workaround to the restrictions, can I use `fgetc` and `fputc` to read and write into my files? Q26:Can we use system calls like `Create` ,`Open`,`Close` ,`Read` and `Write`? Q27: since we are allowed ```dup()``` and ```dup2()```, can we also use ```fflush()``` for writing the data from the stdout buffer to the destination? Q28 : Do the part 1 restrictions also apply to part 2? Q29: Are the write() or open() function allowed, since its not a part of the f* function family? Q30: Is shell-redirection allowed, in execvp? Q31: For part-1 `INPUT` command, is it necessary to preserve leading spaces if the user inputs them, for e.g ` hello` should be written to the file as ` hello` or is it fine if its written as `hello`? Q32: In Part 2: There are `three tasks` which require three separate `c` files for them to execute properly. Can we submit separately when uploading to github? or does it HAVE to be only `processmanagement.c` and `writer.c` files. Q33: In Part 1, can we assume that we will never encounter the same PID - or if not, should we erase the existing data of content.txt and logs.txt? Q34: can we use snprintf ? Q35 Can file manipulation methods like lseek be used in the program ? Q36 Can we use the exec family of commands? Q37 Is n always positive for FIRST and LAST commands in Part-1? Also can we use getchar() to clear the input buffer? Q38 Should we handle the case where n would be greater than the number of commands input? Q39 Can we use feof? Q40 Can there be empty lines in the `INPUT` command for Part-1?, e.g. user enters the INPUT command and on the input prompt just presses enter without any other characters? If yes, then are we to preserve it? Q40 Can I use snprintf along with system? Q41. For Part-2, is it alright if we create a while-based choice system that lets the user choose which task to run? Or should we just hardcode the running of all 3? Q42: For part-2: what is printing format like shall we only print pids and value of x or we have to print like "Value of x is :"? Q43: For part-1, it is not mentioned in the assignment doc that exec family of commands must not be used and exec commands were taught in the tutorial too, is it okay to use them?? Q44. Are we allowed to invoke shell while using execvp to redirect the data from stdout to the text files? Q45. Is execvp allowed for part 1? (only execvp, no other member). Q46. What are the restrictions for part 2 (if any) if the ones for part 1 dont apply here? Are we still not allowed to use write(), snprintf(), freopen() etc..? Q47. Will the number of input lines be more than the maximum value of long long int? Q48. In part-1, should we handle the case where in a testcase, `FIRST 4` appears before `INPUT text`? Q49. I remember sprintf being allowed for int to string conversion in C. However the answer here has changed. Just for clarification, is sprintf still allowed for int to string only? Q50. If we can use open(), can we also use fopen() Q51. Do we have to run all tasks in Part 2 simultaneously or can we run each task separately? Q52. Are we allowed to disable `stdin` Buffering? Q53. Citing Q37. fflush seems to work only for output buffer like for stdout and stderr and not for stdin. Given this can we use getchar()? Q54. Can we use the system() command for Part-1? Q55. In part-2 is it fine if the child process spawned also performs some of the tasks, say Task 1 is performed Now the parent and Child both will perform Task 2 and then perform Task 3? Q56. Are we allowed to use mkdir() to make a new directory in Part-1? Q57. Are we allowed to use system() function in part-1? Q58. Will the correction be done manually or an automated script will run? Basically, can we print some extra lines like "Enter you input here: " for example. Q59. Part 1:Can we use clearerr()? Q60. Is there any restriction on size of input string in part 1? Q61. Can the number of commands entered exceed the maximum value of LONG LONG INT? Q62. Can we use system function in PART-2 of the assignment? Q63. Can we use getchar() only for flushing the stdin buffer? Q64. Can we use fflush(stdin)? Q65. Can we use fgets? Q66. Does the input in Part 1 have maximum size? Q67. Will we be tested on inputting an empty line? Q68. In Part-1, LAST n, if (n>total number of lines in the file), then are we supposed to print all lines or print nothing? Q69. Could you please elaborate what is meant by "proper error handling" (under Additional Notes subheading on KV github io)? Are we expected to try-except? Do we have to do it for all system calls? Q70. In Part-1, LAST n/FIRST n/LOG n, can n be negative? Are we supposed to print "Unknown Command" if so? Q71. In Part-1, are " abcd" and "abcd" considered two different inputs, i.e, do we have to consider spaces at the start of the string? Q72. In Part-1, are we supposed to consider commands like ``` INPUT``` (leading spaces) or ```INPUT ``` (trailing spaces) valid? Q73. In Part-1, can the input for the command (the user input right after "Enter command") have spaces, do I have to process inputs like "INPUT :D"? Q74. In Part-1, are we allowed to use the setvbuf function? Q75. Regarding the response of Q13, what do you mean we have to do all 3 tasks in a single file? Q76. Regarding response of Q33, 'yes' for what? Q77. Regarding response for Q39, if we can't use fopen, how can we use feof? Q78. do we need to compile the writer.c as well or we can just assume that the executable exists? Q79. can we use fopen, read, write directly in q2(task2)? Q80. Whats the maximum number of lines we can have? ik some qs were asked before that said it wont be more than long long int, but is there a fixed smaller limit? Q81. Can we use fopen() in Part-2? Q82 Can we use normal puts gets and posix spawn in part1 Q83 are we allowed to invoke bash in p1(without using fork or exec functions) Q84 in part2, task3, is it okay if the terminal stays open after both the parent and the child exit? Q85 In part1, can we use chdir()? Q86. What are the restrictions for Part - 2? Q87 Can we use putc()? Q88. In part 1 can we use setvbuf? Q89. Can we use ```rewind()``` to reset ```stdin``` to beginning of the file in part 1 ? Q90. In the Task 3 of the part - 2, the "parent PID printed by the child in Task 3 (after orphaning)" is happening but after that particular terminal exits. Is that fine? Basically, the terminal looks like: C:\osn\task $ output 1 output 2 C;\osn\task $ output 3 This happening cuz there is a delay and that delay is printing the output to the terminal after it exits. Q91. Is itoa function allowed in both the parts? Q92. can we use getchar()? Q93. do we have to consider errors like some error encountered while using dup2 or some error encountered while making directory? if yes, then should we just print error encountered? Q94. can we use sscanf() Q95. Can we use dprintf function for part-1? Q96. Can we use syscall function for Part 1? Q97. Are we to wait for the child processes to end before running the next task for Part-2 Task 1 & 2, where we are not required to orphan them? Q98. Are we allowed to create another child process to compile the writer.c file or should we precompile it for P2T2? Q99. Are we allowed to use `cat`, `head`, `tail` using `fork()` and `exec()`? Q100 Are we supposed to declare LLM usage in the README file ? Q101. Can we use `mmap()` and `munmap()`? Q102. Can we use `chdir()` for part1? Q103. Can we use `lseek` in Part 1 (file management program) Q104. Can we use putLine(), getLine(), numToStr()? Q105. In part 2 do i do task 1 then in the parent branch from task 1 do task 2 and so on or do I just do it such that first task executed in two branches then second task run in 4 branches and so on ??? Q106. In task 3 of part 2 my orphaned process is not being adopted by process id 1 but rather a different process,due to modern subsystem linux architecture,is that a problem? Q107: Are we allowed to upload the binary files along with the codes? Q108: For Part-2, will the `writer.c` program be compiled by the checker/ta? If not, should the `writer` executable be compiled by the `processManagement.c`, or should the compiled executable be committed directly to the repo? Q109 In part-1, in the case where ```PRINT``` appears before any ```INPUT``` command, we dont print anything onto the terminal, but we have to log ```PRINT``` onto the logs.txt file right? Q110: What exactly is meant by running the functions sequentially in part-2? Should we just call them one by one? Do we need to make sure that task3 is not run two times, one by the parent and another by the child that are created during task2? Q111: Do we need to add the reply given by LLMs in README.md or only the prompts? If yes, do we need to add the screenshots? Won't that violate the directory structure? Q112. if just closing the file and opening again is not resolving the issue, can I use rewind()? Q113. What will be the maximum number of lines in the content.txt file at some certain point in Part1? Can we consider it to be maximum value which int can take as we are using int only. Q114. Can we use sscanf() for Part-1? Q115. In extension to Q109, should we print something like open error file doesn't exist if a printable command is entered before doing input or output an empty file? ie, is the file supposed to be created only once input is entered or must it be created for any command? Q116. My program for part-1 considers " INPUT" command same as "INPUT" but treats "INPUT " command as unknown. Should this be a problem? Q117. Are we allowed to use strncmp function? Q118. Is a pdf with all prompts and answers copied and pasted as text is fine for ai usage declaration? Q119. in Part-2 is required that the parents of child(before orphaning in task3) in task2, task3 are expected to be same?..can we run the tasks independent of each other? Q120. Are we supposed to fork just once and then compare the pid's for both task 2 and task 3 in readme, or can all the tasks parent's can be independent of each other? Q 121 Can i use fseek?Since , lseek and opening and closing file again in printing last n , does not work for Last 1 lines ?? Q122. Do we need to consider the leading spaces in input too, or is it fine to igonre the leading spaces?