The distribution of marks is as follows:
You should keep this paper confidential. Sharing it, DURING or AFTER the exam is prohibited.
man pages) during the exam.The course has ONE hurdle in the final exam that you must meet to pass the course:
Please note, you are NOT required to pass the Linked list hurdle to pass COMP1911.
The course has TWO hurdles in the final exam that you must meet to pass the course:
This exam contains example array hurdle questions only . Example linked list hurdle questions will be in the Week 10 Prac Exam.
submit command: submit labexam_qX (where X is the question number)..c file. Multi-file programs will not be accepted in submission.autotest labexam_qXsystem()By sitting or submitting an assessment on the scheduled assessment date, a student is declaring that they are fit to do so and cannot later apply for Special Consideration.
If, during an exam you feel unwell to the point that you cannot continue with the exam, you should raise you hand and inform an invigilator, who will provide advice as to the best course of action.
If you experience a technical issue, you should raise your hand and wait for an invigilator to assist.
1511 fetch-labexam labexam_q1
The function sum_between_negatives takes in a
one-dimensional array of integers, array,
with exactly size number of elements.
Your sum_between_negatives function should
find the first negative number and the
last negative number in the array, and return the sum of
all values between them.
The first and last negative numbers should not be included in the sum.
For example, given the array:
{3, -2, 4, 5, -1, 6, -3, 8}
The function should return 14, since:
For example, given the array:
{1, 2, -3, 4, 5}
The function should return 0, as there is only one negative number in the array.
For example, given the array:
{-4, -7, 3, 2}
The function should return 0, as there are no values between the first negative number and the last negative number.
labexam_q1.c also contains
a simple main function which allows you to
test your sum_between_negatives function.
This function will not be marked.
Your sum_between_negatives function will be
called directly in marking.
size will have a value between 1 and 100, inclusive.sum_between_negatives function should return a single integer.sum_between_negatives function should not modify the array.sum_between_negatives function should not print anything (e.g., no printf).sum_between_negatives function should not call scanf or perform any input.sum_between_negatives function should return 0 if there are fewer than two negative numbers in the array.1511 autotest-labexam labexam_q1
1511 fetch-labexam labexam_q2
first_balanced_row, given a two-dimensional
array of characters, should return the index of the first row
which has an equal count of vowels and consonants. If no rows
are balanced, the function should return -1.
first_balanced_row will be passed a two-dimensional array with:
num_rows rows, andNUM_COLS (#define'd to 6) columns.For example, if the 2D array contains these rows:
{'a', 'b', 'e', 'f', 'i', 'j'},
{'a', 'e', 'i', 'o', 'u', 'a'},
{'b', 'c', 'd', 'f', 'g', 'h'}
Your function should return 0 because the first row contains:
'a', 'e', and 'i''b', 'f', and 'j'For example, if the 2D array contains these rows:
{'a', 'e', 'i', 'o', 'u', 'a'},
{'b', 'c', 'd', 'f', 'g', 'h'}
Your function should return -1 because neither row contains an equal number of vowels and consonants.
For example, if the 2D array contains these rows:
{'a', 'e', 'i', 'o', 'u', 'a'},
{'a', 'b', 'c', 'd', 'e', 'i'},
{'b', 'c', 'd', 'f', 'g', 'h'}
Your function should return 1 because the second row is the first row with an equal number of vowels and consonants.
The supplied file contains a sample main
function that you can use to test
first_balanced_row. During marking,
first_balanced_row will be called
directly; the sample main function will not be
tested or marked.
'a',
'e',
'i',
'o' and
'u'.
first_balanced_row should return a single
integer (the row index).
first_balanced_row should not change the
array it is given.
first_balanced_row should not call scanf
(or getchar or fgets).
first_balanced_row can assume the array
will always contain at least one row.
first_balanced_row should not print
anything. It should not call printf.
main
function. It is provided only for testing and will not be marked.
1511 autotest-labexam labexam_q2
1511 fetch-labexam labexam_q3
You have been provided with a file called labexam_q3.c.
The code in labexam_q3.c is meant to do the following:
struct day.Unfortunately, there are some problems with the provided program. Once fixed, your program should match the following examples exactly:
dcc labexam_q3.c -o labexam_q3 ./labexam_q3 Enter leaving time: 09 00 Enter wake up time and time it took to get ready for 3 days: Day 1 Enter wake up time: 07 30 Enter how long it took to get ready (minutes): 63 Day 2 Enter wake up time: 08 01 Enter how long it took to get ready (minutes): 59 Day 3 Enter wake up time: 07 54 Enter how long it took to get ready (minutes): 80 Checking if you were late... You were late for 1 day(s). ./labexam_q3 Enter leaving time: 09 00 Enter wake up time and time it took to get ready for 3 days: Day 1 Enter wake up time: 07 30 Enter how long it took to get ready (minutes): 20 Day 2 Enter wake up time: 07 45 Enter how long it took to get ready (minutes): 25 Day 3 Enter wake up time: 08 06 Enter how long it took to get ready (minutes): 25 Checking if you were late... Great! You were not late! ./labexam_q3 Enter leaving time: 15 34 Enter wake up time and time it took to get ready for 3 days: Day 1 Enter wake up time: 11 11 Enter how long it took to get ready (minutes): 273 Day 2 Enter wake up time: 14 00 Enter how long it took to get ready (minutes): 95 Day 3 Enter wake up time: 17 12 Enter how long it took to get ready (minutes): 3 Checking if you were late... Late every day!
There are currently a number of issues in the code that you must fix for the code to work correctly, and produce the desired output. This may include changing lines, moving lines, or removing lines. Submit your working version of the code.
1511 autotest-labexam labexam_q3
1511 fetch-labexam labexam_q4
You have been provided with a file called
labexam_q4.c.
The code in labexam_q4.c is meant to do
the following:
Once fixed, your program should match the following examples exactly:
dcc labexam_q4.c -o labexam_q4 ./labexam_q4 Enter a string: Hello World Result: 1ello 2orld There are 2 capital letters in the string. ./labexam_q4 Enter a string: smALL Result: sm123 There are 3 capital letters in the string. ./labexam_q4 Enter a string: Hi Result: 1i There are 1 capital letters in the string. ./labexam_q4 Enter a string: all lowercase Result: all lowercase There are 0 capital letters in the string. ./labexam_q4 Enter a string: UPPERCASE Result: 123456789 There are 9 capital letters in the string. ./labexam_q4 Enter a string: AlTeRnAtInG lEtTeRs Result: 1l2e3n4t5n6 l7t8e9s There are 9 capital letters in the string.
There are currently a number of issues in the code that you must fix for the code to work correctly, and produce the desired output. This may include changing lines, adding lines, or removing lines. Submit your working version of the code.
1511 autotest-labexam labexam_q4