COEN243-Past Exam2001

COEN243-Past Exam2001 - Course Number Section Programming...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Course Number Section Programming Methodology I COEN 243 Y, Z Examination Date Time # of pages Final Examination April 23, 2001 3 Hours 5 Instructor (s) Drs. M. Mehmet Ali, M. R. Talla Material allowed : No Yes Calculators allowed : No Yes Special Instructions: Attempt all seven questions. Handwriting should be clear and readable( preferably with pencil). Programs should be well commented. The quality of the programming will also be evaluated. Students should return the question paper after the exam. X X
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
1. Determine the values stored in each of the variables and the addresses held by each of the pointers in the following program, #include <iostream.h> int main ( ) { int x, y, *p, *q, *r; x = 50; q = &y; p = &x; r = q; *r = *p * 2; cout << x << " " << y << endl; return 0; } ( 5 points) 2. Explain the output of the following program ? Determine the type of parameter passing and the return types in each function as call by value, call by reference using reference parameter or call by reference using pointers, explain how you have arrived at the decisions. #include<iostream.h> int amodify ( int, int *); int &bmodify ( int * ); int *cmodify ( int &); int main ( ) { const int asize = 4; int j, a[asize] = {3, 12, 15, 5}; amodify ( a[0], &a[1] ); cout << bmodify ( &a[ 2 ] ) <<endl; cmodify ( a[ 3 ] ); for ( int j = 0; j < asize; j++) cout << a[j] << ", "; cout << endl; return 0; } int amodify ( int x, int *w ) { x = 6; *w = 8; return x; } int { int static w; w = *z + 4; return w; } { int static r = 5; r += q; return &r; } ( 7 points)
Background image of page 2
3. Given an ) * ( m m matrix it will be considered to be symmetric if the elements on the main diagonals are ones and elements off the diagonal are zero. Write a function symmetric that will receive a two-dimensional array and its size as input and determine if the matrix is symmetric as defined in this problem. The function will return true if the function is symmetric and false otherwise. Example: The following matrices are symmetric,
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/25/2010 for the course COEN 243 taught by Professor Talla during the Winter '01 term at Concordia Canada.

Page1 / 8

COEN243-Past Exam2001 - Course Number Section Programming...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online