CS211 Data Structures and Algorithms Lab
The objective of this assignment is to recall file operations. This assignment is not for
evaluation. But we will give you a mark (maximum 10, which will not contribute to the grading)
so that you can be well prepared for the upcoming assignments. Submitting your program by
12th August (Thursday) and obtaining a non-zero mark are mandatory to get an attendance for
the lab session on 3rd August. All submissions should be through Moodle. Submission through
emails will be ignored.
Your program should accept an input file as a command-line argument. A typical execution of
your program will be ‘./a.out sample.graph’ (if your program is written in C). The input file name
can be anything (don’t hard-code “sample.graph”).
The input file contains one integer per line.
Task and output
The output should be written to a file named ‘output.txt’ which should contain only 5 lines of
● The first line should contain the total numbers in given the file
● The second line should contain the minimum number present in the file
● The third line should contain the maximum number present in the file
● The fourth line should contain the sum of the numbers
● The fifth line should contain the average of numbers – up to two decimal points.
Submission and Evaluation
● The program you submit should output: “output.txt” when run.
● The main file of your program should be named as <roll no>.<extension>, where roll
no. specifies your roll no. and the extension depends on the language you choose
(Usage of C is a mandatory for this assignment). Ex: 200010001.c
● Test well before submission. You may use the attached sample input files for testing. The
corresponding output files are also attached. We have some hidden inputs with us to test
your program. The mark you obtain is purely based on whether your program correctly
gives outputs for the hidden inputs.
● If your program has only a single source file, please submit the file as it is. If your
program has multiple source files, please submit your code as a zip file where the name
of the zip file should be your roll number. It is important that you follow the input/output
conventions exactly (including the naming scheme) as we may be doing an automated
evaluation. There will be a penalty of 10% (on the mark you deserve otherwise) if
you do not follow the naming conventions exactly.
● Follow some coding style uniformly. Provide proper comments in your code.
● Submit only through moodle. Submit well in advance. Any hiccups in the
moodle/internet at the last minute is never acceptable as an excuse for late submission.
Submissions through email or any other means will be ignored.
● Acknowledge the people (other than the instructor and TA) who helped you to solve this
assignment. The details of the help you received and the names of the people who
helped you (including internet sources, if applicable) should come in the beginning of the
main file as a comment. Copying others’ programs and allowing others to copy your
program are serious offences and a deserving penalty will be imposed if found.
● To be considered for the evaluation, you have to submit your program by 12th August