1. Why is it recommended to use semantic elements when we can just make an entire website comprising div elements?
Answer:
- They are more descriptive than divs.
- Easy for developers to read and understand.
- Screen readers and browsers can interpret Semantic HTML better, which makes it more accessible.
- Also helps in page ranking for search engine(SEO)
2. What is the difference between WHERE and HAVING processes in SQL?
Answer:
- The WHERE clause is used to filter rows based on a specified condition, while the HAVING clause is used to filter groups based on a specified condition.
- The HAVING clause can only be used in conjunction with the GROUP BY clause.
3. What are void elements in HTML?
Answer:
- HTML elements whose content model never allows it to have contents under any circumstance.
- They do not have closing tags or do not need to be closed.
- They cannot have any Child Nodes(i.e., nested elements or text nodes).
- For Example
<br />, <img />, <hr />, etc.
4. Why do we use dunder methods in python?
Answer:
A dunder method is a method in Python that has a double underscore prefix and suffix in its name, such as init or str. These methods are also known as "magic methods" or "special methods" because they define special behavior for built-in Python operations.
For example, the _init_ method is called when an object is created and allows you to define how the object should be initialized. The _str_ method is called when an object is converted to a string and allows you to define how the object should be represented as a string.
5. What is the difference between padding and margin in HTML?
Answer:
The margin of an element represents the outside space of the element itself, while the padding represents the inner space surrounding the element.
6. What is the difference between git and GitHub?
Answer:
Git | GitHub |
---|---|
Git is a version control system to manage source code history | GitHub is a hosting service for Git repositories |
Git is installed locally on the system | GitHub is hosted on the web |
Git is a command-line tool | GitHub is a graphical user interface |
Git has no user management feature | GitHub has a built-in user management feature |
7. What are the different methods used for accessing the values of a dictionary?
Answer:
- Using keys to access values: We can access the value of a dictionary by specifying its key in square brackets.
- Using the values() method: We can use the values() method to return a list of all the values in a dictionary.
- Using the items() method: We can use the items() method to return a list of key-value pairs in the form of tuples.
- Using a loop to iterate through keys or values: We can use a loop to iterate through the keys or values of a dictionary.
- Using the get() method: We can use the get() method to retrieve the value associated with a key in a dictionary.
8. How do we stage all files except a specific file without using "gitignore"?
Answer:
- First step is to add all the files to the staging area using
git add .
- Then remove the specific file from the staging area using git reset
git reset -- filename
9. Difference between class and id in HTML and CSS.
Answer:
Both are attributes of HTML elements and can be used as a selector in css, but the main difference lies that
- A Class name can be used any number of times with different elements
- Whereas ID name is specific and can be used only once within a HTML page
10. How to revert a specific commit pushed to git due to human error?
Answer:
To revert a commit in Git, use the command:
git revert <commit>
Replace <commit> with the commit hash which can be found from:
git log
command by copying previous commit hash.
11. While applying different selectors in HTML and CSS, what is the order of Specificity?
Answer:
- Inline styles (Highest Specificity)
- ID
- Classes, pseudo-classes
- Elements and pseudo-elements (Lowest Specificity)
12. In what scenarios is grid better than flex and vice-versa?
Answer:
- We use grid when the design needs items in the grid to line up in columns and rows
- We use flex when we want items to get stack up independently on others in terms of length and alignment
13. What is the difference between SQL and NoSQL database?
Answer:
SQL | NoSQL |
---|---|
It is a Relation Database Management System | It is a Non-Relational Database Management System |
Stores data in the form of tables with rows and columns | Stores data in various format including document-oriented, key-value, graph-based models |
SQL databases have a fixed schema, which means that the data structure must be defined before data is stored | NoSQL databases have a dynamic schema, which allows for more flexibility in storing and manipulating data |
They can handle limited amounts of data | They can handle large amounts of data |
14. Do we have "closures" in python?
Answer:
Yes, Python has closures. In Python, a closure is a function object that has access to variables in its enclosing lexical scope, even when the function is called outside that scope. This allows for data to be encapsulated and protected from being modified outside the closure.
15. What are the differences between the operators '=','==' and, 'is' keyword in python?
Answer:
- The '=' operator is used for variable assignment
- The '==' operator is used for comparing values for equality. It checks only its values and not its type
- Whereas 'is' keyword is used to compare objects/variables on its value and also on its type
16. What are meta tags and why do we use them in HTML?
Answer:
- Meta tags are HTML tags that provide metadata about a web page. They are placed in the head section of an HTML document and are not visible to the user
- Meta tags are used because they provide information that can help improve the visibility and ranking of a web page in search results.
- They also provide information about the web page to users such as screenreaders.
Top comments (0)