0% found this document useful (0 votes)
36 views2 pages

Esc101: Tutorial 8: 7Th March, 2017

The document provides an overview of topics to be covered in Tutorial 8, including: 1) Discussing multidimensional arrays in C and sample questions involving printing sums and finding maximum elements in arrays. 2) Discussing recursion with an example of Euclid's greatest common divisor algorithm. 3) Returning midterm exam copies after 12:35pm and discussing solutions briefly, as well as processes for regrading requests and errors.

Uploaded by

Phoebix
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views2 pages

Esc101: Tutorial 8: 7Th March, 2017

The document provides an overview of topics to be covered in Tutorial 8, including: 1) Discussing multidimensional arrays in C and sample questions involving printing sums and finding maximum elements in arrays. 2) Discussing recursion with an example of Euclid's greatest common divisor algorithm. 3) Returning midterm exam copies after 12:35pm and discussing solutions briefly, as well as processes for regrading requests and errors.

Uploaded by

Phoebix
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

ESc101: Tutorial 8

7th March, 2017

1. Discuss Multidimensional arrays.


Suppose we declare int mat[2][3]. Discuss the meaning of the three variables mat[i][j],
mat[i], mat (without getting into the pointer data type of C).
Recall the 1D array referencing by [], and the dereferencing by *, to generalize to 2D:
Compare the first two with their equivalents *(*mat+3*i+j) or *(*(mat+i)+j), *(mat+i).

2. Sample questions:

- Take an integer matrix and print the sum of the elements in the boundary of the matrix.
- Take an integer square matrix and display the maximum element in row 1, 2nd max in
row 2, 3rd max in row 3 and so on.
- Display the following pattern for a given value of n ≤ 999. For example when n = 4,
display
1
2 4
3 6 9
4 8 12 16
You can use a placeholder such as %4d to display the integers.
- Multiply a matrix by a scalar OR a vector. (Don’t do matrix multiplication as it’s a lab
assignment.)

3. Discuss Recursion. Sample question:

- Euclid’s gcd pseudocode:


gcd(a, b)
if b = 0
return a
else
return gcd(b, a mod b)

4. After 12:35pm you could return the midSemExam copies. Discuss the solutions briefly.

- If the students have any regrading requests, ask them to write on the front page of their
answer booklet and submit it back to you (same for totaling errors) immediately.

1
- Collect these (regrading) scripts back from the students and discuss with me before
changing their marks.
- The remaining students can take away their scripts.

You might also like