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.2. Example of Bit Strings without Consecutive 0's

  • This section

    Practice test

    11 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 is C(1)?

    Hint

    Consider the valid strings of length 1.

  2. 2.

    List the valid bit strings of length 2.

    Hint

    Remember that two consecutive zeros are not allowed.

  3. 3.

    What is C(2)?

    • 1
    • 2
    • 3
    Hint

    Count the valid strings of two bits.

  4. 4.

    C(n) is defined as?

    • True
    • False
    Hint

    Remember what our function counts.

  5. 5.

    Using the recurrence relation, calculate C(6) and validate your answer.

    Hint

    Don’t forget to use the previous two values you computed.

  6. 6.

    Create a program that generates all possible n-bit strings and filters out those containing consecutive 0's. Verify its output for n = 5.

    Hint

    Try using recursive functions for bit generation.

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

4 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