From ae99012d61993771dd1ae772e125bccc40da57e3 Mon Sep 17 00:00:00 2001 From: abregman Date: Fri, 31 Jan 2020 23:37:43 +0200 Subject: [PATCH] Add a couple of Python questions --- README.md | 68 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 54 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index c1a6961..e9a31c3 100644 --- a/README.md +++ b/README.md @@ -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. -
-True or False? TCP is better than UDP
- -False. -UDP is faster, simpler and more efficient than TCP - -
-
What TCP/IP protocols are you familiar with?
@@ -2432,10 +2424,6 @@ def cap(self, string): You would like to run a task only if previous task changed anything. How would you achieve that?
-
-How do you test your Ansible based projects?
-
-
What are callback plugins? What can you achieve by using callback plugins?
@@ -2473,6 +2461,16 @@ Gotenks = 32 ``` +#### Ansible Testing + +
+How do you test your Ansible based projects?
+
+ +
+What is Molecule? How it works?
+
+ ## Terraform @@ -3691,7 +3689,7 @@ some_dict1.update(some_dict2) [Solution](coding/python/binary_search.py) -#### Files +#### Python Files
How to write to a file?
@@ -3714,10 +3712,48 @@ with open('file.txt', 'w') as file: Sum all the integers in a given file
+
+Print a random line of a given file
+
+ +
+Print every 3rd line of a given file
+
+ +
+Print the number of lines in a given file
+
+ +
+Print the number of of words in a given file
+
+
Can you write a function which will print all the file in a given directory? including sub-directories
+#### Python OS + +
+How to print current working directory?
+
+ +
+Given the path /dir1/dir2/file1 print the file name (file1)
+
+ +
+Given the path /dir1/dir2/file1 print the name of the directory where the file resides (dir2)
+
+ +
+Given the path /dir1/dir2/file1 print the path without the file name (/dir1/dir2)
+
+ +
+How do you execute shell commands using Python?
+
+ #### Python Regex
@@ -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
+
+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
+
+ ##### Elasticsearch