Sie sind auf Seite 1von 5

COMP1911 Exam

June 2014
Time allowed: 3 Hours
Total number of questions: 7
Total number of marks: 60
Questions are worth equal marks
Answer all questions
If you are unwell do not commence this exam - contact an exam supervisor.
If you become unwell contact an exam supervisor immediately and ask to speak to the lecturer (Andrew Taylor).
Special consideration requests made after this exam will be IGNORED.
You are not be allowed to leave during the rst hour of the exam or in the last 15 minutes.
You are permitted a single A4 sheet of paper in the exam. It must have your name and student number written
at the top, and be otherwise blank. You are not permitted to tear the paper. You are not permitted to retain
the paper. It will be collected by a supervisor.
If you need to go to the toilet, ask a supervisor.
If a problem of any type occurs or if you have a question, report them immediately to an exam supervisor but
continue working if possible.
You may be given extra time to compensate for any time lost due to computer or other problems.
1
Implementation Questions
Answer each question in a SEPARATE le. Each question species the name of the le to use.
Make sure you use EXACTLY this le name.
Submit these les using the submit command as described in each question. You may submit your answers as
many times as you like. The last submission ONLY will be marked.
If you have only a partial solution and the exam is about to end, submit it anyway.
The exam environment allows you to run a limited set of commands so you can test and debug your answers.
The exam environment logs all your actions.
The exam environment does not allow access to les in your CSE account or any other CSE account. It does
not allow access to the web or other network access
A C reference sheet is available on-line. Manual entries are also available. No other documents or les will be
available to you.
Question 1 (9 marks)
Place your answer to this question in a le named q1.c
Write a C program which given an integer as argument prints ...
Make your program behave exactly as indicated by the examples below.
Note your program should not print anything other than ....
You can assume your program is always given exactly 1 argument and it is always a positive integer.
No error handling is necessary,
........
........
........
........
........
........
........
........
........
........
........
........
........
........
........
........
........
........
Submit your answer to this question using the command: submit 1 q1.c
2
Question 2 (9 marks)
Place your answer to this question in a le named q2.c
Write a C program which:
* prints ........
* reads ........
* ........
* ........
For example, ........
You can assume ........
You can assume that the input is correct and that only ........
No error handling is nessary.
Your program must show exactly the same behaviour as the examples shown below.
........
........
........
........
........
........
........
........
........
........
........
........
........
........
........
........
........
........
........
........
Submit your answer to this question using the command: submit 2 q2.c
Question 3 (9 marks)
Place your answer to this question in a le named q3.c
Write a C program which ........ until the end of input and then prints ........
You can assume there is at least one line of input and at most 100 lines of input.
You can assume ........
No error handling is necessary.
Make your program exactly the same output as the examples below.
Reminder: end of input is signaled on a Linux terminal by typing the control-d key sequence. In the examples
below the control-d key sequence would have been typed after ........
........
........
........
........
........
........
........
........
........
........
........
Submit your answer to this question using the command: submit 3 q3.c
3
Question 4 (9 marks)
........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........
Make your program behave exactly as indicated by the examples below.
It must produce exactly the same output as below.
........
........
........
........
........
........
........
........
........
........
........
You can assume ........
No error-checking is necessary.
Submit your answer to this question using the command: submit 4 q4.c
Question 5 (8 marks)
Place your answer to this question in a le named q5.c
Write a program ........ ........
........ ........
Make your program behave exactly as indicated by the examples below.
It must produce exactly the same output as below.
Here is how your program should behave :
........
........
........
........
........
........
........
........
........
........
........
........
........
Submit your answer to this question using the command: submit 5 q5.c
4
Question 6 (8 marks)
Place your answer to this question in a le named q6.c
........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........
For example given this input:
........
........
........
It should produce this output:
........
........
........
........ ........ ........ ........ ........
No error-checking is necessary.
Submit your answer to this question using the command: submit 6 q6.c
Question 7 (8 marks)
........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........ ........
........
........
........
........
........
........
........
........
........
........
........
........
........
........
........
Submit your answer to this question using the command: submit 7 q7.c
5

Das könnte Ihnen auch gefallen