{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "598c37d9-11ea-47ea-9ae6-9e3dbaf83731",
   "metadata": {},
   "source": "# Preview Questions\n\nComplete these questions **before** class to prepare for the chapter.\nUse the dropdowns to check your answers.\n"
  },
  {
   "cell_type": "markdown",
   "id": "1d0b72b7-dc4f-4692-aeae-114eb6a2b347",
   "metadata": {},
   "source": "## True or False\n\n**1.** A class in C# is a reference type.\n\n```{dropdown} Answer\n**True** — Class instances live on the heap and are accessed via references.\n```\n\n**2.** A constructor has a return type of `void`.\n\n```{dropdown} Answer\n**False** — Constructors have no return type — not even `void`.\n```\n\n**3.** Properties in C# provide controlled access to instance variables.\n\n```{dropdown} Answer\n**True** — Properties expose `get` and `set` accessors to read/write private fields.\n```\n\n**4.** The `ToString()` method must always be explicitly overridden in every class.\n\n```{dropdown} Answer\n**False** — `ToString()` is inherited from `object`; overriding is optional.\n```\n\n**5.** In C#, a `struct` is a value type while a `class` is a reference type.\n\n```{dropdown} Answer\n**True** — Structs are copied on assignment; classes share the same instance via reference.\n```\n\n"
  },
  {
   "cell_type": "markdown",
   "id": "e2053a0c-6a56-497d-891a-4da5904a293a",
   "metadata": {},
   "source": "## Multiple Choice\n\n**1.** What is the primary purpose of a constructor?\n\na) To destroy an object when done  \nb) To initialize a new object's state  \nc) To define properties  \nd) To override inherited methods\n\n```{dropdown} Answer\n**b) To initialize a new object's state** — A constructor sets up a newly created object's initial state.\n```\n\n**2.** Which keyword refers to the current instance inside a method?\n\na) self  \nb) base  \nc) this  \nd) me\n\n```{dropdown} Answer\n**c) this** — `this` refers to the current object instance.\n```\n\n**3.** A property with only a `get` accessor is:\n\na) Read-write  \nb) Write-only  \nc) Read-only  \nd) Static\n\n```{dropdown} Answer\n**c) Read-only** — Without a `set` accessor, the property can only be read.\n```\n\n**4.** Which method is implicitly called when an object appears in a string context?\n\na) Print()  \nb) Display()  \nc) Format()  \nd) ToString()\n\n```{dropdown} Answer\n**d) ToString()** — `Console.WriteLine(obj)` calls `obj.ToString()` automatically.\n```\n\n**5.** Defining `operator +` in a class allows you to:\n\na) Add the class to a namespace  \nb) Use `+` with instances of that class  \nc) Create a subclass  \nd) Override the `Add()` method\n\n```{dropdown} Answer\n**b) Use `+` with instances of that class** — Operator overloading lets you write natural expressions like `a + b`.\n```\n\n"
  },
  {
   "cell_type": "markdown",
   "id": "0d1eb146-11ea-4a58-baab-e900f11226a6",
   "metadata": {},
   "source": "```{rubric} Footnotes\n```\n"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".NET (C#)",
   "language": "C#",
   "name": ".net-csharp"
  },
  "language_info": {
   "name": "csharp"
  },
  "polyglot_notebook": {
   "kernelInfo": {
    "defaultKernelName": "csharp",
    "items": [
     {
      "aliases": [],
      "name": "csharp"
     }
    ]
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
