---
# System prepended metadata

title: Software Engineer Assessment
tags: [Assessment]

---

# Software Engineer Assessment

###### tags: `Assessment`

> Just play, have fun & enjoy  :brain: :video_game: :rainbow: 

[toc]


##  Logic Questions

1. Before Mt. Everest was discovered, what was the tallest mountain in the world?
    <b>Kangchenjunga Mountain</b>, located in the India-Nepal border.

2. A cow weighs 800 kilograms, and the weight load of the bridge is 700 kilograms, how does the cow cross the bridge?

    There are some different method to let the cow cross the bridge.

    <b>First Method</b>: Change the route or find another way(transport) to the other side. It might be taking the time but it is the safety way to let a cow to the other side. It was a good way for getting <b>only one cow</b> to the other side in the short term but not for a bunch of cows in the long term.
    
    <b>Second Method</b>: Spend money to reinforce the bridge first, it will taking a lot of time and money but it is possible to increase the number of cows that can safety cross the bridge. This is the best solution to let the cow cross the bridge.

    <b>Third Method</b>: Kill the cow for taking the useful parts and then divide it into parts and transport it across the bridge. It is a faster way crossing a bridge but the cow is dead.
    (The question doesn't mention crossing a bridge with a live cow)


3. What is the largest possible number you can write using only 2 numbers - just 2 numbers, no other mathematical symbols?
    <b>99</b>

4. There are 3 light bulbs in a hidden room and 3 switches outside the room that correspond to those light bulbs. You do not know which switch affects which bulb and you cannot see inside of the room. You are allowed to go inside of the room only one time. How do you find out which switch corresponds to which bulb?

    First, Switch on the switches 1 & 2. 
    
    Second, wait a moment like 5-10 minutes then close the switch 1. 
    
    After, go in the room will see one of the bulb still lighting up which mean this bulb is connected to the switch 2. 
    
    Therefore, there still got 2 bulbs doesn’t have light but one of the bulb is hot so is corresponds to the switch 1 . 
    
    Thus, the last bulb doesn’t have any hot is corresponds to the switch 3.
    
    <b>Conclusion: </b>
    Switch 1 is off = The light bulb is hot and no light up
    Switch 2 is on = The light bulb is light up
    Switch 3 is off = The light bulb is no hot and no light up

5. You have two sand timers, which can show 4 minutes and 7 minutes respectively. Use both the sand timers (at a time or one after other or any other combination) and measure a time of 9 minutes.

    First, start both the sand timers at a time.

    Then filp at end of 4 minutes sand timer.
    
    When 7 minute sand timer is completed then the 4 minute timer still have <b>1 minute</b> left.

    Theremore, can count this as the first minute and thereafter count <b>8 minutes</b> by using 4 minute timer twice.

    1+4+4 = 9 minutes


6. A snail is at the bottom of a 30 foot well. Every hour the snail is able to climb up 3 feet, then immediately slide back down 2 feet. How many hours does it take for the snail to get out of the well?

    A snail using <b>28 hours</b> to get out of the well because when the snail using 1 hour to climb 3 feet and slide back down 2 feet, after 27 hours a snail is on 27 feet. It took the snail another hour to climb 3 feet to get out of the well.

## Object Oriented Programming Corner

7. What is object-oriented programming?

    <b>Object-oriented programming (OOP)</b> is a computer programming model that organizes software design around data, or objects, rather than functions and logic. An object can be defined as a data field that has unique attributes and behavior.

    OOP focuses on the objects that developers want to manipulate rather than the logic required to manipulate them. This approach to programming is well-suited for programs that are large, complex and actively updated or maintained. This includes programs for manufacturing and design, as well as mobile applications; for example, OOP can be used for manufacturing system simulation software.

    The organization of an object-oriented program also makes the method beneficial to collaborative development, where projects are divided into groups. Additional benefits of OOP include code reusability, scalability and efficiency.


8. What are the basic concepts of OOPS.

    There are four basic concepts of Object-oriented programming – Inheritance, Encapsulation, Polymorphism and Abstraction. 

    <b>Inheritance</b> is is a process of deriving the new class from already existing class. It allows to define a child class that reuses (inherits), extends, or modifies the behavior of a parent class. The class whose members are inherited is called the base class. The class that inherits the members of the base class is called the derived class.

    <b>Encapsulation</b> is defined 'as the process of enclosing one or more items within a physical or logical package'. Also means hiding the code and data into a single unit to protect the data from the outside world.

    <b>Polymorphism</b> is the process of using an operator or a function in different ways for different data input expressed as 'one interface, multiple functions'. Polymorphism can be static or dynamic. In <b>Static Polymorphism</b>, the response to a function is determined at the compile time. In <b>Dynamic Polymorphism</b>, it is decided at run-time.

    <b>Abstraction</b> is the process of hiding the working style of an object, and displaying the information of an object in an easy method. The abstract modifier indicates the incomplete implementation. The keyword abstract is used before the class or method to declare the class or method as abstract. There are two types of abstraction; Data Abstraction and Control Abstraction. <b>Data Abstraction</b> refers to the concealment of data specifics. <b>Control Abstraction</b> refers to the concealment of implementation details

9. What is the difference between class and an object?


    <b>Class</b>: Class is a detailed description, the definition, and the template of what an object will be. But it is not the object itself. Also, what we call, a class is the building block that leads to Object-Oriented Programming. It is a user-defined data type, that holds its own data members and member functions, which can be accessed and used by creating an instance of that class. It is the blueprint of any object.

   <b>Object</b>: Object is an instance of a class. All data members and member functions of the class can be accessed with the help of objects. When a class is defined, no memory is allocated, but memory is allocated when it is instantiated.



    <table>
        <tr>   
            <th style="width:50%">Class</th>
            <th>Object</th>
        </tr>
        <tr>
            <td>Class is a blue print used to create same type object.</td>
            <td>Object is an entity.</td>
        </tr>
         <tr>
            <td>Class is a type.</td>
            <td>Object is a variable.</td>
        </tr>
        <tr>
            <td>Class is an expanded concept of data structures.</td>
            <td>Objects are the instantiation of a class.</td>
        </tr>
        <tr>
            <td>Class is a logical entity.</td>
            <td>Object is a physical entity.</td>
        </tr>
         <tr>
            <td>When Class is declared, no memory is allocated.</td>
            <td>When Object of a class is declared, memory is allocate.d</td>
        </tr>
        <tr>
            <td>Class creates objects and provides values for state and implementation of behavior while objects contain properties and methods.</td>
            <td>Objects contains properties and methods.</td>
        </tr>
        <tr>
            <td>Purpose of Class is grouping of data.</td>
            <td>Purpose of Object is data abstraction</td>
        </tr>
    </table>


10. Write a function that will return 3 possible values, Success, Pending, Failed. Write the code in any language.
```csharp=
using System;

namespace MyApplication {
  public class Program {
    public static void Main(string[] args) {
      Random rnd = new Random();
      int random = rnd.Next(3);
     // Console.WriteLine("0 = Pending \n1 = Success \n2 = Failed");
      Console.WriteLine("The result is " + MyFunction(random));
    }

    public static string MyFunction(int random) {
      string result;
      result = "";
      if (random == 0) {
        result = "Pending";
      } else if (random == 1) {
        result = "Success";
      } else if (random == 2) {
        result = "Failed";
      } else {
        result = "Error";
      }
      return result;
    }
  }
}
```
11. Initially, write a function that receive a string. At later stage, the same function is required to receive 2 parameters, 1 is number and 1 is DateTime. And later stage the number of parameters may be changed again. Write the snippet for this in the language that you are comfort with.
```csharp=
using System;

namespace MyApplication {

  public class Program {

    public static void Main(string[] args) {

      MyFunction("First is String");
      MyFunction(520, DateTime.Now);
      object[] myObjArray = {2,'b',"test",true,"again"};
      MyFunction(myObjArray);

    }

    public static void MyFunction(params object[] list) {
      for (int i = 0; i < list.Length; i++) {
        Console.Write(list[i] + " ");
      }
      Console.WriteLine();
    }
  }
}
```

13. Write a function named GetUserSummary that return Name & Age, another function named GetUserDetail that return Name, Age, BirthDate, Gender. Write the code in any language.
```csharp=
using System;

namespace MyApplication {

  public class Program { 
    public static void Main(string[] args) {
        
      Console.WriteLine("\nGetUserSummary() ");
      Console.WriteLine(GetUserSummary());
        
      Console.WriteLine("\nGetUserDetail() ");
      Console.WriteLine(GetUserDetail());
    }

    public static string GetUserSummary() {
      User User = new User();
      string x = "Name: " + User.Name + "\nAge: " + User.Age;
      return x;
    }

    public static string GetUserDetail() {
      User User = new User();
      string DOB = User.DOB.ToString("d");
      string y = "Name: " + User.Name + "\nAge: " + User.Age + "\nBirthDate: " + DOB + "\nGender: " + User.Gender;
      return y;
    }
  }
    
  public class User {
    public string Name { get; set; }
    public int Age { get; set; }
    public string Gender { get; set; }
    public DateTime DOB { get; set; }

    public User() {
      Name = "Abu";
      Age = 24;
      Gender = "Male";
      DOB = new DateTime(1999, 10, 24);
    }
  }
}
```
13. Given an array of ints, write a method to total all the values that are even numbers. (Can be any OOP language)
```csharp=
using System;

namespace MyApplication {
  public class Program {
    public static void Main(string[] args) {
        int Min = 1;
        int Max = 100;
        int even = 0;
        int[] ints = new int[5]; 

        Random randNum = new Random();

        for (int i = 0; i < ints.Length; i++)
        {
            ints[i] = randNum.Next(Min, Max);
            Console.WriteLine(ints[i]); 

            if (ints[i] % 2 == 0) {
             even += ints[i];
            }
        }
        Console.WriteLine("Sum of Even Number: " + even);
    }
  }
}
```


## SQL Corner

14. What is the difference between DELETE and TRUNCATE?

    <b>DELETE</b>: The DELETE statement removes rows one at a time and records an entry in the transaction log for each deleted row. Use the DELETE command in order to remove individual records from a table.

    <b>TRUNCATE</b>: TRUNCATE TABLE removes the data by deallocating the data pages used to store the table data and records only the page deallocations in the transaction log. 

    <b>Conclusion</b>: <b>TRUNCATE</b> command is remove all of the records from a table; <b>DELETE</b> command in order to remove individual records from a table. Thus, <b>DELETE</b> command is slower than <b>TRUNCATE</b> command.  

15. What does UNION do? What is the difference between UNION and UNION ALL?

    In SQL, the <b>UNION</b> operator selects rows from two or more tables. If rows of tables are the same, those rows are only included once in the result set. 

    The difference between <b>UNION</b> and <b>UNION ALL</b>

    <b>UNION ALL</b>: Keeps all of the records from each of the original data sets. 
    `UNION ALL` combines the results of two or more `SELECT` statements, <b>showing all values, including duplicates</b> if they exist.

    <b>UNION</b>: Removes any duplicate records. 
    `UNION` combines the result set of two or more `SELECT` statements, <b>showing only distinct values</b>.

16. What is the difference between IN and EXISTS?

    <b>"IN"</b> clause is preferred when there is a small list of static values or the inner query returns a very less number of rows. 

    <b>"EXISTS"</b> clause is preferred when there is a need to check the existence of values in another table or when there is a need to check against more than one column.

    <b>Conclusion</b>: The <b>"EXISTS"</b> clause is faster than <b>"IN"</b> when the subquery results are very large. The <b>"IN"</b> clause is faster than <b>"EXISTS"</b> when the subquery results are very small.

17. What will be the result of the query below? Explain your answer and provide a version that behaves correctly.

    The result is <b>Nope</b> because null always not equal to another null. Null is consider to be a memory reference. So each null will take different reference ID. So NULL will be not equal anytime. Unless use <b>'IS'</b> operator with null values in place of <b>'='</b> to get Yup.

    ```sql
    SELECT case when null IS null then 'Yup' else 'Nope' end as Result;
    ```

18. select case when null = null then 'Yup' else 'Nope' end as Result;
`Nope`

19. How do you copy data from one table to another table?
    ```sql
    --Copy all data 
    INSERT INTO destination_table
    SELECT * FROM source_table
    WHERE condition;

    --Copy some data 
    INSERT INTO destination_table (column1, column2, column3)
    SELECT column1, column2, column3
    FROM source_table
    WHERE condition;
    ```

## Web Development Questions

20. What’s the difference between GET and POST methods in HTTP requests?
    
    <b>HTTP GET</b>: The Hypertext Transfer Protocol(HTTP) Get method is mainly used at the client (Browser) side to send a request to a specified server to get certain data or resources. Using this method the server should only let us receive the data and not change its state. Hence it is only used to view something and not to change it. Get method is one of the most used HTTP method. The request parameter of the get method is appended to the URL. Get request is better for the data which does not need to be secure (It means the data which does not contain images or word documents).

    <b>HTTP POST</b>: The Hypertext Transfer Protocol(HTTP) Post method is mainly used at the client (Browser) side to send data to a Specified server in order to create or rewrite a particular resource/data. This data sent to the server is stored in the request body of the HTTP request. Post method eventually leads to the creation of a new resource or updating an existing one. Due to this dynamic use, it is one of the most used HTTP methods. It is not one of the most secure methods because the data that is been sent is included in the body of the request and not in the URL. Post request is better for the data which needs to be secure (It means the data which contains images or word documents).
    
    
    | HTTP GET | HTTP POST |
    | ---- | ---- |
    | In GET method we can not send large amount of data rather limited data is sent because the request parameter is appended into the URL.| 	In POST method large amount of data can be sent because the request parameter is appended into the body. |
    | GET request is comparatively better than Post so it is used more than the Post request. | POST request is comparatively less better than Get so it is used less than the Get request. |
    | GET request is comparatively less secure because the data is exposed in the URL bar. | POST request is comparatively more secure because the data is not exposed in the URL bar. |
    |Request made through GET method are stored in Browser history.|Request made through POST method is not stored in Browser history.|
    |GET method request can be saved as bookmark in browser.|POST method request can not be saved as bookmark in browser.|
    |Request made through GET method are stored in cache memory of Browser.| Request made through POST method are not stored in cache memory of Browser.|
    |Data passed through GET method can be easily stolen by attackers.|Data passed through POST method can not be easily stolen by attackers.|
    |In GET method only ASCII characters are allowed.|In POST method all types of data is allowed.|



21. List out the different ways of CSS code to style below html element highlighted in RED.**
    ```
    <p>This paragraph refers to two classes. </p>
    ```
    <b>Internal CSS</b>
    ```html
    <style>
        p {
            background-color: red;
        }
    </style>
    ```
    <b>CSS class</b>
    ```html
    <style>
        .highlight-red {
            background-color: red;
        }
    </style>
   
    <p class="highlight-red" >This paragraph refers to two classes.</p>
    ```
    <b>Inline CSS</b>
    ```html
    <p style="background-color: red;">This paragraph refers to two classes.</p>
    ```
    <b>External CSS</b>
    ```html
    <!--html file-->
    <head>
    <link rel="stylesheet" href="styles.css">
    </head>
    <p >This paragraph refers to two classes.</p>
    
    <!--style.css file-->
    <style>
        p {
            background-color: red;
        }
    </style>
    ```
22. List out the different ways an HTML element can be accessed in a JavaScript code.

    <b> Get HTML element by Id </b>
    `document.getElementById(element_ID);`

    Generally, most developers use unique ids in the whole HTML document. The user has to add the id to the particular HTML element before accessing the HTML element with the id. Users can use getElementById() method to access HTML element using the id. If any element doesn’t exist with the passed id into the getElementById method, it returns the null value.
    ```javascript
    //html
    <span id="test">test</span>
    //javascript
    var test = document.getElementById("test");
    console.log(test);
    console.log(test.innerHTML);

    //Output
    <span id="test">test</span>
    test
    ```

    <b>Get HTML element by className</b>
    `document.getElementsByClassName(element_classnames);`

    The developers can use single className multiple times in a particular HTML document. When users try to access an element using the className, it returns the collection of all objects that include a particular class.
    
    ```javascript
    //html
    <span class="test">test</span>
    <span class="test">test2</span>
    //javascript
    var test = document.getElementsByClassName("test");
    console.log(test[0]);
    console.log(test[0].innerHTML);
    console.log(test[1].innerHTML);

    //Output
    <span class="test">test</span>
    test
    test2
    ```

    
    <b>Get HTML element by Name</b>
    `document.getElementsByName(element_name);`

    The name suggests the name attribute of the HTML element. This method returns the collection of HTML elements that includes the particular name. Users can get the length of the collection using the build-in length method. 
    
    ```javascript
    //html
    <span name="test">test</span>
    <span name="test">test2</span>
    //javascript
    var test = document.getElementsByName("test");
    console.log(test[0]);
    console.log(test[1]);
    console.log(test[1].innerHTML);

    //Output
    <span name="test">test</span>
    <span name="test">test2</span>
    test2
    ```


    <b>Get HTML element by tagName</b>
    `document.getElementsByTagName(Tag_name);`

    Get HTML element by tagName is access the HTML elements using the tag name. This method is the same as the getElementsByName method. Here, we are accessing the elements using the tag name instead of using the name of the element.

    ```javascript
    //html
    <span>test</span>
    <span>test2</span>
    <span>test3</span>

    //javascript
    var test = document.getElementsByTagName("span");
    console.log(test[0]);
    console.log(test[1].innerHTML);
    console.log(test[2]);

    //Output
    <span>test</span>
    test2
    <span>test3</span>
    ```


    
    <b>Get HTML element by CSS Selector</b>
    ``document.querySelector(selectors);
    document.querySelectorAll(selectors);``

     Users can select the HTML elements using the different CSS selectors such as class, id, and tag name at a single time. HTML elements can be retrieved using CSS selectors in two ways. The <b>querySelector()</b> method returns the first element that matches the particular CSS selector. The <b>querySelectorAll()</b> method returns all element that matches the particular CSS selector. 
     
    <b>`querySelector()`</b>     
    ```javascript
    //html
    <span class="test" id="test1">test</span>
    <span class="test" id="test2">test2</span>
    <p class="test">test3</p

    //javascript
    var test = document.querySelector(".test");
    console.log(test);
  
    // Accessing the element by id using querySelector
    test = document.querySelector("#test2");
    console.log(test.innerHTML);
  
    // Accessing the element by class name and id using querySelector
    test = document.querySelector(".test#test2");
    console.log(test);
  
    // Accessing the element by tag name that includes the particular class
    test = document.querySelector("p.test");
    console.log(test);

    //Output
    <span class="test" id="test1">test</span>
    test2
    <span class="test" id="test2">test2</span>
    <p class="test">test3</p>
    ```
     <b>`querySelectorAll()`</b>     
    ```javascript
    //html
    <span class="test" id="test1">test</span>
    <span class="test" id="test2">test2</span>
    <p class="test">test3</p>
    <p class="test">test4</p>

    //javascript
    var test = document.querySelectorAll("span.test#test2");
    console.log(test[0]);
  
    // Accessing the element by tag name using querySelectorAll
    test = document.querySelectorAll("p");
    console.log(test[0].innerHTML);
    console.log(test[1]);

    //Output
    <span class="test" id="test2">test2</span>
    test3
    <p class="test">test4</p>
    ```

    

23. What would be the result of 2+5+”3” in JavaScript?
`73`
24. What will be the output when the following code is executed? Explain.
     ```
    console.log(false == '0')
    console.log(false === '0')
    ```
    Output
    ```console
    true
    false
    ```
    The <b>equality (==)</b> operator checks whether its two operands are equal, returning a Boolean result. Unlike the strict equality operator, it attempts to convert and compare operands that are of different types. Theremore, "0" is equal to false because "0" is of type string but when it tested for equality the automatic type conversion of JavaScript comes into effect and converts the "0" to its numeric value which is 0 and as we know 0 represents false value. So, "0" equals to false and return true.

    The <b>strict equality (===)</b> operator checks whether its two operands are equal, returning a Boolean result. Unlike the <b>equality operator</b>, the strict equality operator always considers operands of different types to be different. If the values have different types, the values are considered unequal. If the values have the same type, are not numbers, and have the same value, they’re considered equal. Thus, the false operand is type boolean and the 0 operand is type number. The operands are different types so false is returned.


25. In what order will the numbers 1-4 be logged to the console when the code below is executed? Why?
    ```
    (function() {
        console.log(1); 
        setTimeout(function(){console.log(2)}, 1000); 
        setTimeout(function(){console.log(3)}, 0); 
        console.log(4);
    })();
    ```
    The console will show 
    ```console
    1
    4
    3
    2 
    ```
    because of the <b>Window setTimeout()</b>. 
    The `setTimeout()` is a function after a number of milliseconds. SetTimeout adds a message (with the callback provided) to the end of this queue after the specified delay has elapsed. Also, sets a timer which executes a function or specified piece of code once the timer expires

    1 second = 1000 milliseconds.
    
    The `setTimeout()` with 0 of milliseconds function will is not invoked right away. Instead, it is placed on a queue to be invoked “as soon as possible” after any currently pending event handlers finish running. Thus it will show 1 and 4 first, because doesn’t have `setTimeout()` function and when no code is currently executing, then requesting the next message in line to be processed (executed). So, after 1 and 4 the next is 3 then 2.


26. What would the following lines of code output to the console? Explain your answer.
    ```
    console.log("0 ||  1 = "+(0 || 1));
    console.log("1 || 2 = "+(1 || 2));
    console.log("0 && 1 = "+(0 && 1));
    console.log("1 && 2 = "+(1 && 2));
    ```
    Output
    ```javascript
    0 || 1 = 1 // =>false
    1 || 2 = 1 // =>true
    0 && 1 = 0 // =>false
    1 && 2 = 2 // =>true
    ```
    The && and || operators actually return the value of one of the specified operands, so if these operators are used with non-Boolean values, they may return a non-Boolean value.

      The <b>logical OR operator ( || )</b> returns the boolean value true if either or both operands is true and returns false otherwise.

     `expr1 || expr2`
     
    Returns expr1 if it can be converted to true; otherwise, returns expr2. Thus, when used with Boolean values, || returns true if either operand is true; if both are false, returns false.
    

    The <b>logical AND operator ( && )</b> for a set of boolean operands will be true if and only if all the operands are true . Otherwise it will be false.
    
    `expr1 && expr2`
    
    Returns expr1 if it can be converted to false; otherwise, returns expr2. Thus, when used with Boolean values, && returns true if both operands are true; otherwise, returns false.


## Backend 面試題目

## Q27：簡單 JOIN

### 資料表格式說明
- 會員資料表 [Member]：
  - Id：`PRIMARY KEY`
  - Account：會員帳號

- 會員詳細資料資料表 [MemberDetail]：
  - Id：`PRIMARY KEY`
  - MemberId：`[Member]` 的 Id
  - Name：真實姓名
  - PhoneNumber：電話號碼


### 資料表內容：

`[Member]`

| Id | Account |
| ---- | ---- |
| 1 | jack1234 |
| 2 | mark5678 |
| 3 | tom5566 |

`[MemberDetail]`

| Id | MemberId | Name | PhoneNumber |
| ---- | ---- | ---- | ---- |
| 1 | 1 | Jack | 0912345678 |
| 2 | 3 | Tom | 0987654321 |


### 問題：

請寫一段語法，查詢出會員帳號與詳細資訊
需顯示的欄位為：
```sql
Select 
  M.Account, 
  MD.Name, 
  MD.PhoneNumber 
From 
  Member M 
  left join MemberDetail MD ON M.Id = MD.MemberId
Order by
  M.Account

```

| Account | Name | PhoneNumber |
| ---- | ---- | ---- |
|jack1234|Jack|0912345678|
|mark5678|    |          |
|tom5566|Tom|0987654321|


## Q28：List 資料更新

### 問題

請處理以下程式中的 `DeleteMembers`：
將傳入 `DeleteMembers` 中的 `members` 做軟刪除
`※ 註：軟刪除就是將 IsDelete 變為 true`
並將已刪除的 member id 轉為 List 回傳
```csharp=
class Program
{
    static void Main(string[] args)
    {
        var members = new List<Member>()
        {
            new Member(1, "Jack"),
            new Member(2, "Mark"),
            new Member(3, "Tom"),
        };
        
        var result = DeleteMembers(members);

        Console.ReadLine();
    }

    /// <summary>
    /// 刪除會員
    /// </summary>
    /// <param name="members"></param>
    /// <returns></returns>
    public static List<int> DeleteMembers(List<Member> members)
    {

        List<int> resultIds;

        // ******** 作答區 ********

        // 1. 軟刪除：將 IsDelete 變為 true
        for (int i = 0; i <= members.Count - 1; i++)
            {
                members[i].IsDelete = true;
            }
        // 2. 將已經刪除的會員 id 回傳出來
        for (int i = 0; i <= members.Count - 1; i++)
            {
                if (members[i].IsDelete == true)
                {
                    resultIds.Add(members[i].Id);
                }
            }

        // ***********************

        return resultIds;
    }

    /// <summary>
    /// 會員
    /// </summary>
    /// <returns></returns>
    public class Member
    {
        public Member(int id, string name)
        {
            Id = id;
            Name = name;
            IsDelete = false;
        }

        /// <summary>
        /// 會員 Id
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 會員名稱
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 是否已刪除
        /// </summary>
        public bool IsDelete { get; set; }
    }
}
```


## Q29. 請回答以下 Console.WriteLine 分別會顯示什麼?
```  C#
namespace Util.Test
{
    class Program
    {
        static void Main(string[] args)
        {
            var Tbank = new TaiwanBankAccount();
            var LineBank = new LineBankAccount();

            Console.WriteLine($"1.{Tbank.WithdrawMoney()}");
            Console.WriteLine($"2.{Tbank.BankCode}");
            Console.WriteLine($"3.{LineBank.BankCode}");
            Console.WriteLine($"4.{LineBank.GetMoney(1)}");
            Console.WriteLine($"5.{LineBank.GetMoney(1, 2)}");
            Console.WriteLine($"6.{LineBank.LimitAccount}");
            Console.ReadLine();
        }
    }

    public class BankAccount
    {
        private int LimitAccount = 13;
        public virtual string BankCode => "001";
        public virtual string WithdrawMoney() {
            return "";
        }
        
    }

    public class TaiwanBankAccount : BankAccount
    {
        public override string WithdrawMoney()
        {
            return "Web";
        }
        public override string BankCode => "002";
    }

    public class LineBankAccount : BankAccount
    {
        public override string WithdrawMoney()
        {
            return "Bank";
        }
        public int GetMoney(int amount)
        {
            return amount * 2;
        }
        public int GetMoney(int amount, int amount2)
        {
            return amount * amount2;
        }
    }
}
```
<b>Output</b>
`
'Compilation error: 'BankAccount.LimitAccount' is inaccessible due to its protection level
`

After change `private int LimitAccount`  to `public int LimitAccount` because private access modifie can only be accessed within the same class cannot outside the class.
```
1.Web
2.002
3.001
4.2
5.2
6.13
```

Or using properties

```csharp
static void Main(string[] args)
{....
    BankAccount objBankAccount = new BankAccount();  
    Console.WriteLine("6." + objBankAccount.Limit_Account);  
....
}

public class BankAccount
{
  private int LimitAccount = 13;
  public int Limit_Account  
    {  
        get  
        {  
            return LimitAccount;  
        }  
    }  
}
```

## 回答方式
請另開一份 hackmd 記錄下題目以及答案
提供給 HR hackmd 的連結以供審查




