Professional Documents
Culture Documents
1. DATA FAULTS
a) Are all program variables initialized before their values are used?
i. data: This variable stores the data read from a CSV file.
ii. grouped data: This variable stores the data grouped by course code and section.
iii. labs: This variable stores a list of lab names.
iv. schedule: This variable stores the lab distribution schedule.
These are some of the variables that have been initialized before their values are used
This is an example of constant used. The number of labs should be definite and not
change.
c) Should the upper bound of arrays be equal to the size of the array or Size -1?
i. data: This variable is used as a list to store data read from a CSV file. Each
element in data is a row of data from the CSV file.
ii. grouped_data: This variable is a dictionary where the keys are strings and the
values are lists. Each value list contains rows of data from the CSV file that
belong to the same group.
iii. class_names: This variable is a list of strings that stores the names of classes
extracted from the data. Each element in class_names is a string representing a
class name.
iv. solutions: This variable is a list of tuples. Each tuple represents a solution for a
class, containing the class name, assigned lab, course name, and faculty.
d) If character strings are used, is a delimiter explicitly assigned?
In the Python program, since the delimiter is not explicitly specified, it is assumed to
be a comma (,).
In the program, there are no instances where a possibility of buffer overflow could occur.
The use of the Python programming language the risk of buffer overflow is significantly
reduced mainly handled by the interpreter.
2. CONTROL FAULTS
ii. In the check_feasibility function, the condition if len(data) > len(labs): checks if
there are more classes scheduled than available labs for a given group. This is
correct for checking feasibility based on the number of labs available.
In the program, the loops are structured in a way that ensures they will terminate
For example: -
i. The for row in reader: loop in the read_csv function reads each row from the
CSV file. Since the file has a finite number of rows, this loop will terminate
after reading all rows.
iv. The for class_data in group_data: loop in the solve_csp function iterates over
each class in a group. Similar to the previous loop, this loop will terminate
after iterating over all classes.
In our program, there are no case or switch statements that have been used
e) If a break is required after each case in case statements, has it been included?
3. INPUT/OUTPUT FAULTS
i. file_path: This variable is used in the read_csv function to specify the path to the
CSV file that needs to be read.
ii. data: This variable is used to store the data read from the CSV file in the read_csv
function. It is also used in the group_data function to group the data based on
certain criteria.
iii. groups and labs: These variables are used in the check_feasibility function to
check if there are enough labs available for each group.
iv. group_data and labs: These variables are used in the solve_csp function to solve
the Constraint Satisfaction Problem (CSP) for each group.
b) Are all output variables assigned a value before they are output?
i. The schedule variable is assigned a value in the upload_file function when the
lab distribution schedule is generated using the generate_lab_distribution
function. This schedule is then passed to the render_template function to be
displayed in the 'schedule.html' template.
The program is well implemented in a manner that reduces the risk of corruption.
However, in the uploading of the CSV files, it is important to make sure that the files
actually uploaded are validated CSV files and do not contain any malicious content.
4. INTERFACE FAULTS
a) Do all function and method calls have the correct number of parameters?
Yes, all function and method calls in the provided code have the correct number of
parameters. Each function is called with the expected number of arguments, and there are
no missing or extra parameters in any of the function calls.
Yes, in the provided code, the formal and actual parameter types match. The functions
are defined with specific parameter types (e.g., strings, lists) and are called with
arguments that match these types. There are no type mismatches between the formal
parameter definitions and the actual arguments passed to the functions.
Yes, the parameters in the code are in the correct order. In each function definition, the
parameters are listed in the same order as they are used in the function body. There are no
instances where the order of parameters is incorrect.
d) If components access shared memory, do they have the same model of the shared
memory structure?
In the provided Flask application, there are no explicit shared memory structures being
accessed by different components. Each function operates on its own local variables and
parameters. However, the application does use a shared configuration variable
UPLOAD_FOLDER within the Flask app.config object, which is used to specify the
folder where uploaded files are saved temporarily.
In the provided Flask application, there are no linked structures being used. However, the
application does use dictionaries (grouped_data) to group data, which could be
considered a form of linking.
Yes, space has been allocated correctly. It does create and manipulate data structures
such as lists and dictionaries based on the input CSV file and the CSP solution. These
data structures are dynamically allocated and managed by Python's memory management.
c) Is space explicitly deallocated after it is no longer required?
The program has effectively considered some error conditions, such as checking if the
number of classes scheduled exceeds the number of available labs and raising a FeasibilityError
in that case. Additionally, the code includes error handling for the FeasibilityError exception and
renders an error message in the HTML template.
Another main error is where a student tries to register for courses with overlapping schedules.
This has also been taken into account