{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "42517466-c960-4644-998c-c19f0ca2d59e",
   "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": "4d1b6880-1978-4ab7-aed5-7dda6b83d68e",
   "metadata": {},
   "source": [
    "## True or False\n",
    "\n",
    "**1.** In C#, `int` can store decimal values such as 3.14.\n",
    "\n",
    "```{dropdown} Answer\n",
    "**False** — `int` is a whole-number type; use `double` or `float` for decimals.\n",
    "```\n",
    "\n",
    "**2.** The `string` type in C# is a reference type.\n",
    "\n",
    "```{dropdown} Answer\n",
    "**True** — Strings are objects on the heap, accessed by reference.\n",
    "```\n",
    "\n",
    "**3.** Integer division in C# always produces a `double` result.\n",
    "\n",
    "```{dropdown} Answer\n",
    "**False** — Integer division truncates to `int`; cast one operand to get a `double`.\n",
    "```\n",
    "\n",
    "**4.** `Console.ReadLine()` returns a `string` value.\n",
    "\n",
    "```{dropdown} Answer\n",
    "**True** — All console input arrives as `string`; parse it to convert to other types.\n",
    "```\n",
    "\n",
    "**5.** The `+` operator works for both arithmetic addition and string concatenation.\n",
    "\n",
    "```{dropdown} Answer\n",
    "**True** — C# overloads `+` for numeric addition and string joining.\n",
    "```\n",
    "\n",
    "**6.** If you add a helper file `ui.cs` to your project folder, you now have two entry points.\n",
    "\n",
    "```{dropdown} Answer\n",
    "**False** — Adding a `.cs` file that defines a helper class does not create a new entry point. A project still has only one `Main()`. Only if `ui.cs` also declared its own `Main()` would you have a conflict — and the compiler would reject it.\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9d57806d-8764-4e5f-b3c8-957c00805b5f",
   "metadata": {},
   "source": [
    "## Multiple Choice\n",
    "\n",
    "**1.** Which data type stores a `true` or `false` value?\n",
    "\n",
    "a) int  \n",
    "b) bit  \n",
    "c) bool  \n",
    "d) byte\n",
    "\n",
    "```{dropdown} Answer\n",
    "**c) bool** — `bool` is the boolean type in C#.\n",
    "```\n",
    "\n",
    "**2.** What is the result of `7 / 2` when both operands are integers?\n",
    "\n",
    "a) 3.5  \n",
    "b) 3  \n",
    "c) 4  \n",
    "d) 7.2\n",
    "\n",
    "```{dropdown} Answer\n",
    "**b) 3** — Integer division truncates the fractional part, giving 3.\n",
    "```\n",
    "\n",
    "**3.** Which expression converts a string to an integer?\n",
    "\n",
    "a) int.Convert(s)  \n",
    "b) Convert.ToInt32(s)  \n",
    "c) string.ToInt(s)  \n",
    "d) Parse.Int(s)\n",
    "\n",
    "```{dropdown} Answer\n",
    "**b) Convert.ToInt32(s)** — `Convert.ToInt32()` (or `int.Parse()`) converts a string to `int`.\n",
    "```\n",
    "\n",
    "**4.** What is the scope of a variable declared inside a method?\n",
    "\n",
    "a) Global  \n",
    "b) File-level  \n",
    "c) Class-level  \n",
    "d) Local to the method\n",
    "\n",
    "```{dropdown} Answer\n",
    "**d) Local to the method** — Method-local variables exist only within that method's block.\n",
    "```\n",
    "\n",
    "**5.** Which escape sequence represents a newline character in a C# string?\n",
    "\n",
    "a) \\t  \n",
    "b) \\r  \n",
    "c) \\n  \n",
    "d) \\\\\n",
    "\n",
    "```{dropdown} Answer\n",
    "**c) \\n** — `\\n` inserts a newline; `\\t` is a tab, `\\r` is carriage return.\n",
    "```\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bcee3922-5c9e-4eba-8d5f-632c338ef25c",
   "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
}
