Mock examination

3 pages

Please download to get full document.

View again

of 3
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
this link gives information about an online mock examination
  1 Introduction The C programming course CM100138 is assessed by a sat examination andalso an on-line examination. The sat examination is of the traditional kind,taking place in a room; past papers are available. The online examination is inplace of coursework and is a kind of assessment you may not have met before.This mock examination emulates the real online examination to give you someexperience of the real online exam.The emulation is as close as possible, but it necessarily  differs in some im-portant ways which are explained at the bottom of this paper. You may careto take this paper with you read about the differences after your mock onlineexamination. 2 The mock online examination Your lab tutor will tell you how to download a simple calculator program, called calc.c and two associated data file called and test.out . Do as follows.(1) Download the program and data files into your C workspace. (2) Completethe assignment below. (3) Send your the documents specified in the assignmentto the email address given to your by your lab tutor. Note: Follow the above instructions exactly. If you send anything otherthan is required, your tutor is not obliged to mark anything. In the real exammarks are given for the ability to obey instructions. 2.1 The assignment The calculator program was demonstrated in class. It is capable of addition andmultiplication. Input is via the keyboard, unless redirected to a file. Output isvia the terminal, unless redirected to a file. The calculator processes characterson the input stream as follows ã n the next input token is a number which is read and placed at top of thecalculator’s store. ã + removes the the top two number in store, adds them and stores theresult at the top. ã * removes the the top two number in store, multiplies them and stores theresult at the top. ã q Quits the program. ã Any other characters on the input stream are ignored.After each input token is processed, the calculator prints the current value inthe top of its store.The assignment comes in several parts, do each part strictly in order1  Debugging syntax errors 1. Include your name and email in your program using a comment as thefirst line of the program.2. calc.c contains several syntax errors. Correct these errors.3. Running you code with the input file called . This should outputidentical to test.out . Test your corrected code by making sure this happens. Debugging runtime errors Some users have complained that the program sometimes give the wrongvalues. In real industrial situation you would be expected to find out why, andfix the problem. Here you are told it is because the the calculators store haslimited size. Rather than fix the problem you must warn users if they try tostore too many numbers. The program must issue the warning store full if the user tries to exceed the calculators limits, and too few numbers if the usertries to multiply or add numbers when the store contains less than two numbers.4. Emulate the problem by change the store size to have a limit of 4 numbers.You are expected to find out how to do this for yourself. Convince your self youhave emulated the problem by running the program using an input file of yourown devising called .5. Devise a solution and code it into calc.c. The manner of solution isup to you, but you are strongly advised to look at lines of code such as i =newnumber( array, N, i ); . This is poor code for at least two reasons: (i)They change a variable that is important to the operation of the store outsidethe functions that control the store (these are the library functions). (ii) Thereis no way for the calling function to recognise whether the library function hasworked successfully or not.6. Test your program by showing that it issues appropriate warnings whenrun with as input. Redirect output to mytest.out . Further test yourcode by showing it produces the correct input when the supplied file is run. The calculator should not issue any warnings for this input.Here are some hints: (i) If you use pointers (or structures) then you can solvethe first problem in a neat way that open up the possibility of a neat solution tothe second solution. (ii) Think very carefully about which part of the programshould issue warnings, in particular consider whether library functions shoulddo more than srcinally intended. 2.2 What to submit, what to do next Change the name of your program calc.c to where [email] is replaced with the first part of your BUCS email address. For example, if your BUCS email is , then change you program name to calc.abc123.c . Do likewise to your and mytest.out data files.Email your program and both of your own test data files to the address givenby your tutor. You are reminded to submit nothing else.2  You program will be compiled and run on the data files you have submitted.It will also be run on data files held in private by the tutors. you will receivefeed back by email. The feed back is formative in nature, it does not contributeto your assessment. 3 Differences from the real online exam As mentioned, the mock online exam closely emulates the real online exam inthat you get to write code under the same conditions. This experiences is to bevalued, despite an important difference that is now explained.The real online examination will ask you to write a small application using libraries that you have already written as part of your laboratory work. Themock examination cannot assume you have written these libraries, of even thatyou know about libraries as that part of the course has not been taught whenthe mock examination is sat.As a reminder, the real online examination assumes that you have written libraries for the abstract data types Array2D int , Stack int and Btree int ,which support two dimensional arrays, stacks, and binary trees each containingthe int data type. Since these will be assessed, you must design and write themyourself.You will be asked to write an application that uses at least one of theselibraries. You will submit for marking the application, the libraries you used(but strictly not those you have not used), and any supporting documentationsuch as a Makefile . The implication is that your libraries have to be generic,and your coding skills improved compared to the level expected in the mockexamination.The real online examination serves several purposes at once: ã It emulates industrial conditions. Programmers in industry are typicallygiven tasks they have not seen before, and are required to use libraries tocomplete those tasks. The line-managers will more often than not requirethe task is completed in a given times. ã It tests your coding ability directly. There is no better test on one’s abilityto code than to be asked to write code. The compiler will not compile in-correct syntax, and a compiled program either produces a correct output,without crashing, or it does not. ã It guards against plagiarism. Some people have submitted beautifullywritten libraries, but an application so badly written it is not even C.The best explanation is that they have not written the library themselves,a conjecture supported when the same library is found to be submittedby another. This may be an extreme case, but even a difference in pro-gramming style is enough to warn an experienced C programmer that thelibrary and application may have different authors.3
Related Search
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks