Search This Blog

UI Design Fresco Play HackerRank Questions and Answers

Q.1 Name the design concept of making items represented to resemble their real-world counterparts.

1. Material Design

2. GEL

3. Skeuomorphism

4. Minimalism


Q.2 What is the white space located inside letters like o and p called?

1. Serif

2. Counter

3. Descender

4. Ascender


Q.3 Which one of these options denotes the color of an object?

1. Tone

2. Value

3. Hue

4. Chroma


Q.4 Select the color scheme you get by mixing different tones, shades, and tints within a specific hue.

1. Complimentary

2. Monochromatic

3. Triadic

4. Analogous


Q.5 What’s the space between characters called?

1. Tracking

2. Kerning

3. Leading

4. Line-Height


Q.6 What is the height of a capital letter measured from the baseline?

1. Cap height

2. Stem

3. Leg

4. Shoulder

 

Q.7 Name the design language system developed by Google.

1. Material Design

2. Android

3. Alto

4. GEL


Q.8 Name an efficient way to convey an idea in a small amount of space.

1. Hierarchy

2. Iconography

3. Balance

4. Proportion


Q. 9 What happens when you include black to a hue (color)?

1. Shade

2. Tone 

3. Tint


Q.10 What’s the measure of the purity of the color?

1. Tint

2. Luminance

3. Chroma 

4. Value



Python Hackerrank Questions and Answers Quiz Fresco Play Course Id 56762

Q.1  Which view can be used to show the detail of an object?

1. ListView

2. DetailView

3. TemplateView

4. View

Ans: 2. DetailView


Q.2 There are many error views by default in Django. Identify the incorrect one.

1. http_forbidden()

2. server_error()

3. permission_denied()

4. bad_request()

5. page_not_found()

Ans: 1. http_forbidden()


Q.3 Which view decorator module can be used to restrict access to views based on the request method?

1. django.views.decorators.vary

2. django.views.decorators.gzip

3. django.views.decorators.http

4. django.views.decorators.cache

Ans: 3. django.views.decorators.http

Q.4 Mixins are a form of multiple inheritance where behaviors and attributes of multiple parent classes can be combined.

1. True
2. False

Ans: 1. True

Q.5 Which shortcut function returns the result of filter() on a given model manager cast to a list, raising Http404 if the resulting list is empty?

1. get_object_or_404()
2. render()
3. get_list_or_404()
4. render_to_response()

Ans: 3. get_list_or_404()


Generic Date Views - Python

 

Generic Date Views

Date-based generic views display drill-down pages for date-based data. They are

  • ArchiveIndexView - A top-level index page showing the “latest” objects, by date.
  • YearArchiveView - A yearly archive page showing all available months in a given year.
  • MonthArchiveView - A monthly archive page showing all objects in a given month.
  • WeekArchiveView - A weekly archive page showing all objects in a given week.
  • DayArchiveView - A day archive page showing all objects in a given day.
  • TodayArchiveView - A day archive page showing all objects for today.
  • DateDetailView - A page representing an individual object.

More Editing Views - Python

 

More Editing Views

The form-based views can be extended for creating, updating, and deleting objects on the database.

This is done using,

  • CreateView - View that displays a form for creating, saving an object and redisplaying the form with validation errors.
  • UpdateView - View that displays a form generated from an object's model class for editing, saving an existing object and redisplaying the form with validation errors.
  • DeleteView - View that displays a confirmation page and deletes an existing object based on a POST request.

Usage in views.py

class AuthorCreate(CreateView):
    model = Author
    fields = ['name']

class AuthorUpdate(UpdateView):
    model = Author
    fields = ['name']
    template_name_suffix = '_update_form'

class AuthorDelete(DeleteView):
    model = Author
    success_url = reverse_lazy('author-list')

Editing Views - FormView - Python

 

Editing Views - FormView

A FormView based view displays a form which

  • on an error, redisplays the form with validation errors
  • on success, redirects to a new URL. Consider a sample form created in forms.py that defines a CharField for capturing name
from django import forms

class ContactForm(forms.Form):
    name = forms.CharField()

    def send_email(self):
        # code to send email
        pass

A view can be defined using this form as shown. This determines if a form is valid and takes appropriate action (calling send_email in the below case).

class ContactView(FormView):
    template_name = 'contact.html'
    form_class = ContactForm
    success_url = '/thanks/'

    def form_valid(self, form):
        # Call this method when valid form data has been POSTed.
        form.send_email()
        return super().form_valid(form)

Display Views - ListView - Python

 

Display Views - ListView

The view is a display view representing a list of objects, identified by self.object_list.

For the same example as earlier, if you want to list all the articles available for a specific date, the ListView can be used instead of DetailView

from django.views.generic.list import ListView
...
class ArticleListView(ListView):
    model = Article

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context['now'] = timezone.now()
        return context

The URL conf definition is the same as previous.

urlpatterns = [
    path('', ArticleListView.as_view(), name='article-list'),
]

The article headlines can be listed in an HTML file article_list.html by looping through the list of article objects as shown.

<ul>
{% for article in object_list %}
    <li>{{ article.pub_date|date }} - {{ article.headline }}</li>
{% empty %}
    <li>No articles yet.</li>
{% endfor %}
</ul>

Display Views - DetailView - Python

 

Display Views - DetailView

This display view represents the detail of a model object identified by self.object.

Consider the following view that gives the article information. The details are obtained by using the get_context_data method as shown

from django.views.generic.detail import DetailView
...
class ArticleDetailView(DetailView):
    model = Article

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context['now'] = timezone.now()
        return context

The view is called in URLconf as below

urlpatterns = [
    path('<slug:slug>/', ArticleDetailView.as_view(), name='article-detail'),
]

The model object can be used as default data context and can be used in html template named as <model>_detail.html.

<p>{{ object.content }}</p>
<p>Reporter: {{ object.reporter }}</p>
<p>Published: {{ object.pub_date|date }}</p>

Usage of Class-Based Views - Python

 

Usage of Class-Based Views

Django's class-based views can be used:

  • Directly used in URLconf, when the view is not modified.
urlpatterns = [
    path('readme/', TemplateView.as_view(template_name="readme.html")),
]
  • As Generic views that
    • Inherits from a view and the corresponding attributes or methods can be modified.
    • Abstract common text phrases and patterns to write common views for reusability.
    • Can be used for display purposes or editing purposes.

In the next topics, you will look at some of the generic views in detail.

Class-Based Views - Python

 

Class-Based Views

The view functions, you have seen earlier, involve a lot of coding effort.

For responses that need a static page or a listing page, Django provides class-based views.

Using class-based views,

  • Code organization is better.
  • Specific HTTP methods like GET and POST can be addressed.
  • Easy to build reusable components.
  • No need to use render, redirect functions to send an HTTP response.

Let's consider a sample static content page written in static.html file.

Using a class-based view TemplateView, the template can be called as shown.

from django.views.generic import TemplateView

class StaticView(TemplateView):
   template_name = "static.html"

View Response Types - Python

 

View Response Types
Other than HTTPResponse we can use other inbuilt functions that can be used to respond to requests.

These are referred as Django shortcut functions. They are

  • render() - Returns HttpResponse object by rendering the output on a template. Request and template_name are required arguments.
  • redirect() - The view response is directly sent to a URL. This is the URL reversing concept and can be used either with a model or a view name or a direct URL as an argument.
  • get_object_or_404 - Used when you need to get specific data from a model and return the model object. This raises Http404 exception when the object is not found.
  • get_list_or_404 - Used when you need to get a list of model objects and returns Http404 exception if the list is empty.

Views in Python Defining a View

 

Defining a View

Views are defined in the file views.py within the app directory.

A sample definition would be

from django.http import HttpResponse

def greeting(request):
    html = "<html><body>Welcome to Django</body></html>"
    return HttpResponse(html)
  • The class HttpResponse is imported from the django.http module.
  • greeting is the view function that takes an HttpRequest object as its first parameter named request.
  • The generated response in an HTML format is returned as an HttpResponse object by the view.

Digital : Django - Web Framework_FP HackerRank questions and answers Fresco Play Course ID 56762

Q.1 Identify the incorrect middleware hook.

1. process_view()
2. process_exception()
3. process_template_response()
4.template_view()

Ans: 4.template_view()

Q.2 Sessions are __________.

1. Cookie-based
2. Database-backed
3. Cached
4. All the options
5. File based

Ans: 4. All the options

Q.3 Which is a valid path converter?

1. str
2. str and int
3. uuid
4. slug
5. All the options
6. int 

Ans: 5. All the options

Q.4 Identify the incorrect path argument.   

1.route
2. View
3. Model
4. Name

Ans: 3. Model

Q.5 urlpatterns should be a python list of ______ instances.

1. re_path()
2. path
3. None of the options
4. Both Options

Ans: 4. Both Options

Q.6 Identify the equivalent of the following code.
urlpatterns = [
    path('blog/', include(sitepatterns), {'blog_id': 6}),
]

sitepatterns = [
    path('archive/', views.archive),
    path('about/', views.about),
]
1. urlpatterns = [
    path('blog/', include(sitepatterns)),
]

sitepatterns = [
    path('archive/', views.archive, {'blog_id': 6}),
    path('about/', views.about, {'blog_id': 6}),
]
2. urlpatterns = [
    path('blog/', include(sitepatterns)),
]

sitepatterns = [
    path('archive/', views.archive),
    path('about/', views.about, {'blog_id': 6}),
]
3. urlpatterns = [
    path('blog/', include(sitepatterns)),
]

sitepatterns = [
    path('archive/', views.archive, {'blog_id': 6}),
    path('about/', views.about),
]
4. urlpatterns = [
    path('blog/', include(sitepatterns)),
]

mixpatterns = [
    path('archive/', views.archive, {'blog_id': 6}),
    path('about/', views.about, {'blog_id': 6}),
]
Ans : 1. urlpatterns = [
    path('blog/', include(sitepatterns)),
]

sitepatterns = [
    path('archive/', views.archive, {'blog_id': 6}),
    path('about/', views.about, {'blog_id': 6}),
]


Q.7 By default, Django serializes session using ________.

1. pickle
2. json
3. both options
4. None of the options

Q.8 A custom path converter is a class that includes _______.

1. All the options
2. to_url(self,value) method
3. regex string
4. to_python(self, value) method

Ans: 1. All the options





Agile for practitioners - Delivery TCS agile e1 CBO stream Questions and answers

 1. When multiple team members are working on a related feature, how often should they integrate their work?

  1. Do the integration midway through the iteration
  2. After they reach a logical end of creating the functionality
  3. In a scheduled daily (or multiple times in a day) frequency.
  4. In a scheduled weekly (or multiple times in a week) frequency
2. When you have more than one agile team working on a single product, which one of the following should be considered?
  1. All teams need to have similar agile maturity
  2. Teams must participate together in all the agile events.
  3. Teams to have regular sync-up meets to manage and reduce the dependencies.
3. What do you think is the best way to ensure that code adheres to good coding standards?
  1. The code should pass all the unit test cases
  2. The code has to be reviewed by technical expert of the team
  3. The code has to pass through static code analysis without any violations.
  4. The code has to be self-reviewed against a documented checklist
4. When multiple team members are working on a related feature, how often should they integrate their work?
  1. Do the integration midway through the iteration.
  2. After they reach a logical end of creating the functionality.
  3. In a scheduled daily (or multiple times a day) frequency.
  4. In a scheduled weekly (or multiple times in a week) frequency. 
5. What would be a suggested way to share and sustain knowledge with members in a team?
  1. Sharing of best practices and lessons learnt through emails.
  2. Sharing knowledge through knowledge sharing sessions.
  3. Sharing knowledge through informal conversations, for example, during lunch breaks.
  4. Sharing best practices, lessons learnt and other topics in a central place where team can collaborate. 
6. For an agile team, who is responsible for tracking tasks?
  1. The facilitator assigns the tasks to members and tracks the same.
  2. One of the team members owns the responsibility of tracking the tasks.
  3. All team members are responsible for tracking the tasks in a common place such as a Wiki/ Jira/ excel/ physical board/ wall/ any other system.
  4. The customer/Product Owner tracks the tasks.
7. After a team member writes a piece of code, how can he ensure that it works, before checking it in?
  1. Through peer reviews.
  2. Through functional testing.
  3. Through unit testing.
  4. Through regression testing.
8. In the middle of the iteration, how should a team handle requirement changes from the customer?
  1. Team should never incorporate any changes during an ongoing iteration.
  2. Team can always take up the changes and extend iteration duration, if needed.
  3. Team may accept the changes in exchange of existing work item(s). if the Facilitator/Lead conveys the criticality of the changes.
  4. The team may re-negotiate with the Product Owner provided the changes do not endanger the iteration goal.
9. What happens if the offshore team members are not able to participate in the iteration demo due to time zone/infrastructure issues?
  1. No issues. Onsite members can have the iteration demo with Product Owner; it is a single team anyway.
  2. Offshore members will miss the opportunity to interact with the Product Owner and get the direct feedback about the increment they created.
  3. No major issue. Since offshore Lead and onsite members participate in the demo with the Product Owner they can cascade the feedback back to the offshore members.
  4. No major issue. Since offshore Lead and onsite members participate in the demo with the Product Owner they can cascade the feedback back to the offshore members .
10. How does the team know what to work upon during the iteration?
  1. The team participates in the iteration planning during which the Lead/Onsite coordinator/Facilitator decides who would work on what.
  2. The team participates in iteration planning and based on discussions with the Product Owner. Each member selects what he/she would work on.
  3. The Facilitator has regular interaction with the Product Owner. He/she guides the team on the tasks to be taken up.
  4. Iteration plans are shared by Product Owner beforehand; any spill over from last iteration is taken up by default.  
11. What would be a standard way for anyone outside an agile team (for example, Delivery Partner of the account, Head of the Enablement Function) to get status of the work at any point in time?
  1. He/she can refer the physical/digital Kanban board, which is maintained by the team.
  2. All team members need to send email updates to him/her daily.
  3. He/she can have a status review meeting whenever required .
  4. He/she can talk to each team member daily to understand the status . 
12. If you are asked to bring in agile way of working into the way a meeting runs, which one among the listed options will you implement?
  1. Meetings must be scheduled with a lead time so that the participants can plan their work better.
  2. Meetings must be run strictly according to the agenda to reduce digressions.
  3. Meetings must be facilitated and time-boxed.
  4. Facilitator/Team Lead must facilitate discussions but he/she may close meetings as per preference. 
13. For any meeting (other than the agile events) that team members have among them, what are the points to consider? Select the two correct options.
  1. Team must keep such meetings to minimal.
  2. Team must not allow such meetings to go beyond and hour.
  3. Team must keep duration of such meetings short and timebox based on the agenda.
  4. Team meetings (other than agile events) need not be timeboxed.  
14. When a Product Owner adds a new feature/idea in the backlog and brings it up for discussion during refinement session, how should a team respond?
  1. As the Product Owner has come up with the new feature, team must agree to implement it.
  2. Team should analyze the feature/idea based on the domain and technical knowledge and suggest improvements/alternatives, if any.
  3. Team must analyze only the technical feasibility before accepting the idea.  
15. In a team that follows agile, how would a team member know what others are working on? Select two that apply.
  1. The Product Owner and the Facilitator are responsible for maintaining work transparency.
  2. The team should have a daily sync-up.
  3. One team member must play the role of coordinator and should share daily status for each member.
  4. They may refer to the backlog maintained in a tool (Jira, Prime, and so on). 
16. How should a team have quality built into its deliverables?
  1. By having a separate quality assurance team for testing the quality of the deliverables.
  2. By having an agreed and evolving set of Definition of done item, which are automated wherever possible.
  3. By having a robust Definition of Ready mechanism so that selected work items/stories are granular enough.
  4. Team must have a strong set of quality assurance professionals to create built in quality. 
17. What is an efficient way to ensure that the code is working as per the acceptance criteria/business requirements?
  1. Through automated functional tests.
  2. Through automated regression tests.
  3. Through automated unit tests.
  4. Through automated non-functional tests.  
18. Given a piece of work be executed in agile, how would you from the agile team?
  1. An agile team must have the required skills. Team size will depend on scope and budget.
  2. An agile team must have the required skills, headcount being less than 12.
  3. An agile team must have experienced people, headcount not exceeding 9.
  4. An agile team must have mix of experienced associates and freshers with right skills. Team size will depend on scope and budget. 
19. In a team, if someone gets stuck with the selected tasks for the iteration, what is the immediate next step?
  1. Without wasting time, the team member has to inform the Lead/Onsite coordinator and take up another task.
  2. The team member should reach out to other team members for help.
  3. The team member should wait for the Team Retrospective to discuss the issue.
  4. Team member must inform the Product Owner and pick up another task. 
20. How does an agile team obtain clarity on backlog items that may be picked up in upcoming iterations?
  1. During iteration planning team discusses backlog items for both current and upcoming iterations.
  2. Product Owner and Facilitator details out the backlog items planned for upcoming iterations.
  3. There is no need to obtain clarity on backlog items for upcoming iterations in advance.
  4. During every iteration, team has backlog refinement session with the Product Owner for gaining clarity on the backlog items to be picked up in upcoming iterations.
21. How does an agile team maintain requirements?
  1. Every team member maintains a personal backlog of items they are working on.
  2. Facilitator/Onsite coordinator maintains the requirements and communicates the tasks to the team members.
  3. Team maintains the requirements in a common place, such as a Wiki/Jira/Whiteboard and so on. 
22. . What do you think is a good way for team members to remain updated on work status at any given time?
  1. Having an updated physical/digital Kanban board, Scrum board or any other such board.
  2. Sharing status through email with all.
  3. Sharing individual updates with the Lead and the Lead sharing a consolidated summary with all.
  4. Sharing and referring status reports that are shared daily.
23. When you have more than one agile team working on a single product, which one of the following should be considered?
  1. All teams need to have similar agile maturity.
  2. Teams must participate together in all the agile events.
  3. Teams to have regular sync-up meets to manage and reduce the dependencies.
24. Which among the following is a recommend way to run Retrospectives?
  1. Team discusses the feedback received during the iteration demo, creates a roadmap in the Retrospective.
  2. Team discusses how they can improve their way of working picks up one or two improvement areas for next iteration.
  3. Team discusses the backlog items to be worked upon in the next iteration.
  4. Facilitator does a review of the performance of each team member and suggest improvements. 
25. When multiple team members are working on a related feature, how often should they integrate their work?
  1. Do the integration midway through the iteration.
  2. After they reach a logical end of creating the functionality.
  3. In a scheduled daily (or multiple times a day) frequency.
  4. In a scheduled weekly (or multiple times in a week) frequency.
26. Survey Q, Non-scoring: Have you undergone any “Living Agile” session conducted by Agile Ninja Coaches or Unit Agile Leaders?
  1. Yes
  2. No
Answer : Any