a function to return the quiz nid There is a template file in the quiz/template/quiz-report-form.tpl.php of Quiz module.
this is the code:

&lt;?php

/**
 * @file
 * Themes the question report
 *
 * Available variables:
 * $form - FAPI array
 *
 * All questions are in form[x] where x is an integer.
 * Useful values:
 * $form[x]['question'] - the question as a FAPI array(usually a form field of type "markup")
 * $form[x]['score'] - the users score on the current question.(FAPI array usually of type "markup" or "textfield")
 * $form[x]['max_score'] - the max score for the current question.(FAPI array of type "value")
 * $form[x]['response'] - the users response, usually a FAPI array of type markup.
 * $form[x]['#is_correct'] - If the users response is correct(boolean)
 * $form[x]['#is_evaluated'] - If the users response has been evaluated(boolean)
 */
// $td_classes = array('quiz-report-odd-td', 'quiz-report-even-td');
// $td_class_i = 0;
$p = drupal_get_path('module', 'quiz') .'/theme/';
$q_image = $p. 'question_bg.png';
?&gt;
&lt;h2&gt;&lt;?php print t('Question Results');?&gt;&lt;/h2&gt;
&lt;div class="quiz-report"&gt;
&lt;?php
foreach ($form as $key =&gt; $sub_form):
  if (!is_numeric($key) || isset($sub_form['#no_report'])) continue;
  unset($form[$key]);
  $c_class = ($sub_form['#is_evaluated']) ? ($sub_form['#is_correct']) ? 'q-correct' : 'q-wrong' : 'q-waiting';
  $skipped = $sub_form['#is_skipped'] ? '&lt;span class="quiz-report-skipped"&gt;'. t('(skipped)') .'&lt;/span&gt;' : ''?&gt;

    &lt;div class="dt"&gt;
      &lt;div class="quiz-report-score-container &lt;?php print $c_class?&gt;"&gt;
        &lt;span&gt;
          &lt;?php print t('Score')?&gt;
        &lt;?php print drupal_render($sub_form['score'])?&gt;
        &lt;?php print t('of') .' '. $sub_form['max_score']['#value']?&gt;
        &lt;?php print '&lt;br&gt;&lt;em&gt;'. $skipped .'&lt;/em&gt;'?&gt;
      &lt;/span&gt;
    &lt;/div&gt;
      &lt;p class="quiz-report-question"&gt;&lt;strong&gt;&lt;?php print t('Question')?&gt;: &lt;/strong&gt;&lt;/p&gt;
      &lt;?php print drupal_render($sub_form['question']);?&gt;
    &lt;/div&gt;
  &lt;div class="dd"&gt;
    &lt;p&gt;&lt;strong&gt;&lt;?php print t('Response')?&gt;: &lt;/strong&gt;&lt;/p&gt;
    &lt;?php print drupal_render($sub_form['response']); ?&gt;
  &lt;/div&gt;
  &lt;div class="dd"&gt;
    &lt;?php print drupal_render($sub_form['answer_feedback']); ?&gt;
  &lt;/div&gt;
&lt;?php endforeach; ?&gt;
&lt;/div&gt;
&lt;div class="quiz-score-submit"&gt;&lt;?php print drupal_render_children($form);?&gt;&lt;/div&gt;


Now I want to change this codes and I need a function to return the nid(number of id) of quiz that the user is seeing.
please help me.
Here is a very simple way to get the nid of the node currently being viewed:

$path = current_path();
list($entity_type, $entity_id) = explode('/', $path);


After this, you will have the entity id (the nid in the case of nodes) in the variable $entity_id.