logo

Question detail

Which expression tests whether the list xs is empty?

Try the question, check the answer, then read the explanation to understand the curriculum point.

At a glance

MCQ

Type

practice

Style

Topic

Lists in functional programming

Exam-style question

Try this first

Which expression tests whether the list xs is empty?.

  1. A.xs == []
  2. B.xs == [0]
  3. C.len(xs) == 1
  4. D.xs[0] == []

Model answer

What a good answer should say

  • xs == []

Explanation

Why this works

The expression xs == [] is true exactly when xs contains no elements.

Common mistake

No common mistake is linked to this question yet.

Related flashcards

No flashcards are published for this page yet.

Related practice questions

No questions are published for this page yet.