DEV Community

NK1FC
NK1FC

Posted on

Revision - 28/02/2023

1. What is the git command to add and commit files at the same time?



The command used to git add and commit files at the same time is

git commit -am 'Message'
Enter fullscreen mode Exit fullscreen mode

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'.


2. How to find a file with a particular set of permissions using CLI?



To find a file with a particular set of permissions use the command

find /path/to/search/file -prem 777
Enter fullscreen mode Exit fullscreen mode

3. What is the lambda function in Python?



A lambda function is a small anonymous function that can take any number of arguments but only have one expression.
Syntax:

lambda arguments : expression
Enter fullscreen mode Exit fullscreen mode

Example:

x = lambda a : a * 10
print(x(5))
#output- 50
Enter fullscreen mode Exit fullscreen mode

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?



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.


5. What is dense rank and rank in SQL?



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
Enter fullscreen mode Exit fullscreen mode

An example of DENSE_RANK is:

1
2
2
3
Enter fullscreen mode Exit fullscreen mode

6. In flexbox, what is the difference between justify-contents and align-items?



justify-content — controls alignment of all items on the main axis.

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


7. What is the difference between a list and a tuple with respect to mutability in Python?



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.


8. What is the difference between primitive and non-primitive data types?



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.


9. Why is it important to understand SQL query execution order?

  • 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.

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?

  • 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.
*{
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
*/
}
Enter fullscreen mode Exit fullscreen mode

It is also applicable for margin property.

Top comments (0)