COMP1521 Final Exam - Part 1 of 2

November 2019

Time allowed: 30 minutes

Time allowed for entire exam: 3 hours

Total number of questions this part: 17

Total number of questions entire exam: 27

Total number of marks this part: 34

Total number of marks entire exam: 134

Answer all questions

Part 1

The answers to Part 1 must be entered into this application. Submit your answers to this part by pressing the save button on this application. You may submit your answers as many times as you like. The last submission 'ONLY' will be marked.

Answers to this part must be submitted in the first 30 minutes of the exam. Submission after the first 30 minutes will not be accepted.

During the first 30 minutes the only programs you can run in the exam environment are the applications to enter written answers, clock (xclock), calculator (xcalc) and the viewers for cheatsheets and other documentation.

Question 1 (2 marks)

The file q1.c contains this C Code:

........
........
........
........
........
........
........
........
........

q1.c is compiled with dcc on a CSE machine like this:

........
........

It compiles successfully. No errors or warnings are produced by dcc. The program is run like this:

........

What does this program print?

Enter as your answer the output the program produces. Do not enter any extra characters. Do not write \n for a new line character. Do not enter any explanation.

Enter just the output the program produces.

This program executes correctly. It does not produce an error message.

__________ __________ __________ __________ __________

Question 2 (2 marks)

The file q2.c contains this C Code:

........
........
........
........
........
........
........
........
........

q2.c is compiled with dcc on a CSE machine like this:

........
........

It compiles successfully. No errors or warnings are produced by dcc. The program is run like this:

........

What does this program print?

Enter as your answer the output the program produces. Do not enter any extra characters. Do not write \n for a new line character. Do not enter any explanation.

Enter just the output the program produces.

This program executes correctly. It does not produce an error message.

__________ __________ __________ __________ __________

Question 3 (2 marks)

The file q3.c contains this C Code:

........
........
........
........
........
........
........
........
........

q3.c is compiled with dcc on a CSE machine like this:

........
........

It compiles successfully. No errors or warnings are produced by dcc. The program is run like this:

........

What does this program print?

Enter as your answer the output the program produces. Do not enter any extra characters. Do not write \n for a new line character. Do not enter any explanation.

Enter just the output the program produces.

This program executes correctly. It does not produce an error message.

__________ __________ __________ __________ __________

Question 4 (2 marks)

The file q4.c contains this C Code:

........
........
........
........
........
........
........
........
........

q4.c is compiled with dcc on a CSE machine like this:

........
........

It compiles successfully. No errors or warnings are produced by dcc. The program is run like this:

........

What does this program print?

Enter as your answer the output the program produces. Do not enter any extra characters. Do not write \n for a new line character. Do not enter any explanation.

Enter just the output the program produces.

This program executes correctly. It does not produce an error message.

__________ __________ __________ __________ __________

Question 5 (2 marks)

The file q5.c contains this C Code:

........
........
........
........
........
........
........
........
........

q5.c is compiled with dcc on a CSE machine like this:

........
........

It compiles successfully. No errors or warnings are produced by dcc. The program is run like this:

........

What does this program print?

Enter as your answer the output the program produces. Do not enter any extra characters. Do not write \n for a new line character. Do not enter any explanation.

Enter just the output the program produces.

This program executes correctly. It does not produce an error message.

__________ __________ __________ __________ __________

Question 6 (2 marks)

Consider this C code:

........
........
........
........
........
........
........
........
........

........

Do not enter any extra characters. Do not write \n for a new line character. Do not enter any explanation.

........

__________

Question 7 (2 marks)

The file q7.c contains this C Code:

........
........
........
........
........
........
........
........
........

q7.c is compiled with dcc on a CSE machine like this:

........
........

It compiles successfully. No errors or warnings are produced by dcc. The program is run like this:

........

What does this program print?

Enter as your answer the output the program produces. Do not enter any extra characters. Do not write \n for a new line character. Do not enter any explanation.

Enter just the output the program produces.

This program executes correctly. It does not produce an error message.

__________ __________ __________ __________ __________

Question 8 (2 marks)

The file q8.c contains this C Code:

........
........
........
........
........
........
........
........
........

q8.c is compiled with dcc on a CSE machine like this:

........
........

It compiles successfully. No errors or warnings are produced by dcc. The program is run like this:

........

What does this program print?

Enter as your answer the output the program produces. Do not enter any extra characters. Do not write \n for a new line character. Do not enter any explanation.

Enter just the output the program produces.

This program executes correctly. It does not produce an error message.

__________ __________ __________ __________ __________

Question 9 (2 marks)

........
........
........
........
........
........
........
........
........

Question 10 (2 marks)

........
........
........
........
........
........
........
........
........

[A] ........

[B] ........

[C] ........

[D] ........

[E] ........

Select exactly 1 of the above boxes.

Question 11 (2 marks)

........
........
........
........
........
........
........
........
........
Select only 1 of the answers below.

[A] ........

[B] ........

[C] ........

[D] ........

[E] ........

[F] ........

Select exactly 1 of the above boxes.

Question 12 (2 marks)

........
........
........
........
........
........
........
........
........

[A] ........

[B] ........

[C] ........

[D] ........

[E] ........

Select exactly 1 of the above boxes.

Question 13 (2 marks)

........
........
........
........
........
........
........
........
........

[A] ........

[B] ........

[C] ........

[D] ........

[E] ........

[F] ........

Select exactly 1 of the above boxes.

Question 14 (2 marks)

........
........
........
........
........
........
........
........
........
Do not enter any extra characters.

Do not enter any explanation.

__________

Question 15 (2 marks)

........
........
........
........
........
........
........
........
........
Your answer should be a single integer.

Do not enter any extra characters.

Do not enter any explanation.

__________

Question 16 (2 marks)

........
........
........
........
........
........
........
........
........
Do not enter any extra characters.

Do not enter any explanation.

__________

Question 17 (2 marks)

........
........
........
........
........
........
........
........
........

[A] ........

[B] ........

[C] ........

[D] ........

Check between 0 and 4 of the above boxes.

Submission

When you are finished use the "Save" Button in the top left corner to submit your answers and then use the "Quit" button to exit.