questions with hidden but revealable hints and answers

How about FlipView:

FlipView[{
  Button@"Show hint",
  Column[{

    TextCell[
       "You can plot a function using:", "Notebook", "Text"
    ],
    ExpressionCell[
       Defer@Plot[Sin[x], {x, 0, 1}], "Notebook", "Input"
    ]
  }]
}]

enter image description here


alternatively, born from comments under Karsten's answer:

FlipView[{
   Button["Show hint"],
   Tooltip[
      Button["Show hint", Appearance -> "Pressed"],
      Column[{
         TextCell["You can plot a function using:", "Notebook", "Text"], 
         ExpressionCell[Defer@Plot[Sin[x], {x, 0, 1}], "Notebook", "Input"]
      }]
   ]
}]

enter image description here


A modification of the answer provided by Kuba that uses an AttachedCell to give the hint:

Button[
 "Show hint",
 With[{box = EvaluationBox[]},
  SelectionMove[box, All, Expression];
  FrontEndExecute@FrontEnd`AttachCell[box,
    Cell[BoxData[GridBox[
       {
        {Cell["You can plot a function using:", "Text"]},
        {Cell[BoxData["Plot[Sin[x],{x,0,1}]"], "Input"]},
        {ToBoxes[Plot[Sin[x], {x, 0, 1}]]}
        }, GridBoxAlignment -> {"Columns" -> {{Left}}}]], 
     Background -> GrayLevel[0.75], "Print"], 
    {1, {Right, Top}}, {Left, Top}, 
    "ClosingActions" -> {"SelectionDeparture", "ParentChanged", "EvaluatorQuit"}]]]

GIF


In response to a comment by Kuba:

Tooltip[
 Button["Hint",
  With[{box = EvaluationBox[]}, SelectionMove[box, All, Expression];
   FrontEndExecute@
    FrontEnd`AttachCell[box, 
     Cell[BoxData[
       GridBox[{{Cell["You can plot a function using:", 
           "Text"]}, {Cell[BoxData["Plot[Sin[x],{x,0,1}]"], 
           "Input"]}, {ToBoxes[Plot[Sin[x], {x, 0, 1}]]}}, 
        GridBoxAlignment -> {"Columns" -> {{Left}}}]], 
      Background -> GrayLevel[0.75], 
      "Print"], {1, {Right, Top}}, {Left, Top}, 
     "ClosingActions" -> {"SelectionDeparture", "ParentChanged", 
       "EvaluatorQuit"}]]],
 "Click this button if you need a hint"]