Hong Kong University of Science and Technology



Hong Kong University of Science and Technology

COMP104: Programming Fundamentals and Methodology

Fall 2004, Lecture Section 1, 2, 3

Final Examination

Friday, Dec.17, 2004 08:30 – 11:30AM

Student Name: key Lecture Section:

Student ID: Lab Section/TA Name:

Instructions:

1. This is a closed-book, closed-notes examination, calculator is also not allowed.

1. Check that you have all 21 pages (including this cover page).

2. Write your name, student ID, lecture section, lab section and TA name on this page.

3. Please circle your answer.

4. Answer all questions in the space provided. Rough work should be done on the back pages.

|Question |Topic |Score |

|1 |Strings |/10 |

|2 |File I/O |/5 |

|3 |Pointers |/9 |

|4 |Simple Linked List |/10 |

|5 |Algorithms on Linked List |/14 |

|6 |Doubly Linked List |/18 |

|7 |Classes |/10 |

|8 |Dynamic Classes/ADT |/24 |

|Total | /100 | /100 |

Question 1 : Strings (10 marks)

a) What is the output of the following program? (1 mark)

#include

#include

using namespace std;

void main(){

string x = "2";

string y = "3";

string z = "5";

if(x+y == z){

cout ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download