Homework I

Homework 1: Tabulating a function y=f(x)

For homework 1, you need to create a software solution, that tabulates a mathematical function y = f(x) within the constraints specified by the task. The results must be displayed as an aligned table with columns for the argument x and function y = f(x) values. Some hints about aligning it can be found here: printf tips example.

Argument (xi) Function value yi=f(xi)
x1 y1
x2 y2
… …
xn yn

The formulas for both xi and yi are specified by your personal variant.

Function value should only be shown if the argument belongs to the function’s domain. If the value cannot be calculated, either “missing” or “complex” should be shown in the y column. Optionally you can also calculate the complex values and display them in the y column in the form of real part + imaginary part.

All inputs come from the user by typing them in on the keyboard. All inputs except the number of steps N must allow entering real numbers. Number of steps N is an integer. The specific inputs that you must accept are specified by your personal task variant.

As a result of the assignment, you must prepare and submit a program written in C, an algorithm for the program represented as a UML activity diagram and a written report.

Video explaining the task

Homework variant

Report

You must submit a detailed report on the solution you made. The quality of the report is a part of the homework points.

The report must adhere to IT faculty’s thesis guidelines. Most faculties use the same or similar principles with minor alterations. We have prepared a shortened guide (non-complete, reduced to only cover relevant sections) for you to follow https://blue.pri.ee/ttu/resources/report-guidelines/

The report should be reasonable and manageable in terms of both language and length for both the writer and the reader. Avoid unnecessarily complicated wording (i.e. terms you would struggle to understand yourself) and describing activities in a more elaborate way than their actual complexity warrants.

To make this easier for you, we are providing a template that contains the necessary predefined styles and is adjusted to the requirements of the first homework. It also contains explanations under each section about what is expected of you.

Adapted report template

Download the template: https://blue.pri.ee/ttu/files/iax0583/mallid/mall_2026_en.dotx

Each section of the template contains comments written in blue text about the expected content. Use these blue guidance texts to guide you. Once the report is finished, delete the blue text before submitting. Make sure to update all the lists (TOC, list of figures and  tables) after deleting the blue text. Then export to a PDF file.

You may change the template’s structure as needed, for example by adding headings and subheadings.

Read the report writing guide before using the template to avoid formatting errors and use the template more effectively!

Alternative templates

The original MS Word template used to create our adapted template is also available among the university’s templates. A LaTeX template is available as well. If you wish to start with the original template, you must adapt it according to the explanations in the adapted template provided above!

The faculty’s official tempaltes are available here: https://taltech.ee/en/thesis-and-graduation-it#p43359

The university’s LaTeX templates are available here:  https://www.overleaf.com/latex/templates/tagged/taltech

Report content

For the first homework assignment, structure the content according to the adapted report template!

Your report should contain the following sections

  • Title page
  • Declaration of originality
  • List of abbreviations and terms (if needed)
  • Table of contents
  • List of figures and tables (if needed)
  • Task description and variant
  • Analysis of the function y=f(x)
    • Describe the function and perform an analysis on it
    • Plot(s) of the function
      Possible tools for creating plots [Google], [Wolfram Alpha], Excel, etc.
  • Description of the solution
    • Written description. Follow the guidance from template! The length of the written part must be between 1 – 2 A4 pages, with figures added to this. The description must be well structured
    • Program workflow
    • Algorithm, modeled as UML activity diagram
    • Analysis of special situations (simplified risk analysis)
  • Use of AI
  • Summary
    • Write a few sentences about your approach to the assignment and your work process.
    • Write a few sentences about the assignment and how difficult it was for you
    • If possible, give an estimate on the workload
    • Would you recommend using this assignment in the future? Would you change anything, and if so, what?
    • Additional comments, emotions, thoughts
  • References (if needed)
  • Screen capture(s) of the working program
    • Screen captures should illustrate various situations that your program can handle, as well as the normal behavior.
    • Screenshots can be added as an appendix or included in the description of the solution – in this case you can extend the length by the amount of figures.

Note: If you use techniques or language constructs that have not yet been covered in class, you must explain how they work and the advantages of using them in your solution. You may extend the solution description to accommodate these explanations.

Common issues in reports

This is a list of commonly made mistakes that we have encountered over the years:

  • The title page is inaccurate.  The top two or three lines of the title page indicate to whom you are submitting your report to (already filled in)
  • Wrong calendar year in the footer of the title page
  • The predefined styles in the template are not used for formatting body text, headings etc
  • Blank pages are left in the report
  • A heading must be followed by at least one paragraph of text before a subheading, figure, or table can appear
  • A chapter contains only a figure or figures, without describing or referring to them in the text.
  • Tables and figures must have a caption
  • Tables and figures need to be cross-referenced in the text
  • The written text must not be a large monolithic blob – you must structure your written text (paragraphs, subheadings, tables, figures, lists, etc.)
  • Algorithm must be print-ready – if your report is printed on A4 paper, it must be readable. Common issues include poor color contrast and text that is too small
  • Your report can only include short snippets of the code and only when it is necessary to illustrate a part of the description. The report is not the appropriate place to present large amounts of program code.
  • A screenshot must contain only relevant content, meaning the program you created, rather than your desktop
  • If appendices are used, they must be referenced in the main text
  • Unused terms and other sample content must be removed from the report

Requirements for the standards and environment

The program must be written in the C programming language. By default, it is expected to comply with the C99 standard. Other standards (C90, C11, C17, C23) may be used if they provide added value. The justification must be included in the report.

In addition to the standard C libraries, you are allowed to use C POSIX and GNU C libraries and extensions. The use of other libraries must be agreed upon in advance.

Your solution will be compiled and tested in a Linux environment, equivalent to the one in the lab computers (OpenSUSE SLED-15 SP5, using GCC-12) or the recommendation for home setup  (Ubuntu Linux 26.04, using GCC-15 compiler or later). Compatibility with other operating systems (Windows, MacOS) is not required.

Solution requirements

Your code must adhere to the practices covered so far. Among other things, the following requirements must be met:

  • Must not use goto  statements
  • Must not use global variables
  • Must not use variable length arrays (VLA – variable length array)
  • Must not contain unused elements (e.g. libraries, variables).
  • No more than 20 results may be calculated and displayed
  • All inputs except for the step count must support real numbers
  • The code must be divided into functions
    • Compose your functions based on the practices learned and follow the coding style requirements
    • No function including the main function, may contain  spaghetti code
    • The main()  function must be the first function in your code file. All user defined functions should be placed after the main function
  • Code must adhere to the coding style, including (but not limited to):
    • Coding style is uniform throughout the file(s)
    • All code files have an appropriate header with the author’s details, date, and a short description
    • The code is commented
    • Clear and self-explanatory variable, macro and function names
    • The code is indented, lines are within the maximum allowed length and spaces are put where required
    • No magical numbers
Algorithm requirements

General requirements:

  • The algorithm is presented as a UML activity diagram that complies with the standard
  • The diagram divides your algorithm into logical parts using swim lanes (partitions)

Make sure to avoid the following common errors:

  • Each decision node has a condition that selects the outgoing control flow
  • All control flows exiting from a decision node are labelled with the appropriate condition (e.g. true/false, switch case expressions)
  • If multiple alternative control flows merge following a conditional branch, a merge node must be used
  • All control flows exiting a decision node must be reachable (i.e. logically viable)
  • No dead ends – it must be possible to reach at least one end node from any part of the diagram
  • No infinite loops – It must always be possible to exit them
  • Only show activities relevant do the solution, do not include cosmetic actions (e.g. print a horizontal line)

Extra task for bonus points

You can earn up to 15 bonus points from this task. In order to get any points, you must document the added features in the report. It is possible to obtain partial bonus points if not all requirements are met, however only if the added features are documented in the report.

To earn bonus points, the following requirements must be met in addition to the basic requirements

  • The code must use arrays to store the function’s arguments and values
    • Populating the arrays and displaying their contents must take place in separate functions.
  • In addition to allowing the user input for the values used for calculations, the program must contain hard-coded sets of initial values that the user can choose.
    • The user must be able to choose whether to enter the initial values themselves or use a preset set of values
    • The program must contain at least two preset sets of values demonstrating how it works in different situations
  • Program must be able to calculate multiple sets of results without exiting. The user must also have the option to close the program.
  • Add a top-level numbered heading to the report called “Extra task”
    • Describe the added features
    • Describe the chosen input sets and why they were chosen

Deadlines

A complete homework assignment must be submitted no later than 18.10.2026 23:59:59 (local time)

If we have additional questions about the homework or there are doubts about its authorship, the homework will receive 0 points until it has been successfully defended.

If necessary, we will enforce the rules and guidelines of [Procedure for processing a student’s violation of academic practices and contemptible behavior in the School of Information Technologies]

The lockdown date for submitting and defending the homework is specified on the introductory slides. Submitting your homework after that date will not be possible.

Submitting your work

You need to submit the report in PDF format and all the necessary code files to compile your program.

Naming schema: HW1_<Surname>_<studentcode>

Example:

HW1_Smith_123456MVEB_code.c
HW1_Smith_123456MVEB_report.pdf

Homework is submitted through Moodle.

Results and feedback

Once your work has been checked, you will find your points and feedback in Moodle. If everything was done well, feedback may be absent.

Fixing your homework

You are allowed to fix and improve your homework until the homework lockdown date. Be aware that if you submit your homework less than two weeks before the lockdown date, there may not be enough time for it to be graded and for you to make corrections.

Revised homework must be defended.

To revise your homework, first review the feedback on your work. Then contact the lecturer to agree on the revision process.

NB! If revision requires changing more than half of the work, it will be treated as a new submission, and a late-submission penalty may be deducted based on the date the revision is submitted.