User interface language: English | Español

Date November 2018 Marks available 3 Reference code 18N.1.HL.TZ0.6
Level HL Paper 1 Time zone no time zone
Command term Explain Question number 6 Adapted from N/A

Question

Explain the importance of the method isEmpty() when constructing an algorithm which performs operations on a stack data structure.

Markscheme

Award [3 max].

Method isEmpty() returns True if there are no elements on the stack, False otherwise;
It is important to call this method in logical expression/condition in algorithm constructs such as branches and loops (if/while);
Before popping an element from the stack / popStack();
To prevent errors/stack underflow/program crash;

Examiners report

[N/A]

Syllabus sections

Topic 5: Abstract data structures » 5.1 Abstract data structures
Show 80 related questions
Topic 5: Abstract data structures

View options