COS1511 Oct/Nov 2024 exam paper — questions

🔒 Scan locked

The paper, as written

Every question, by topic

  1. Question 1.1 · Loops: for, while and do-while · 2 marks

    Consider this code fragment: int x = 0; while ( x < 8 ) cout << x << " "; x++; cout << x << endl; What output does this fragment produce?Show the full question
  2. Question 1.2 · Code tracing and variable diagrams · 2 marks

    Given the statements: int x, y, z; y = 10; z = 3; x = y * z - 3; what value does x hold afterwards?Show the full question
  3. Question 1.3 · Code tracing and variable diagrams · 2 marks

    Given the statements: int x; x = x + 15; what value does x hold afterwards?Show the full question
  4. Question 1.4 · Code tracing and variable diagrams · 2 marks

    What output is produced by the statement: cout << "Where is the \\" << endl; ?Show the full question
  5. Question 1.5 · Code tracing and variable diagrams · 2 marks

    Given the statements: int x; x = 19 % 5; what value does x hold afterwards?Show the full question

The full Spot Map and the marks by year — and this paper’s scan.