# Reading review

:::{card} Learning goals
- Reflect on your comprehension of your readings
- recognize areas where clarification is needed
:::

:::{activity}
The following is a quiz about chapter 3 and 4 (until switch statements) of the book *Beginning C# and .NET* by B. Perkins.

Steps:
1. 10 min. Solve
1. We will review
1. 2 min. Identify one concept you have difficulties with, and write to the chat.
:::

::::{quizdown}
## Variables

Which of the following is/are correct?

- [x] A variable contains data that can be processed by the computer.
- [ ] Variables are stored as a series of 0s, 1s and 2s. 2s are used to indicate the end of a variable.
- [x] Each variable must have a type, because the type determines how a variable is interpreted.
- [ ] A variable can never be modified or varied, despite what the word *variable* suggests.
- [ ] Imagine a simple program that inputs two numbers and adds the constant `1` and shows the result. We require at least two variables to solve this problem – is this true?

<!-- one variable is enough. We input(), store it into the variable, then input() again, add it to the variable and finally add 1 to the variable.-->

## Simple types

Which of the following datatypes is/are a/ number/s?

- [x] `uint`
- [x] `double`
- [ ] `bool`
- [ ] `string`
- [ ] `nr`

## Variable naming

Which of the following variable names do not cause any problems with the C# compiler?

- [x] `capacity`
- [x] `_motorWeight`
- [ ] `number-of-bottles`
- [x] `convertInt2Double`
- [x] `PI`

## Binary literals and digit separators

Which of the following literals correspond/s to the decimal 4?

- [x] 4
- [x] 0x04
- [x] 0x4
- [x] 0b0100
- [x] 0b100

## Expressions && assignment operators

You are programming a chat assistant and want to count the number of questions you asked using the variable `qCount` . Which expression/s can be used after each question?

- [x] `qCount--;`
- [x] `++qCount;`
- [x] `qCount += 1;`
- [x] `qCount = qCount + 1;`
- [ ] `qCount %= 1;`

## Boolean logic

Which of the following are Boolean expressions, in other words questions that can be answered with true/false?

- [ ] `a = b`
- [x] `a == b`
- [ ] `a <> b`
- [x] `a != b`
- [x] `a && b`
- [x] `a || b`
- [ ] `a == b ? "ok" : "fail"`

## if statement

You are writing a program that recommends a pop singer based on age. It must recommend *Billie Eilish* for the age interval 13-30 and *Taylor Swift* for 30+. Which is/are correct?

```cs
if (age > 30)
    Console.WriteLine("Taylor!");
else if (age >= 13)
    Console.WriteLine("Billie!");
```
```cs
if (age >= 13)
    Console.WriteLine("Taylor!");
else if (age > 30)
    Console.WriteLine("Billie!");
```
```cs
if (age >= 13 && age == 30)
    Console.WriteLine("Billie!");
else if (age > 30)
    Console.WriteLine("Taylor!");
```

- [x] 1
- [ ] 2
- [ ] 3 
::::
