{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "c1a1f332-54d4-4e8c-88dc-06540c36043c",
   "metadata": {},
   "source": [
    "# Preview Questions\n",
    "\n",
    "Complete these questions **before** class to prepare for the chapter.\n",
    "Use the dropdowns to check your answers.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "154c6712-1ae2-4bfb-8842-4833a2806308",
   "metadata": {},
   "source": [
    "## True or False\n",
    "\n",
    "**1.** A `void` method in C# must include a `return` statement.\n",
    "\n",
    "```{dropdown} Answer\n",
    "**False** — `void` methods may omit `return`; it is optional.\n",
    "```\n",
    "\n",
    "**2.** Method parameters are local variables within the method body.\n",
    "\n",
    "```{dropdown} Answer\n",
    "**True** — Parameters behave like local variables scoped to the method.\n",
    "```\n",
    "\n",
    "**3.** Two methods can share the same name if their parameter lists differ (overloading).\n",
    "\n",
    "```{dropdown} Answer\n",
    "**True** — Method overloading is fully supported in C#.\n",
    "```\n",
    "\n",
    "**4.** A method must always return a value.\n",
    "\n",
    "```{dropdown} Answer\n",
    "**False** — Methods declared `void` return nothing.\n",
    "```\n",
    "\n",
    "**5.** The method signature includes the method name and its parameter types.\n",
    "\n",
    "```{dropdown} Answer\n",
    "**True** — The signature = name + parameter type list (not the return type in C#).\n",
    "```\n",
    "\n",
    "**6.** You can split your helper methods into a separate `.cs` file without creating a new project.\n",
    "\n",
    "```{dropdown} Answer\n",
    "**True** — A project can span many `.cs` files. You only need a new project (a new `.csproj`) when you need a second entry point (`Main()`). Helper methods in additional `.cs` files share the same project and can be called from `Main()` freely.\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cf509861-d233-417a-bc44-b76d452e4bb1",
   "metadata": {},
   "source": [
    "## Multiple Choice\n",
    "\n",
    "**1.** What keyword sends a value back from a method to its caller?\n",
    "\n",
    "a) send  \n",
    "b) output  \n",
    "c) return  \n",
    "d) yield\n",
    "\n",
    "```{dropdown} Answer\n",
    "**c) return** — `return` exits the method and passes the value back.\n",
    "```\n",
    "\n",
    "**2.** Which method signature is syntactically correct in C#?\n",
    "\n",
    "a) static void Greet(string name)  \n",
    "b) void static Greet(string name)  \n",
    "c) Greet static void(string name)  \n",
    "d) static Greet void(string)\n",
    "\n",
    "```{dropdown} Answer\n",
    "**a) static void Greet(string name)** — The modifier (`static`) precedes the return type, which precedes the name.\n",
    "```\n",
    "\n",
    "**3.** What happens when a method is called with fewer arguments than required parameters?\n",
    "\n",
    "a) Uses null automatically  \n",
    "b) Compiles but crashes at runtime  \n",
    "c) Causes a compile-time error  \n",
    "d) Uses zero for numeric types\n",
    "\n",
    "```{dropdown} Answer\n",
    "**c) Causes a compile-time error** — Missing required arguments produce a compile error.\n",
    "```\n",
    "\n",
    "**4.** A method that calls itself is called:\n",
    "\n",
    "a) Iterative  \n",
    "b) Recursive  \n",
    "c) Polymorphic  \n",
    "d) Abstract\n",
    "\n",
    "```{dropdown} Answer\n",
    "**b) Recursive** — Recursion is when a method invokes itself.\n",
    "```\n",
    "\n",
    "**5.** Method overloading means:\n",
    "\n",
    "a) A method that calls other methods  \n",
    "b) Multiple methods with the same name but different parameters  \n",
    "c) A method with too many lines  \n",
    "d) Calling a method in a loop\n",
    "\n",
    "```{dropdown} Answer\n",
    "**b) Multiple methods with the same name but different parameters** — Overloading lets you reuse a name with different parameter signatures.\n",
    "```\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "aedf8156-15a0-4d28-bec2-235e8c70bab9",
   "metadata": {},
   "source": [
    "```{rubric} Footnotes\n",
    "```\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".NET (C#)",
   "language": "C#",
   "name": ".net-csharp"
  },
  "language_info": {
   "name": "polyglot-notebook"
  },
  "polyglot_notebook": {
   "kernelInfo": {
    "defaultKernelName": "csharp",
    "items": [
     {
      "aliases": [],
      "name": "csharp"
     }
    ]
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
