This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. What do you mean by the statement " All of the data structures with the addition of strings are iterable in Jinja2 ". ? | |
Answer: This means that for each of the data types you can iterate through their content. | |
2. How strings, pairs, lists and dictionaries are iterated ? | |
Answer: Strings are iterated through the characters they contain, Pairs and lists through the values they contain and finally, dictionaries are iterated through their keys. | |
3. Why Jinja throws an error when one tries to access their content dynamically? | |
Answer: This is because the primary key for accessing items of Iterables (Strings, Lists, Tuples, Dictionaries) must be a constant. | |
4. How can we fix the error that occurs when accessing the content dynamically? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. What is the use of {%...%} delimiter ? | |
Answer: It is used for the statements of the Jinja language that do not have an output. | |
2. What is the use of {{...}} delimiter ? | |
Answer: It is the used to print the content in between the curly brackets to the template output. | |
3. What are the Math Expressions that we can use here | |
Answer: + Addition -> eg 20 + 30 returns 50 | |
- Subtraction. -> eg 20 - 10 returns 10 | |
* Multiplication. -> eg 2 * 3 returns 6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Is Jinja only for HTML? | |
Answer: Additionally Jinja is a general purpose template engine and not only used for HTML/XML generation. For example you may generate LaTeX, emails, CSS, JavaScript, or configuration files. | |
2. Why Jinja2 is useful ? | |
Answer: Jinja2 is useful because it has consistent template tag syntax and the project is cleanly extracted as an independent open source project so it can be used as a dependency by other code libraries. | |
3. Why is Jinja used? | |
Answer: It is used to generate any markup as well as source code. The Jinja template engine allows customization of tags, filters, tests, and globals.Jinja allows the template designer to call functions with arguments on objects. | |
4. Does flask use Jinja? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. How do you render a flask? | |
Answer: a) First, create a new folder in the project directory called templates. Create a new file in the templates folder naming “home. html”. | |
b) Now open app.py and add the following code. from flask import Flask, render_template. app = Flask(__name__) @app. | |
2. What is rendering a template? | |
Answer: Rendering means interpolating the template with context data and returning the resulting string. | |
3. What is Route () in Flask? | |
Answer: The route() decorator in Flask is used to bind URL to a function. For example − @app. route('/hello') def hello_world(): return 'hello world' Here, URL '/hello' rule is bound to the hello_world() function. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Why Flask is called a microframework? | |
Answer: Flask is called a microframework because Flask only provides core features such as request, routing, and blueprints. For other features, such as Caching, ORM, forms, etc., we need to make use of Flask-Extensions. | |
2. Why flask is not good for production? | |
Answer: Flask's built-in server is not suitable for production as it doesn't scale well and by default serves only one request at a time. | |
3. What is WSGI in Flask? | |
Answer: WSGI (Web Server Gateway Interface) is an interface between web servers and web apps for python. mod_wsgi is an Apache HTTP server module that enables Apache to serve Flask applications. | |
4. Who created Flask? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. When should event handlers be loaded? | |
Answer: The load event occurs when the document has been completely loaded, including dependent resources like JS files, CSS files, and images. The <img> and <script> elements also support the load event. Use the addEventListener() method to register an onload event handler. | |
2. How do I stop click event propagation? | |
Answer: To stop an event from further propagation in the capturing and bubbling phases, you call the Event. stopPropation() method in the event handler. | |
3. Is it true that using stopPropagation() method in the event handler stops the default behaviours of the element? | |
Answer: No, the event stopPropagation() method doesn't stop any default behaviors of the element e.g., link click, checkbox checked. | |
4. How do I stop events bubbling? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Is IndexedDB any good? | |
Answer: ndexedDB is a good fit if your client-side data needs are more complex than what Local/SessionStorage can provide (i.e. you're looking for more than a simple Key/Value store in your application) | |
2. Can we use JavaScript fucntions in IndexDB? | |
Answer: Yes | |
3. When should I use IndexedDB? | |
Answer: IndexedDB is a newer facility for storing large amounts of data in the browser. You can use it to store data of any JavaScript type, such as an object or array, without having to serialize it. | |
4. Is all requests against the database are Asynchronous/synchronous ? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) in what form is the data in the storage stored? | |
Ans. The data in the storage is stored in the key-value format . | |
2) Data in the key value pair is stored in? | |
Ans. data in the key value pair is stored in the double quotes , unlike the javascript which gives functionality to use single as well as double quote we have double qotes only. | |
3) what is JSON.stringify? | |
Ans. json.stringify is used convert the data in the string format . | |
4) when is sessional storage is expired ? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. What is the use of defer attribute ? | |
Answer: The defer attribute is a boolean attribute. When present, it specifies that the script is executed when the page has finished parsing. | |
2. Which is better async or defer? | |
Answer: Defer always causes script execution to happen at the same time as or later than ASYNC. ... Therefore, it's better to use DEFER so that their execution happens outside of the main rendering time. DEFER scripts can never block synchronous scripts, while ASYNC scripts might depending on how quickly they download. | |
3. When to use defer? | |
Answer: In practice, defer is used for scripts that need the whole DOM and/or their relative execution order is important. | |
4. When to use async? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. What happens if two elements have the same z-index? | |
Answer: If two elements have the same z-index, their order in HTML determines which element is placed in front of the other one | |
2. What determines Z-index ? | |
Answer: The z-index property determines the stack level of an HTML element. | |
3. What is the purpose of Z-index ? | |
Answer: The z-index CSS property sets the z-order of a positioned element and its descendants or flex items. Overlapping elements with a larger z-index cover those with a smaller one. | |
4. Can Z index be used without position? |