public function add_question_in_place_of_other($slot, question_definition $question, $maxmark = null) {
        $newslot = $this->next_slot_number();

        $oldqa = $this->get_question_attempt($slot);
        $oldqa->set_slot($newslot);
        $this->questionattempts[$newslot] = $oldqa;

        if ($maxmark === null) {
            $maxmark = $oldqa->get_max_mark();
        }

        $qa = new question_attempt($question, $this->get_id(), $this->observer, $maxmark);
        $qa->set_slot($slot);
        $this->questionattempts[$slot] = $qa;

        $this->observer->notify_attempt_moved($oldqa, $slot);
        $this->observer->notify_attempt_added($qa);

        return $newslot;
    }