You are on page 1of 9

Test

1. Which are the different Data Types supported by TypeScript?

a. Boolean var bValue: boolean = false

b. Number var age age: number = 16

c. String var name: string = “jon”

d. All of the above

2. Which of the following is a valid Angular expression?

a. {{ 2 + 2 }}

b. { 2 + 2 }

c. (( 2+ 2 ))

d. {(2+ 2)}

3. What decorator is used to make a class a service?

a. Injector

b. Service

c. Injectable

d. Component

4. If I write <button (click) = “onClick()”> in a template, I use?

a. interpolation

b. property binding

c. event binding

5. What is the @Output decorator for?

a. Share data from a parent component to a child

b. Share data from a child component to a parent

c. Use event binding

d. Use a service

Test 1
6. Which of the following directive allows to use form?

a. ng-app

b. ng-form

c. ng-controller

d. ng-binf

7. What is the @Input decorator for?

a. Share data from a parent component to a child

b. Share data from a child component to a parent

c. Use event binding

d. Use a service

8. What mechanism is used to use a service in a component?

a. Dependency injection

b. Legacy

c. Polymorphism

9. What does this syntax do? routerLink=”/home”

a. It navigates to the component with a name matching the assigned string

b. It links a route to a service by matching the assigned string to a service class name

c. It links a route with data by matching the assigned string to a property name

d. It navigates to the component with a path matching the assigned string

10. What command will create a new Angular app with a root routing module

a. ng generate my-dream-app

b. ng new my-dream-app module

c. ng generate my-dream-app -routing

d. ng new my-dream-app -routing

11. Which type of binding uses the banana box [()]?

a. Property Binding

Test 2
b. Interpolation Binding

c. Two-way binding

d. Directive Binding

12. @Output() operator makes use of?

a. Event Emitter

b. rxjs operator

c. promises

d. Data binding

13. Http service supports following operations

a. Get, Post, Delete

b. Get, Post, Put

c. Get, Put, Post, Delete

d. Get, Post

14. Which of the following is correct about TypeScript?

a. Angular is based on TypeScript

b. This is a superset of JavaScript

c. TypeScript is maintained by Microsoft

d. All of the above

15. What is .subscribe?

a. Streams data in asynchronously

b. Streams data in synchronously

c. Both

d. None of the above

16. Which of the following is not a hook application life cycle?

a. ngOnChanges

b. ngViewStart

Test 3
c. ngOnInit

d. None of the above

17. Router is part of which of the following module?

a. @angular/core

b. @angular/router

c. Both

d. None of the above

18. What is the decorator user for configuring your module class?

a. @NgModule

b. @NgApp

c. Both

d. None of the above

19. Observables help you manage ____________ data.

a. synchronous

b. asynchronous

c. Both (synchronous & asynchronous)

d. None of above

20. Which of the following will map the name of an input parameter “userData” to a field
named “users”?

a. @Input(’userData’)users

b. @Input() userData: users

c. @Input() users: userData

d. @Input(’users’) userData

21. Django is based on which framework?

a. MVC

b. MVVM

Test 4
c. MVT

d. MVP

22. What are Migrations in Django?

a. They are files saved in migrations directory.

b. They are created when you run makemigrations command.

c. Migrations are files where Django stores changes to your models.

d. All of the above

23. ____________ is a tool to create isolated Python environments.

a. Django

b. Django Rest Framework

c. virtualenv

d. pip

24. Which of the following is not valid HTTP method?

a. VIEW

b. GET

c. HEAD

d. POST

e. None of the above

25. Which of the following is the Client Error Category in HTTP response status codes a. 2xx

b. 3xx

c. 4xx

d. 5xx

26. What data types in Python is the next object?


L = [1, 23, 'hello', 1]

a. List

b. Dictionary

Test 5
c. Tuple

d. Set

27. What will be the value of the following Python expression?


4 + 3 % 5

a. 7

b. 2

c. 4

d. 1

28. What arithmetic operators cannot be used with strings in Python? a. +

b. -

c. *

29. Which of the following statements is used to create an empty set in Python? a. ()

b. []

c. {}

d. set()

30. To add a new element to a list we use which Python command?

a. list1.addEnd(5)

b. list1.addLast(5)

c. list1.append(5)

d. list1.add(5)

31. Which layer in Django architecture will be called first when new request is received?

a. URLs

b. Views

c. Models

d. Middlewares

Test 6
32. What happens if MyObject.objects.get() is called with parameters that do not match an
existing item in the database?

a. The Http404 exception is raised

b. The DatabaseError exception is raised

c. The MyObject.DoesNotExist exception is raised

d. The object is created and returned

33. Which of the following commands make the changes in models persistent in the database?

a. python manage.py makemigrations

b. python manage.py migrate

c. python manage.py updatetable

d. python manage.py savemodels

34. How to retrieve Products of the Category?


class Category(models.Model):

name = models.CharField(max_length=255)

class Product(models.Model):

name = models.CharField(max_lenght=255, null=True, blank=True)

price = models.IntegerField(null=True, blank=True)

description = models.TextField(null=True, blank=True)

category = models.ForeignKey(Category, on_delete=models.CASCADE, null=True,


blank=True, related_name = 'products'

a. category.product_set

b. category.products

c. category.get_products

d. category.retrieve_products

35. What is the purpose of settings.py?

a. To configure settings for the Django project

b. To configure settings for an app

c. To sync the database schema

d. To set the date and time on the server

Test 7
36. In Django how would you retrieve all the ‘User’ records from the given database, where
username like ‘kbtu’?

a. User.objects.filter(username__like=’kbtu’)

b. User.objects.filter(username__contains=’kbtu’)

c. User.objects.filter(username__similar=’kbtu’)

d. User.objects.filter(username__includes=’kbtu’)

37. What is the purpose of __str__() method?

a. It displays a human-readable form of object.

b. It will display the post_heading when __str__() is called

c. It will return the name of the post when Post object is printed

d. All of the above

38. How to add default sorting by name in descending order to the Product model?

a. order_by = ‘name’

b. sort_by = ‘name’

c. sorting = ‘name’

d. ordering = ‘name’

39. How to filter Products (from previous question) in database, where name of the Products
belongs to one of the values from the python list?

Test 8
a. Product.objects.filter(name=[’Pepsi’, ‘Fanta’, ‘Cola’])

b. Product.objects.filter(name__contains=[’Pepsi’, ‘Fanta’, ‘Cola’])

c. Product.objects.filter(name__in=[’Pepsi’, ‘Fanta’, ‘Cola’])

d. Product.objects.filter(name__gte=[’Pepsi’, ‘Fanta’, ‘Cola’])

40. Which lines in code below shows the example of nested serializer?

a. 9, 17,25

b. 13, 21

c. 8, 16, 24,

d. 6, 12, 20

Test 9

You might also like