AllRounder.ai
Chapters in this course

Enrol to start learning

Reading is open to everyone. Enrolling is free, and it is what unlocks the audio lessons, practice tests and progress tracking.

Enrol free

13.3.2. File Pointers

  • This section

    Practice test

    10 questions on this section. Wrong answers show you what to read again.

    Sign up to take it
  • Whole chapter

    Revision test

    Mixed questions from across the chapter. Your answers get marked.

    Sign up to take it
  • Quick

    Flashcard drill

    2 cards from this lesson. Good the night before a test.

Try these first

  1. 1.

    What function is used to set the position of the get pointer?

    Hint

    It starts with 's' and is related to getting!

  2. 2.

    Which function retrieves the current position of the put pointer?

    Hint

    It tells you where you've last written!

  3. 3.

    What is seekg() used for?

    • Setting the write position
    • Setting the read position
    • Getting the current position
    Hint

    Remember which pointer deals with reading!

  4. 4.

    Which of the following functions retrieves the current position of the get pointer?

    • tellg()
    • tellp()
    • seekp()
    Hint

    Think about which function begins with 't' for telling!

  5. 5.

    Write a program that opens a file, seeks to the end, writes data, and then goes back to the beginning to read it back.

    Hint

    Don't forget to open the file in the correct mode!

  6. 6.

    Explain the implications of calling tellg() directly after a seekp() operation.

    Hint

    Consider what happens to file pointers when you write before reading.

Exercises

Total Questions

2

Estimated Time

4 min

Passing Score

70%

Instructions

  • Read each question carefully
  • You can use hints if you need help
  • Complete all questions before submitting

3 more questions available

Enrol free

Quiz

Total Questions

2

Estimated Time

4 min

Passing Score

70%

Instructions

  • Read each question carefully
  • You can use hints if you need help
  • Complete all questions before submitting

1 more question available

Enrol free

Challenge Problems

Total Questions

2

Estimated Time

4 min

Passing Score

70%

Instructions

  • Read each question carefully
  • You can use hints if you need help
  • Complete all questions before submitting