Add a couple of Python questions

This commit is contained in:
abregman 2020-01-31 23:37:43 +02:00
parent dcabc81537
commit ae99012d61

View File

@ -2,7 +2,7 @@
:information_source:  This repo contains questions and exercises on various technical topics, sometimes related to DevOps and SRE :)
:bar_chart:  There are currently **854** questions
:bar_chart:  There are currently **864** questions
:warning:  You can use these for preparing for an interview but most of the questions and exercises don't represent an actual interview. Please read [Q&A](common-qa.md) for more details
@ -993,14 +993,6 @@ A three-way handshake is primarily used to create a TCP socket connection. It wo
TCP establishes a connection between the client and the server to guarantee the order of the packages, on the other hand, UDP does not establish a connection between client and server and doesn't handle package order. This makes UDP more lightweight than TCP and a perfect candidate for streaming services.
</b></details>
<details>
<summary>True or False? TCP is better than UDP</summary><br><b>
False.
UDP is faster, simpler and more efficient than TCP
</b></details>
<details>
<summary>What TCP/IP protocols are you familiar with?</summary><br><b>
</b></details>
@ -2432,10 +2424,6 @@ def cap(self, string):
<summary>You would like to run a task only if previous task changed anything. How would you achieve that?</summary><br><b>
</b></details>
<details>
<summary>How do you test your Ansible based projects?</summary><br><b>
</b></details>
<details>
<summary>What are callback plugins? What can you achieve by using callback plugins?</summary><br><b>
</b></details>
@ -2473,6 +2461,16 @@ Gotenks = 32
```
</b></details>
#### Ansible Testing
<details>
<summary>How do you test your Ansible based projects?</summary><br><b>
</b></details>
<details>
<summary>What is Molecule? How it works?</summary><br><b>
</b></details>
## Terraform
<a name="terraform-beginner"></a>
@ -3691,7 +3689,7 @@ some_dict1.update(some_dict2)
[Solution](coding/python/binary_search.py)
</b></details>
#### Files
#### Python Files
<details>
<summary>How to write to a file?</summary><br><b>
@ -3714,10 +3712,48 @@ with open('file.txt', 'w') as file:
<summary>Sum all the integers in a given file</summary><br><b>
</b></details>
<details>
<summary>Print a random line of a given file</summary><br><b>
</b></details>
<details>
<summary>Print every 3rd line of a given file</summary><br><b>
</b></details>
<details>
<summary>Print the number of lines in a given file</summary><br><b>
</b></details>
<details>
<summary>Print the number of of words in a given file</summary><br><b>
</b></details>
<details>
<summary>Can you write a function which will print all the file in a given directory? including sub-directories</summary><br><b>
</b></details>
#### Python OS
<details>
<summary>How to print current working directory?</summary><br><b>
</b></details>
<details>
<summary>Given the path <code>/dir1/dir2/file1</code> print the file name (file1)</summary><br><b>
</b></details>
<details>
<summary>Given the path <code>/dir1/dir2/file1</code> print the name of the directory where the file resides (dir2)</summary><br><b>
</b></details>
<details>
<summary>Given the path <code>/dir1/dir2/file1</code> print the path without the file name (/dir1/dir2)</summary><br><b>
</b></details>
<details>
<summary>How do you execute shell commands using Python?</summary><br><b>
</b></details>
#### Python Regex
<details>
@ -5730,6 +5766,10 @@ The most used projects are the Elasticserach, Logstash and Kibana. Also known as
5. The user creates a dashboard which composed out of the visualization created earlier
</b></details>
<details>
<summary>You are running an app which outputs several log files (without timestamps). What do you do in order to process the information they include and display it in Kibana? you can ask for additional information if required for answering this question</summary><br><b>
</b></details>
##### Elasticsearch
<details>