Introduction to computer systems architecture and programming
Introduction to computer systems architecture and programming
Introduction to computer systems architecture and programming
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
168 <strong>Introduction</strong> <strong>to</strong> <strong>computer</strong> <strong>systems</strong> <strong>architecture</strong> <strong>and</strong> <strong>programming</strong><br />
Chapter 10: Control structures ............................................................................. 95<br />
Aim of the chapter ....................................................................................................... 95<br />
Learning outcomes ...................................................................................................... 95<br />
Essential reading ......................................................................................................... 95<br />
Further reading ............................................................................................................ 95<br />
<strong>Introduction</strong> ................................................................................................................ 95<br />
Decisions: the if statement ........................................................................................ 96<br />
Comparing values ........................................................................................................ 97<br />
Comparing strings ....................................................................................................... 98<br />
Nested if statements ............................................................................................... 100<br />
Repetition: the while statement ............................................................................. 100<br />
Repetition: the for statement .................................................................................. 104<br />
Repetition: the do statement .................................................................................... 104<br />
Nested loops ............................................................................................................. 105<br />
A reminder of your learning outcomes ........................................................................ 106<br />
Sample examination question .................................................................................... 107<br />
Chapter 11: Arrays .............................................................................................. 109<br />
Aim of the chapter ..................................................................................................... 109<br />
Learning outcomes .................................................................................................... 109<br />
Essential reading ....................................................................................................... 109<br />
Further reading .......................................................................................................... 109<br />
<strong>Introduction</strong> .............................................................................................................. 109<br />
Creating an array ....................................................................................................... 110<br />
Accessing individual array elements ........................................................................... 110<br />
Array as reference type .............................................................................................. 111<br />
Two-dimensional arrays ............................................................................................. 112<br />
A reminder of your learning outcomes ........................................................................ 113<br />
Sample examination question .................................................................................... 113<br />
Summary of Part 2 <strong>and</strong> Conclusion .................................................................... 115<br />
Appendix 1: Sample examination paper .................................................................. 117<br />
Appendix 2: Guidance on answering the Sample examination paper ........................... 121<br />
iv