CS代考 ICT283 Exam S1 2021 – cscodehelp代写

ANSWER THESE QUESTIONS ON THE EXAMINATION PAPER IN THE SPACE PROVIDED

ICT283 Exam S1 2021
Family/surname: ……………………………

Copyright By cscodehelp代写 加微信 cscodehelp

First Name: …………………………………..
Student ID: ……………….
Email: …………………..

This exam is personalised to you only. Your exam answer will make use of work that you had to do yourself during the semester.
Do not use anyone else’s work as the plagiarism checker and/or exam marker will pick up similarities in the answers and this is considered cheating.
No marks will be awarded if you copy/paste any content, including material from lecture notes, textbook, revision/studies/labs/assignments or external sources without being asked to do so. An academic misconduct investigation can also be started.
If you are permitted to copy/paste, you must declare the source. If the source of any copy/paste answer is not declared, no marks will be awarded to that question.
Several questions depend on the work you have done in the labs and assignments. To get any mark for the relevant questions, you must use only your work from the specified lab or assignment in this exam. Even if you use a correct answer from somewhere else, you will not get any mark.
ANSWER THESE QUESTIONS ON THE EXAMINATION PAPER IN THE SPACE PROVIDED.
Please answer all questions and type your answers into the question paper. Some questions may have several parts. Marks for each question may be different but are indicated with the question.
Set an alarm that rings 5 minutes before the due time. You will need to submit the exam question and answer file by the due time even if you have not finished. Submission will be disabled in LMS after the due time.

To be allocated marks, your answers are to be provided within the designated locations labelled with “Start” and “End”. Do not change the layout or the structure of the question paper if you want your work to be marked. Font size for your answers should be between 10 point and 12 point non-bold. You can use any easily readable font face like Times Roman, Calibri, etc. Your answers need to be in black font on a white background.
Answer the questions as asked. There are no marks for regurgitation of memorised or copy/pasted code or answer when the code or answer is not relevant to the question. Do not provide non-relevant answers or code as no marks will be given for the question.
Unless it is specifically asked for, do not provide any implementation within the body of any class declaration. You will lose 50% of the marks for that question if the implementation is within the body of the class declaration. You can also lose 50% of the marks if you provide code that is not asked for. So do not clutter your answer with code that is not asked for.
For coding questions complete your answer in Codeblocks with the GNU C++ compiler provided to you in LMS. For marks to be allocated, do not use any other version. Set to C++11 standard and turn on all warnings in the Compiler settings (menu item Settings/Compiler Settings). Layout the code neatly: in Codeblocks, right click and select “Format use AStyle” in the code window. Once you have code that builds and runs, copy and paste that code as your answer into this document. The marks for the question depend very much on whether your code builds and runs, so use Codeblocks to assist you.
No marks are given for algorithms (or code) that is not carefully indented. The code or algorithm will not be looked at by the exam marker.
You can use the lecture notes, unit textbook and references as well as the other material that is permitted in the exam (indicated in the spreadsheet found in the Exam Preparation Pack updated for COVID-19). You must not copy/paste content from these sources as the plagiarism checker and/or the exam marker will also detect this. No marks are allocated if you copy/paste unless the question asks you to copy/paste from a given source. Unless you are asked to copy/paste, you should answer in your own words or write your own code.
In all cases, the source(s) used must be declared with each question. (e.g. Lab number and exercise number, lecture note number and slide number, Textbook chapter and section name, page number, etc…) as advised in the exam preparation pack. There can be situations where you believe you know the answer but do not remember the source. The plagiarism checker would detect if you copied/pasted from elsewhere.
If you did not use any source to help you answer, you must indicate that “NO SOURCES WERE USED” in each relevant question.
A number of questions that follow refer to the Vector class that you developed for Assignment 1 (or lab 5). STL data structures/algorithms were not permitted and are not permitted here. You must use only the template Vector code that you submitted in LMS. This means that when the assignment 1 (or lab 5) Vector is asked for, marks are only allocated if your own Vector is used. Do not use anyone else’s code as a match will get detected and no marks will be given. You may also be reported for a misconduct investigation.
If you had to change your Vector class (or any required lab/assignment work for the exam) to enable you to answer any question in this exam, a detailed and specific justification for each and every change is required. Provide the justification after the code within the Start and End sections. If the exam marker determines that the change(s) was not justifiable then your changes would not be accepted. Without the justification acceptable to the exam marker, no marks can be allocated to the question. There is more advice in the Question and Answer file (QandA) that you had access to prior the exam. It is essential that the answers you give are trackable back to you in this sit at home exam.
Please follow the instructions carefully.
Question 1

Copy only your original template Vector class from assignment 1 (or lab 5) into the folder “Original Vector” in the Q1 folder. If you copy anything else into this folder, this question will get no marks. This file needs to be identical to what you submitted for assignment 1 (or lab 5).
Indicate which version you have copied into the “Original Vector” folder (Assignment 1 or lab 5): ………….

You will be using your own template Vector class to implement a minimal but complete template Queue data structure. What this means is that you will create a template Queue class using the services provided by your own template Vector class. Note that STL data structures/algorithms were not permitted and cannot be used in this question. You should not convert your Vector class into a Queue class.
Reminder: If you had to change your Vector class (or any required lab/assignment work for the exam) to enable you to answer any question in this exam, a detailed and specific justification for each and every change is required. Provide the justification after the code within the Start and End sections. If the exam marker determines that the change was not justifiable then your changes would not be accepted. Without the justification acceptable to the exam marker, no marks can be allocated to the question. There is more advice in the Question and Answer file (QandA) that you had access to prior the exam. It is essential that the answers you give are trackable back to you.
To demonstrate that your Queue data structure works, write a test program that reads integer data from a file “data.txt”. The data is entered into your Queue data structure. Once the data is read in, your program will then access data from the Queue data structure and print to the screen. The test program will also perform a unit test of your Queue data structure.
Ensure everything is running and works as expected then copy/paste from Codeblocks into the Start and End sections below. Check indentation and capitalisation when copying here from Codeblocks.
Provide Queue.h and main.cpp (the test program) and data.txt in the Q1 folder. This means keep source, data and Codeblocks build mechanism in the Q1 folder
————————-Start: Minimal but complete template Queue class: Queue.h ——————

————————-End: Minimal but complete template Queue class: Queue.h —————— (12 marks)
————————-Start: Test program for your Queue class main.cpp ——————

————————-End: Test program for your Queue class main.cpp —————— (8 marks)
Question 2
This entire question deals with the practical from Topic 5 (lab work). You must use a debugger to help you understand what the code is doing and to answer this question. Screen captures of the debugger’s call stack and watches windows must be submitted. Note that the address values may be different when you last attempted this lab or attempted on a different machine.
As you will need to draw UML diagrams, check with the lecture notes to ensure that you are using the right diagram to demonstrate the relationships.
In the folder “Practical/ nesting and templates code example/code” you were provided with an example called “templats”. You would have studied this code before.
a. Using the staruml tool, draw a detailed UML diagram showing the relationships of type C in the file “templats.cpp”. Screen capture the UML diagram and paste the diagram below. Make sure that the diagram is clear so that marks can be awarded. Save the diagram in the Q2 folder as an image file in case the image does not display properly in this document. If the section below is blank (no sign of any image being present or was present) with no note that the image is in the Q2 folder, no marks will be awarded.
—————————Start of UML for type C in templats.cpp—————————–

—————————End of UML for type C in templats.cpp —————————— (6 marks)
b. Examine the code in templats.cpp using the Codeblocks debugger’s single-step mode. Show the sequence of subroutine and/or method calls for the two code lines shown below. You should assume that there are no inline optimisations and all code prior to the given two code lines have been executed. Also assume that whatever data that was loaded prior to the given lines have been loaded into the relevant objects. For method calls, the specific object whose method is being called must be identified clearly.

Screen capture the debugger’s call stack window and watch window at the point indicated in each task below. Paste the windows in the sections indicated below. You can screen capture each window individually or in one screen capture containing both the Watches and Call Stack windows for each task below. Ensure that the screen captures are readable, and, to be on the safe side, save the high resolution captured images into the Q2 folder with identifiable file names.
————————-Start: c.set(b); ——————

Sequence of calls when c.set(b); executes. Point out what parameters are passed with each call.
Screen capture both the watch and call stack of the debugger when the data member dat is actually set. Paste the image(s) of both windows, scale to fit on this page and label each pasted image (if separate images):
————————-End: c.set(b); —————— (4 marks)
————————-Start: cout << c; ------------------ Sequence of calls when cout << c; executes. Point out what parameters are passed with each call. Screen capture both the watch and call stack of the debugger when the data member dat is actually printed to screen (output to console). Paste the image(s) of both windows, scale to fit on this page and label each pasted image (if separate images): -------------------------End: cout << c; ------------------ (10 marks) Question 3 This question uses your template Vector data structure from either Lab 5 or Assignment 1. You cannot use any other Vector except your own. Be mindful of the advice given earlier in this document and in the Exam QandA file about making changes to your Vector. This Vector data structure is the same one used in the earlier question. a. Develop an efficient approach/algorithm where your Vector data structure would store all data, including duplicated data, using as little memory as possible. Note that storing each duplicated data in its own memory location is not memory efficient. Your approach/algorithm must not change the Vector data structure itself (do not change Vector.h) to cater for duplicate values. Use numerical examples to explain your approach/algorithm. ------------------Start: Explanation of your efficient approach ------------------ ------------------End: Explanation of your efficient approach ------------------ (4 marks) b. Write a C++ program that uses your template Vector data structure in Vector.h to demonstrate your memory efficient approach. Use numerical data that comes from a data file called mumbers.txt. In the designated space below, write your answer. Build and run in Codeblocks first. Check indentation and capitalisation when copying here from Codeblocks. Keep source, data and Codeblocks build in the Q3 folder. ----------------Start: C++ demonstration of memory saving scheme ------------------ Demonstration code including main routine and any other data structure/type: -----------------End: C++ demonstration of memory saving scheme ------------------ (16 marks) Question 4 a. Write pseudo-code for an efficient algorithm that puts the intersection of two sets, Set1 and Set2 into a third set, Set3. -----------------Start: Efficient set intersection algorithm---------------------------- Source of the algorithm (e.g. lecture file number, slide number, etc.): ____________ -----------------End: Efficient set intersection algorithm ---------------------------- (1 mark) b. What assumption(s), if any, would you make about Set1 and Set2 to enable you to have an efficient intersection algorithm? -----------------Start: Assumption(s) for efficient set intersection algorithm--------------- Source of the assumption (e.g. lecture file number, slide number, etc.): ____________ -----------------End: Assumption(s) for efficient set intersection algorithm --------------- (1 mark) c. Using C++, implement your efficient intersection algorithm in a template routine called intersection. The data elements in the Set class are stored in your own template Vector class that you had developed in Lab 5 and Assignment 1. You can assume the following declaration of class Set: template class Set {…..}; // contents are not relevant except as shown below.

The private declaration of the Set class that is of relevance to this question is
Vector dat; //Vector is your template Vector class from Lab 5/Assignment 1.
The intersection routine is a friend of the Set class.

Marks get allocated only if the methods of your own original Vector class that was provided in Q1/ Original Vector are used and, the algorithm in question 4a is implemented exactly.

An attempted stub of the required intersection routine is provided below. Identify and correct any error(s) and complete the stub.

—————–Start: Efficient set intersection C++ implementation———————–
class