Skip to content

Commit 37684a9

Browse files
author
abregman
committed
Add a couple of questions
1 parent d36288c commit 37684a9

File tree

2 files changed

+111
-71
lines changed

2 files changed

+111
-71
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ Stick to the following format:
1212

1313
* If you added several questions and you would like to know how many questions are there you can use the script "count_questions.sh" in scripts directory.
1414

15-
1615
## What to avoid
1716

1817
* Avoid adding installation questions. Those are the worst type of questions...
1918
* Don't copy questions and answers from other sources. They probably worked hard for adding them.
2019
* If you add new images, make sure they are free and can be used.
20+
21+
## Before submitting the pull request
22+
23+
You can test your changes locally with the script `run_ci.sh` in scripts directory.

README.md

Lines changed: 107 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
:information_source:  This repository contains questions on various DevOps and SRE related topics
44

5-
:bar_chart:  There are currently **714** questions
5+
:bar_chart:  There are currently **720** questions
66

77
:books:  To learn more about DevOps check the resources in [DevOpsBit.com](https://devopsbit.com)
88

@@ -1678,14 +1678,20 @@ Re-install the OS IS NOT the right answer :)
16781678
<summary>What is sudo? How do you set it up?</summary><br><b>
16791679
</b></details>
16801680

1681-
#### Random and Strange :)
1681+
#### Random and perhaps useless :)
16821682

16831683
<details>
16841684
<summary>Give 5 commands which are two letters long</summary><br><b>
16851685

16861686
ls, wc, dd, df, du, ps, ip, cp, cd ...
16871687
</b></details>
16881688

1689+
<details>
1690+
<summary>What a double dash (--) mean?</summary><br><b>
1691+
1692+
It's used in commands to mark the end of commands options. One common example is when used with git to discard local changes: `git checkout -- some_file`
1693+
</b></details>
1694+
16891695
#### Commands
16901696

16911697
<details>
@@ -1699,10 +1705,45 @@ ls, wc, dd, df, du, ps, ip, cp, cd ...
16991705
<a name="linux-advanced"></a>
17001706
#### :star: Advanced
17011707

1708+
#### System Calls
1709+
1710+
<details>
1711+
<summary>Explain the fork system call</summary><br><b>
1712+
1713+
fork() is used for creating a new process. It does so by cloning the calling process but the child process has its own PID and any memory locks, I/O operations and semaphores are not inherited.
1714+
</b></details>
1715+
1716+
<details>
1717+
<summary>Explain the exec system call</summary><br><b>
1718+
</b></details>
1719+
1720+
<details>
1721+
<summary>What are the differences between exec() and fork()?</summary><br><b>
1722+
</b></details>
1723+
1724+
<details>
1725+
<summary>Why do we need the wait system call?</summary><br><b>
1726+
1727+
wait() is used by a parent process to wait for the child process to finish execution.
1728+
If wait is not used by a parent process then a child process might become a zombie process.
1729+
</b></details>
1730+
17021731
<details>
17031732
<summary>What happens when you execute <code>ls</code>?. Provide a detailed answer</summary><br><b>
17041733
</b></details>
17051734

1735+
#### Linux Filesystem & Files
1736+
1737+
<details>
1738+
<summary>How to create a file of a certain size?</summary><br><b>
1739+
1740+
There are a couple of ways to do that:
1741+
1742+
* dd if=/dev/urandom of=new_file.txt bs=2MB count=1
1743+
* truncate -s 2M new_file.txt
1744+
* fallocate -l 2097152 new_file.txt
1745+
</b></details>
1746+
17061747
<details>
17071748
<summary>Can you describe how processes are being created?</summary><br><b>
17081749
</b></details>
@@ -1759,37 +1800,6 @@ Another common way to task this questions is "what part of the tcp header does t
17591800
<summary>What are cgroups?</summary><br><b>
17601801
</b></details>
17611802

1762-
<details>
1763-
<summary>How to create a file of a certain size?</summary><br><b>
1764-
1765-
There are a couple of ways to do that:
1766-
1767-
* dd if=/dev/urandom of=new_file.txt bs=2MB count=1
1768-
* truncate -s 2M new_file.txt
1769-
* fallocate -l 2097152 new_file.txt
1770-
</b></details>
1771-
1772-
<details>
1773-
<summary>Explain the fork system call</summary><br><b>
1774-
1775-
fork() is used for creating a new process.
1776-
</b></details>
1777-
1778-
<details>
1779-
<summary>Explain the fork system call</summary><br><b>
1780-
</b></details>
1781-
1782-
<details>
1783-
<summary>What are the differences between exec() and fork()?</summary><br><b>
1784-
</b></details>
1785-
1786-
<details>
1787-
<summary>Why do we need the wait system call?</summary><br><b>
1788-
1789-
wait() is used by a parent process to wait for the child process to finish execution.
1790-
If wait is not used by a parent process then a child process might become a zombie process.
1791-
</b></details>
1792-
17931803
<details>
17941804
<summary>Explain Process Descriptor and Task Structure</summary><br><b>
17951805
</b></details>
@@ -1825,21 +1835,25 @@ There are many ways to answer that. For those who look for simplicity, the book
18251835
"responsible for making it easy to run programs (even allowing you to seemingly run many at the same time), allowing programs to share memory, enabling programs to interact with devices, and other fun stuff like that"
18261836
</b></details>
18271837

1838+
#### Processes
1839+
1840+
<details>
1841+
<summary>Can you explain what is a process?</summary><br><b>
1842+
1843+
A process is a running program. A program is one or more instructions and the program (or process) is executed by the operating system.
1844+
</b></details>
1845+
18281846
<details>
18291847
<summary>If you had to design an API for processes in an operating system, what would this API look like?</summary><br><b>
18301848

1849+
It would support the following:
1850+
18311851
* Create - allow to create new processes
18321852
* Delete - allow to remove/destroy processes
18331853
* State - allow to check the state of the process, whether it's running, stopped, waiting, etc.
18341854
* Stop - allow to stop a running process
18351855
</b></details>
18361856

1837-
<details>
1838-
<summary>Can you explain what is a process?</summary><br><b>
1839-
1840-
A process is a running program. A program is one or more instructions and the program (or process) is executed by the operating system.
1841-
</b></details>
1842-
18431857
<details>
18441858
<summary>How a process is created?</summary><br><b>
18451859

@@ -1867,6 +1881,12 @@ False. It was true in the past but today's operating systems perform lazy loadin
18671881
* Blocked - it's waiting for some operation to complete. For example I/O disk request
18681882
</b></details>
18691883

1884+
#### Concurrency
1885+
1886+
<details>
1887+
<summary>Explain what is Semaphore and what its role in operating systems</summary><br><b>
1888+
</b></details>
1889+
18701890
## Virtualization
18711891

18721892
<a name="virtualization-beginner"></a>
@@ -2629,7 +2649,6 @@ def find_triplets_sum_to_zero(li):
26292649
7. In python **Everything** is an object.
26302650
26312651
There are many other characteristics but these are the main ones that every python programmer should know.
2632-
26332652
```
26342653
</b></details>
26352654

@@ -2650,13 +2669,13 @@ The immutable data types are:
26502669
Tuple
26512670
Frozenset
26522671

2653-
You can usually use the function hash() to check an object mutability, if it is hashable it is immutable, although this does not always work as intended as user defined objects might be mutable and hashable
2672+
You can usually use the function hash() to check an object mutability. If an object is hashable, it is immutable (although this does not always work as intended as user defined objects might be mutable and hashable).
26542673
</b></details>
26552674

26562675
<details>
26572676
<summary>In Python, functions are first-class objects. What does it mean?</summary><br><b>
26582677

2659-
In general, first class objects in programming languages are objects which can assigned to variable, used as a return value and can be used as arguments or parameters.<br>
2678+
In general, first class objects in programming languages are objects which can be assigned to variable, used as a return value and can be used as arguments or parameters.<br>
26602679
In python you can treat functions this way. Let's say we have the following function
26612680

26622681
```
@@ -2667,6 +2686,10 @@ def my_function():
26672686
You can then assign a function to a variables like this `x = my_function` or you can return functions as return values like this `return my_function`
26682687
</b></details>
26692688

2689+
<details>
2690+
<summary>Explain expressions and statements</summary><br><b>
2691+
</b></details>
2692+
26702693
<details>
26712694
<summary>What is PEP8? Give an example of 3 style guidelines</summary><br><b>
26722695

@@ -2822,25 +2845,19 @@ Generally, every compiling process have a two steps.
28222845
</b></details>
28232846

28242847
<details>
2825-
<summary>What <code>//</code> is used for?</summary><br><b>
2848+
<summary>Explain Exception Handling and how to use it in Python</summary><br><b>
28262849
</b></details>
28272850

28282851
<details>
2829-
<summary>Write a program which will revert a string (e.g. pizza -> azzip)</summary><br><b>
2830-
2831-
```
2832-
Shortest way is str[::-1] but not the most efficient.
2833-
2834-
"Classic" way:
2835-
2836-
foo = ''
2837-
2838-
for char in 'pizza':
2839-
foo = char + foo
2852+
<summary>Explain what is GIL</summary><br><b>
2853+
</b></details>
28402854

2841-
>> 'azzip'
2855+
<details>
2856+
<summary>What is Lambda? How is it used?</summary><br><b>
2857+
</b></details>
28422858

2843-
```
2859+
<details>
2860+
<summary>What <code>//</code> is used for?</summary><br><b>
28442861
</b></details>
28452862

28462863
<details>
@@ -2957,7 +2974,7 @@ def is_unique4(l:list) -> bool:
29572974
[Solution](coding/python/binary_search.py)
29582975
</b></details>
29592976

2960-
##### Files
2977+
#### Files
29612978

29622979
<details>
29632980
<summary>How to write to a file?</summary><br><b>
@@ -2976,6 +2993,10 @@ with open('file.txt', 'w') as file:
29762993
<summary>Sum all the integers in a given file</summary><br><b>
29772994
</b></details>
29782995

2996+
<details>
2997+
<summary>Can you write a function which will print all the file in a given directory? including sub-directories</summary><br><b>
2998+
</b></details>
2999+
29793000
#### Regex
29803001

29813002
<details>
@@ -3002,10 +3023,6 @@ sorted(x, key=lambda l: l[1])
30023023
```
30033024
</b></details>
30043025

3005-
<details>
3006-
<summary>Can you write a function which will print all the file in a given directory? including sub-directories</summary><br><b>
3007-
</b></details>
3008-
30093026
<details>
30103027
<summary>You have the following list: <code>[{'name': 'Mario', 'food': ['mushrooms', 'goombas']}, {'name': 'Luigi', 'food': ['mushrooms', 'turtles']}]</code>
30113028
Extract all type of foods. Final output should be: {'mushrooms', 'goombas', 'turtles'}</summary><br><b>
@@ -3027,18 +3044,26 @@ def get_food(brothers_menu) -> set:
30273044
# One liner way (Using list comprehension)
30283045
set([food for bro in x for food in bro['food']])
30293046
```
3030-
30313047
</b></details>
30323048

30333049
<details>
30343050
<summary>What is List Comprehension? Is it better than a typical loop? Why? Can you demonstrate how to use it?</summary><br><b>
30353051
</b></details>
30363052

3053+
#### Practical
3054+
30373055
<details>
3038-
<summary>How to reverse a string?</summary><br><b>
3056+
<summary>How to reverse a string? (e.g. pizza -> azzip)</summary><br><b>
3057+
3058+
Shortest way is:
3059+
3060+
```
3061+
my_string[::-1]
3062+
```
3063+
3064+
But it doesn't mean it's the most efficient one. <br>
30393065

3040-
Shortest way is: <code>my_string[::-1]</code> but it doesn't mean it's the most efficient one. <br>
3041-
Cassic way is:
3066+
The Classic way is:
30423067
```
30433068
def reverse_string(string):
30443069
temp = ""
@@ -3064,10 +3089,6 @@ def reverse_string(string):
30643089
<summary>How do you handle argument parsing in Python?</summary><br><b>
30653090
</b></details>
30663091

3067-
<details>
3068-
<summary>Explain what is GIL</summary><br><b>
3069-
</b></details>
3070-
30713092
<details>
30723093
<summary>What is an iterator?</summary><br><b>
30733094
</b></details>
@@ -3092,6 +3113,14 @@ def reverse_string(string):
30923113
<summary>How to combine list of strings into one string with spaces between the strings</summary><br><b>
30933114
</b></details>
30943115

3116+
<details>
3117+
<summary>You have the following list of nested lists: <code>[['Mario', 90], ['Geralt', 82], ['Gordon', 88]]</code> How to sort the list by the numbers in the nested lists?</code></summary><br><b>
3118+
3119+
One way is:
3120+
3121+
the_list.sort(key=lambda x: x[1])
3122+
</b></details>
3123+
30953124
<details>
30963125
<summary>Explain the following:
30973126
* zip()
@@ -3101,6 +3130,8 @@ def reverse_string(string):
31013130

31023131
<details>
31033132
<summary>How do you debug Python code?</summary><br><b>
3133+
3134+
pdb :D
31043135
</b></details>
31053136

31063137
<details>
@@ -3238,7 +3269,7 @@ What would be the result of is_int(2) and is_int(False)?
32383269
##### Flask
32393270

32403271
<details>
3241-
<summary>You wrote you have experience with Django/Flask. Can you describe what is Django/Flask and how you used it? Why Flask and not Djano? (or vice versa)</summary><br><b>
3272+
<summary>You wrote you have experience with Django/Flask. Can you describe what is Django/Flask and how you have used it? Why Flask and not Djano? (or vice versa)</summary><br><b>
32423273
</b></details>
32433274

32443275
<details>
@@ -3660,6 +3691,12 @@ gitattributes allow you to define attributes per pathname or path pattern.<br>
36603691
You can use it for example to control endlines in files. In Windows and Unix based systems, you have different characters for new lines (\r\n and \n accordingly). So using gitattributes we can align it for both Windows and Unix with `* text=auto` in .gitattributes for anyone working with git. This is way, if you use the Git project in Windows you'll get \r\n and if you are using Unix or Linux, you'll get \n.
36613692
</b></details>
36623693

3694+
<details>
3695+
<summary>How do you discard local file changes?</summary><br><b>
3696+
3697+
You can use `git checkout -- <file_name>`
3698+
</b></details>
3699+
36633700
<a name="git-advanced"></a>
36643701
#### :star: Advanced
36653702

0 commit comments

Comments
 (0)