CS 315
Homework Assignment 2
Assigned: December 6, 2024
Due: December 15, 2024, 23:59
Iteration Based on Data Structures in Dart, Go, Javascript, Kotlin, Python, Ruby, and Rust
Iteration based on a data structure is one of the fundamental means of applying an operation or function
to each element of the data structure given.
The data structure can be a string, array, array list, list, associative array, a linked list, or similar collection.
In such iteration statements, the control mechanism typically involves a call to an iterator function,
which returns the next element in the chosen order if one exists; otherwise, the loop terminates.
In programming tasks, you may end up maintaining a list of objects.
In this homework assignment, assume that you have to maintain a list of strings;
e.g., names of people, cities, etc, in seven different programming languages.
In this homework assignment, you will investigate the statements for iteration based on data structures
provided in six different programming languages:
Dart, Go, Javascript, Kotlin, Python, Ruby, and Rust.
You will investigate how the following design issues are addressed in these programming languages:
- Iteration statements provided,
- Data structures suitable for iteration,
- The way the next item is accessed.
For each language, explain how the design issues listed above are answered.
Support your explanation by giving two examples using different suitable data structures.
You can illustrate the answers to these questions, in different parts of a single program.
The example program must be complete, so that they can be executed directly.
The files must execute without error or warning.
You can use online compilers/interpreters for this homework.
For each language, prepare a single source code file that exemplifies and tests each issue, in the order given above.
Your example programs must be different than the code examples that may be available on the Internet.
Organize all of your experiments and their results and put them into a report.
The report should include Parts A, B, and C, as explained below:
Part A - Operations in each language (45 points)
For each language and each operation, give the sample code segments and the results of their execution.
You should explain what your example does, and the output, if generated.
Part B - Evaluation (10 points)
Your evaluation of these languages in terms of readability and writability of list operations.
Discuss, in your opinion, which language is the best for list operations.
Part C - Learning strategy (10 points)
A learning strategy is an individual's approach to completing a task.
In this section, discuss, in detail, the material and tools you used, and the experiments you performed.
Also talk about personal communication, if you had.
Give the URLs of the online compiler/interpreters you used to run your programs
Part D- Sample Codes (35 points)
The sample code files must compile and run without any errors.
Submission:
A single zip
or rar
file should be submitted containing the following files with given names:
- A single file for the Report, containing parts A, B, and C: ID_lastname_name_report.pdf (65 Points)
- A folder called, Codes, for Part D. The contents of the folder will be as follows:
- A single file for Dart code: ID_lastname_name.dart (5 points)
- A single file for Go code:ID_lastname_name.go (5 points)
- A single file for Javascript code: ID_lastname_name.html (5 points)
- A single file for Kotlin code: ID_lastname_name.kt (5 points)
- A single file for Python code: ID_lastname_name.py (5 points)
- A single file for Ruby code: ID_lastname_name.rb (5 points)
- A single file for Rust code: ID_lastname_name.rs (5 points)
Please upload the zip
or rar
file you created to Moodle before the due date.
Important Notes:
- Late submissions will be accepted, with 20 points (out of 100) deduction for each extra day.
- You may use the tutorials available on the Internet as a reference
but do not derive your example from the contents of the tutorials.
If you do so, your programs may be similar to others in the class,
which causes a disciplinary investigation.
- Collaboration on the homework is not allowed.