You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+89-59Lines changed: 89 additions & 59 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
:information_source: This repository contains questions on various DevOps and SRE related topics
4
4
5
-
:bar_chart: There are currently **720** questions
5
+
:bar_chart: There are currently **725** questions
6
6
7
7
:books: To learn more about DevOps check the resources in [DevOpsBit.com](https://devopsbit.com)
8
8
@@ -2509,6 +2509,14 @@ Setting the replicas to 0 will shut down the process. Now start it with `kubectl
2509
2509
<summary>What programming language do you prefer to use for DevOps related tasks? Why specifically this one?</summary><br><b>
2510
2510
</b></details>
2511
2511
2512
+
<details>
2513
+
<summary>Explain expressions and statements</summary><br><b>
2514
+
2515
+
An expression is anything that results in a value (even if the value is None). Basically, any sequence of literals so, you can say that a string, integer, list, ... are all expressions.
2516
+
2517
+
Statements are instructions executed by the interpreter like variable assignments, for loops and conditionals (if-else).
2518
+
</b></details>
2519
+
2512
2520
<details>
2513
2521
<summary>What is Object Oriented Programming? Why is it important?</summary><br><b>
2514
2522
</b></details>
@@ -2686,10 +2694,6 @@ def my_function():
2686
2694
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`
2687
2695
</b></details>
2688
2696
2689
-
<details>
2690
-
<summary>Explain expressions and statements</summary><br><b>
2691
-
</b></details>
2692
-
2693
2697
<details>
2694
2698
<summary>What is PEP8? Give an example of 3 style guidelines</summary><br><b>
2695
2699
@@ -2704,6 +2708,13 @@ PEP8 is a list of coding conventions and style guidelines for Python
2704
2708
5. Use 4 spaces per indentation level
2705
2709
</b></details>
2706
2710
2711
+
<details>
2712
+
<summary>What is the result of running <code>[] is not []</code>? explain the result</summary><br><b>
2713
+
2714
+
It evaluates to True.<br>
2715
+
The reason is that the two created empty list are different objects. `x is y` only evaluates to true when x and y are the same object.
2716
+
</b></details>
2717
+
2707
2718
<details>
2708
2719
<summary>Explain inheritance and how to use it in Python</summary><br><b>
2709
2720
@@ -2768,16 +2779,13 @@ bruno.bark()
2768
2779
Calling super() calls the Base method, thus, calling super().__init__() we called the Animal __init__.
2769
2780
2770
2781
There is a more advanced python feature called MetaClasses that aid the programmer to directly control class creation.
2771
-
2772
2782
```
2773
-
2774
2783
</b></details>
2775
2784
2776
2785
<details>
2777
2786
<summary> What is an error? What is an exception? What types of exceptions are you familiar with?</summary><br><b>
2778
2787
2779
2788
```
2780
-
2781
2789
# Note that you generally don't need to know the compiling process but knowing where everything comes from
2782
2790
# and giving complete answers shows that you truly know what you are talking about.
2783
2791
@@ -2834,18 +2842,19 @@ Generally, every compiling process have a two steps.
2834
2842
division(100, 2)
2835
2843
2836
2844
>>> __main__.DividedBy2Error: I dont want you to divide by 2!
2837
-
2838
2845
```
2839
-
2840
-
2841
2846
</b></details>
2842
2847
2843
2848
<details>
2844
2849
<summary>Explain Exception Handling and how to use it in Python</summary><br><b>
2845
2850
</b></details>
2846
2851
2847
2852
<details>
2848
-
<summary>Explain Exception Handling and how to use it in Python</summary><br><b>
2853
+
<summary>What _ is used for in Python?</summary><br><b>
2854
+
2855
+
1. Translation lookup in i18n
2856
+
2. Hold the result of the last executed expression or statement in the interactive interpreter.
2857
+
3. As a general purpose "throwaway" variable name. For example: x, y, _ = get_data() (x and y are used but since we don't care about third variable, we "threw it away").
2849
2858
</b></details>
2850
2859
2851
2860
<details>
@@ -2861,11 +2870,10 @@ Generally, every compiling process have a two steps.
2861
2870
</b></details>
2862
2871
2863
2872
<details>
2864
-
<summary>How to extract the unique characters from a string? for example given the input "itssssssameeeemarioooooo" the output will be "mrtisaoe"</summary><br><b>
2873
+
<summary>How do you swap values between two variables?</summary><br><b>
2865
2874
2866
2875
```
2867
-
x = "itssssssameeeemarioooooo"
2868
-
y = ''.join(set(x))
2876
+
x, y = y, x
2869
2877
```
2870
2878
</b></details>
2871
2879
@@ -2887,21 +2895,10 @@ def return_sum():
2887
2895
```
2888
2896
</b></details>
2889
2897
2890
-
<details>
2891
-
<summary>How to merge two sorted lists into one sorted list?</summary><br><b>
2892
-
</b></details>
2893
-
2894
-
<details>
2895
-
<summary>How to merge two dictionaries?</summary><br><b>
2896
-
</b></details>
2898
+
#### Lists
2897
2899
2898
2900
<details>
2899
-
<summary>How do you swap values between two variables?</summary><br><b>
2900
-
2901
-
```
2902
-
x, y = y, x
2903
-
```
2904
-
2901
+
<summary>How to merge two sorted lists into one sorted list?</summary><br><b>
2905
2902
</b></details>
2906
2903
2907
2904
<details>
@@ -2947,23 +2944,37 @@ This one might look more convulated but hey, one liners.
2947
2944
def is_unique4(l:list) -> bool:
2948
2945
return all(map(lambda x: l.count(x) < 2, l))
2949
2946
```
2950
-
2951
2947
</details>
2952
2948
2953
2949
<details>
2954
-
<summary>What _ is used for in Python?</summary><br><b>
2950
+
<summary>You have the following function
2955
2951
2956
-
1. Translation lookup in i18n
2957
-
2. Hold the result of the last executed expression or statement in the interactive interpreter.
2958
-
3. As a general purpose "throwaway" variable name. For example: x, y, _ = get_data() (x and y are used but since we don't care about third variable, we "threw it away").
2952
+
```
2953
+
def my_func(li = []):
2954
+
li.append("hmm")
2955
+
print(li)
2956
+
```
2957
+
2958
+
If we call it 3 times, what would be the result each call?
2959
+
</summary><br><b>
2959
2960
</b></details>
2960
2961
2961
2962
<details>
2962
-
<summary>How to check how much time it took to execute a certain script or block of code?</summary><br><b>
2963
+
<summary>How to iterate over a list in reverse order?</summary><br><b>
2963
2964
</b></details>
2964
2965
2966
+
#### Dictionaries
2967
+
2965
2968
<details>
2966
-
<summary>Find all the permutations of a given string</summary><br><b>
2969
+
<summary>How to sort a dictionary by values?</summary><br><b>
2970
+
</b></details>
2971
+
2972
+
<details>
2973
+
<summary>How to sort a dictionary by keys?</summary><br><b>
2974
+
</b></details>
2975
+
2976
+
<details>
2977
+
<summary>How to merge two dictionaries?</summary><br><b>
2967
2978
</b></details>
2968
2979
2969
2980
##### Common Algorithms Implementation
@@ -3050,7 +3061,28 @@ set([food for bro in x for food in bro['food']])
3050
3061
<summary>What is List Comprehension? Is it better than a typical loop? Why? Can you demonstrate how to use it?</summary><br><b>
3051
3062
</b></details>
3052
3063
3053
-
#### Practical
3064
+
#### Strings
3065
+
3066
+
<details>
3067
+
<summary>How to extract the unique characters from a string? for example given the input "itssssssameeeemarioooooo" the output will be "mrtisaoe"</summary><br><b>
3068
+
3069
+
```
3070
+
x = "itssssssameeeemarioooooo"
3071
+
y = ''.join(set(x))
3072
+
```
3073
+
</b></details>
3074
+
3075
+
<details>
3076
+
<summary>Find all the permutations of a given string</summary><br><b>
3077
+
</b></details>
3078
+
3079
+
<details>
3080
+
<summary>How to check if a string contains a sub string?</summary><br><b>
3081
+
</b></details>
3082
+
3083
+
<details>
3084
+
<summary>Find the frequency of each character in string</summary><br><b>
3085
+
</b></details>
3054
3086
3055
3087
<details>
3056
3088
<summary>How to reverse a string? (e.g. pizza -> azzip)</summary><br><b>
0 commit comments