1. In CSS there is a property called opacity, what does it do?
Opacity refers to the degree to which the content is transparent or opaque. We can use the property named opacity which takes the values ranging from 0 to 1. 0 specifies that the element is completely transparent where 1 means that the element is completely opaque.
2. How do you create a new branch and check in at the same time?
We can create and switch to a new branch in git by the following command.
git checkout -b new_branch
3. What is the difference between div and span tags in HTML?
The
tag is a block-level element that is used to group other elements together and create a block-level box, while the tag is an inline-level element that is used to apply styles to a small piece of text or a section of text within a larger block-level element.4. How do you handle errors in Python?
In Python, you can handle errors using a try-except block. The code that might cause an error is placed in the try block, and any errors that occur are caught in the except block. We can also use a finally block to ensure that certain code is executed, regardless of whether an error occurred.
5. What is the difference between the append and extend methods of a list in Python?
The append method adds a single element to the end of a list, while the extend method adds multiple elements to the end of a list. For example:
my_list = [1, 2, 3]
my_list.append(4)
print(my_list) # [1, 2, 3, 4]
my_list.extend([5, 6])
print(my_list) # [1, 2, 3, 4, 5, 6]
6. What is the difference between a compiler and an interpreter?
A compiler and an interpreter are both programs that translate code from one programming language into another form, but they differ in how they execute the code and produce results.
A compiler is a program that translates source code into an executable machine code or bytecode that can be directly executed by a computer's processor. The compiler takes the entire program as input, analyzes it, and generates an output in the form of an executable file. The executable file can be run multiple times without the need to recompile the source code. C, C++, Java are examples of programming languages that use compilers.
An interpreter, on the other hand, is a program that reads source code line by line and executes it on-the-fly. Interpreters do not generate a standalone executable file but rather interpret the code and execute it directly. The interpreter translates each line of code into machine code or bytecode and executes it immediately. Python, Ruby, and PHP are examples of programming languages that use interpreters.
7. What is the difference between Normalized CSS and CSS Reset?
Reset CSS: CSS resets aim to remove all built-in browser styling. For example margins, paddings, font-sizes of all elements are reset to be the same.
Normalize CSS: Normalize CSS aims to make built-in browser styling consistent across browsers. It also corrects bugs for common browser dependencies.
8. What is the difference between display: none and visibility: hidden in CSS?
"Display: none" completely removes the element from the page layout, making it invisible and not taking up any space on the page. This means that the element will not be visible and will not affect the layout of other elements on the page.
"Visibility: hidden", on the other hand, hides the element while still taking up space in the layout of the page. This means that the element is not visible, but it still affects the layout of other elements on the page.
9. What is the use of virtual environment in Python?
A virtual environment in Python is a tool that allows you to create an isolated environment for your Python project, separate from your system's Python environment. This isolated environment can have its own set of dependencies, packages, and Python interpreter version.
The main use of virtual environments is to avoid version conflicts between different projects or system-wide dependencies. If we have multiple projects that require different versions of the same package or library, a virtual environment can help you manage these dependencies without causing conflicts.
Virtual environments helps us to create reproducible environments. By specifying the exact versions of dependencies and packages needed for a particular project, we can ensure that the project runs consistently, regardless of the environment it's deployed in.
10. What is the difference between primary key and foreign key in sql?
A primary key is a column or a set of columns in a table that uniquely identifies each row in the table. It is used to enforce data integrity and to establish relationships between tables. A primary key cannot have null values, and each value in the primary key column(s) must be unique.
A foreign key is a column or a set of columns in a table that refers to the primary key of another table. It is used to establish a relationship between two tables and enforce referential integrity. A foreign key can have null values, which means that the column can have values that do not match any primary key values in the referenced table.
11. How do you remove a file from a git repository and retain it in the local machine?
To remove a file from Git without deleting it from the file system, we can use the git rm command with the --cached flag. This will remove the file from the Git repository, but leave it intact on our local file system. For example:
git rm --cached myfile.txt
We can then commit the removal with the git commit command:
git commit -m "Removed myfile.txt from Git repository"
12. What is the difference between Union and Union all ?
UNION and UNION ALL are used to combine the results of two or more SELECT statements. The difference between them is that UNION removes duplicate rows from the result set, while UNION ALL does not.
Top comments (0)