PD1: Chapter 1: Datatypes and Variables

Cards (111)

  • What are variables in programming?
    Names for places in program memory where values can be stored and retrieved.
  • What does the datatype of a variable specify?
    It specifies expectations for the values put in or retrieved from the variable.
  • What is a datatype?
    A datatype defines both the possible values and the possible expressions for those values.
  • How do statically typed languages like C# handle datatypes?
    They associate the datatype with a variable, which cannot change.
  • How do dynamic languages like Python handle datatypes?
    They associate the datatype with the value found in the variable, allowing different datatypes in the same variable.
  • What is the default output of a C# console application?
    "Hello, World!"
  • What is a String in programming?
    A String is called text outside the programming context and represents a sequence of characters.
  • How does Visual Studio recognize text definitions in C#?
    It colors the text definition red, including the delimiters.
  • What is the maximum number of characters a String value can contain in C#?
    Up to two billion characters.
  • What is an empty string in C#?
    A valid string that contains zero characters, represented as String.Empty or "".
  • What are escape sequences in C# strings?
    Character combinations that have special meanings and behaviors in a string value.
  • What is the purpose of the newline escape sequence?
    To move the remainder of the text value to the start of the next line.
  • How can you prevent escape sequences from applying their special meaning in C#?
    By using verbatim text, prefixed with @.
  • What are raw string literals in C#?
    They replace the need for escape sequences and are a relatively new feature.
  • What is the significance of string expressions in C#?
    They allow various operations to be performed on string values.
  • What does it mean that string values are immutable in C#?
    It means that every manipulation of a string value creates a new string value.
  • What is the purpose of the StringBuilder datatype?
    To perform efficient string manipulations when many changes are needed.
  • How do you define a string variable in C#?
    By specifying the datatype followed by the variable name.
  • What happens when you assign a new value to a string variable?
    The old value is overwritten and cannot be retrieved anymore.
  • What is the syntax for assigning a value to a variable in C#?
    variablename = valueexpression;
  • What is an int datatype in C#?
    It defines integer values and is used for mathematical calculations.
  • What is the significance of Console.WriteLine in C#?
    It automatically converts int values to their corresponding text value.
  • What are the rules for writing int literals in C#?
    They must adhere to specific formatting rules for positive and negative values.
  • What are some other datatypes that define integer values in C#?
    uint, byte, etc.
  • How do different integral types in C# differ?
    They mainly differ in the range of values they allow.
  • What is the primary purpose of the int datatype?
    To define and work with integer values in programming.
  • Welke datatype wordt gebruikt om gehele getallen te definiĆ«ren in C#?
    int
  • Wat doet de Console.WriteLine-instructie met int-waarden?
    Het converteert automatisch de int-waarden naar hun overeenkomstige tekstwaarde.
  • Hoe verschilt de fractiescheiding in Engelse en Nederlandse installaties?
    Engelse installaties gebruiken . als fractiescheiding, terwijl Nederlandse installaties , gebruiken.
  • Welke andere datatypes voor gehele waarden bestaan er naast int?
    uint, byte
  • Wat is het bereik van int-waarden in C#?
    Van -2 miljard tot +2 miljard.
  • Hoeveel bits neemt een int-waarde in beslag?
    32 bits
  • Wat is de functie van de underscore in binaire notatie?
    Het verbetert de leesbaarheid, maar wordt genegeerd door de compiler.
  • Wat gebeurt er bij een deling door 0 met int-waarden?
    Het genereert een runtime-fout.
  • Wat doet de unary operator - voor een int-expressie?
    Het vermenigvuldigt de waarde met -1.
  • Hoe verschilt de prefix- en postfix-notatie van de unary ++ operator?
    Bij prefix wordt de waarde verhoogd voordat deze wordt gebruikt, bij postfix erna.
  • Wat is de functie van de compound assignment operator i += 3;?
    Het is een shorthand voor i = i + 3;
  • Wat is de standaard datatype voor fractiewaarden in C#?
    double
  • Waarom worden float-waarden in gameprogrammering vaak gebruikt?
    Ze zijn nauwkeurig genoeg en nemen minder geheugen in beslag dan doubles.
  • Wat is de suffix voor float literals in C#?
    f of F