Revision - 28/02/2023
Tags: multiple, beginners, programming, tutorial
Published: 2023-02-28 07:24:22

### 1. What is the git command to add and commit files at the same time?
<br>
The command used to git add and commit files at the same time is
```git
git commit -am 'Message'
```
This command will only work with tracked files if a new file is created then firstly perform `git add filename`, Now any changes applied to the file can be committed using `git commit -am 'Message'`.

<hr>

### 2.  How to find a file with a particular set of permissions using CLI?
<br>
To find a file with a particular set of permissions use the command
```bash
find /path/to/search/file -prem 777
```
<hr>

### 3.  What is the lambda function in Python?
<br>
A lambda function is a small anonymous function that can take any number of arguments but only have one expression.
Syntax:
```
lambda arguments : expression
```

Example:
```python
x = lambda a : a * 10
print(x(5))
#output- 50
```
<hr>

### 4.  We can store binary objects and images in a database. What will be the data type used for storing these types of files using PostgreSQL? 
<br>
The data type used to store multimedia objects in a database is `BLOB`(Binary Large Object), It is commonly used where large files need to be stored in a database.

<hr>

### 5.  What is dense rank and rank in SQL?
<br>
`RANK` skips the number of positions after records with the same rank number. The ranking `DENSE_RANK` returns position numbers from 1 to 6 because it doesn’t skip records with the same rank number.

An example of `RANK` is:
```
1
2
2
4
```
An example of `DENSE_RANK` is:
```
1
2
2
3
```
<hr>

### 6.  In flexbox, what is the difference between justify-contents and align-items?
<br>
justify-content — controls alignment of all items on the main axis.

align-items — controls alignment of all items on the cross-axis.

<hr>

### 7.  What is the difference between a list and a tuple with respect to mutability in Python?
<br>
Lists are mutable, which means that you can add, remove, or modify elements in a list after it has been created. Tuples are immutable, which means that once a tuple has been created, its elements cannot be changed.

<hr>

### 8.  What is the difference between primitive and non-primitive data types?
<br>
The primitive data structure is a fundamental type of data structure that stores the data of only one type. Examples of primitive data structures are integer, character, and float.

The non-primitive data structure is a type of data structure that is user-defined and stores the data of different types in a single entity. Examples of the non-primitive data structure are Array, Linked list, and stack.

<hr>

### 9.  Why is it important to understand SQL query execution order?
<br>

* Avoiding errors:
    * Misplacing `WHERE` clause.
    * Incorrect use of aggregate functions such as `SUM`, `COUNT`, and `AVG` if you use it with the wrong grouping it may result in the wrong answer.
    
* Performance tuning:
    * Using indexing to improve the speed of queries.
    * Optimization: you can use the WHERE clause to filter out unwanted rows before performing expensive JOIN. 

<hr>

### 10.  What is a box model in HTML? How to assign padding using short-hand format and is it applicable to the margin as well?
<br>

* The CSS box model refers to a rectangular box that is created around the HTML element.
* It consists of four parts: content, padding, border, and margin.
  * **Content:** It represents content inside the element.
  * **Padding:** represents the space between the content and the border.
  * **Border:** Line that surrounds the padding.
  * **Margin:** The space between the border and adjacent HTML elements.

```css
*{
padding: 2px 5px 7px 10px;
/*
    top padding is 2px
    right padding is 5px
    bottom padding is 7px
    left padding is 10px
*/
padding: 2px 5px 7px;
/*
    top padding is 2px
    right and left paddings are 5px
    bottom padding is 7px
*/
padding: 2px 5px;
/*
    top and bottom paddings are 2px
    right and left paddings are 5px
*/

 padding: 2px;
/*
all four paddings are 2px
*/
}
```
It is also applicable for margin property.