Result for: Adaka RaviTeja
Exam Name: Python , Django , Angular Programming
Download Result (PDF)Email: [email protected]
Total Marks: 45.0
Score: 15.0
Percentage: 33.33%
Question Answers
| Sr. No. | Question | Selected Answer | Correct Answer |
|---|---|---|---|
| 1 | Which type of Programming does Python support? | No answer selected | all of the mentioned |
| 2 | What does the @staticmethod decorator do in a Python class? | No answer selected | Defines a method that doesn't receive an implicit first argument |
| 3 | In Django, which method is used to create database tables based on your models? | No answer selected | manage.py makemigrations and manage.py migrate |
| 4 | What will be the output of the following Python code? def create_multipliers(): return [lambda x: i * x for i in range(4)] functions = create_multipliers() results = [f(2) for f in functions] print(results) | No answer selected | [6, 6, 6, 6] |
| 5 | What will be the output of the following Python code? def create_funcs(): funcs = [] for i in range(3): def f(x, i=i): return x + i funcs.append(f) return funcs funcs = create_funcs() print([f(10) for f in funcs]) | No answer selected | [10, 11, 12] |
| 6 | What will be the output of the following Python code? def logger(func): def wrapper(*args, **kwargs): print(f"Calling {func.__name__}") return func(*args, **kwargs) return wrapper @logger def add(x, y): return x + y result = add(add(1, 2), add(3, 4)) print(result) | No answer selected | Calling add (3 times), then 10 |
| 7 | What will be the Output of the Following Code? class Weird: def __init__(self, x): self.x = x def __eq__(self, other): return self.x == other.x a = Weird(10) b = Weird(10) d = {a: "Hello", b: "World"} print(len(d), d[a]) | No answer selected | 2 Hello |
| 8 | What will be the Output of the Following Code? def tricky(n, cache={}): if n in cache: return cache[n] if n <= 1: return 1 cache[n] = tricky(n-1) + tricky(n-2) return cache[n] print(tricky(4)) print(tricky(3)) print(tricky(2)) | 5, 3, 2 | 5, 3, 2 |
| 9 | What will be the Output Of the Following Code? def subgen(): yield 1 yield 2 return 3 def main(): result = yield from subgen() print("Returned:", result) g = main() for val in g: print(val) | No answer selected | 1, 2, Returned: 3 |
| 10 | What will be the Output of the Following Code? class Key: def __init__(self, val): self.val = val def __eq__(self, other): return self.val == other.val k1 = Key(1) k2 = Key(1) d = {k1: 'a', k2: 'b'} print(len(d)) | No answer selected | 2 |
| 11 | What will be the Output of the Following Code? def dec1(func): def wrapper(*args): print("dec1") return func(*args) return wrapper def dec2(func): def wrapper(*args): print("dec2") return func(*args) return wrapper @dec1 @dec2 def hello(): print("Hello") hello() | No answer selected | dec1, dec2, Hello |
| 12 | What will be the Output of the Following Code? def sub(): yield 1 yield 2 return "Done" def main(): x = yield from sub() print("Subgen returned:", x) g = main() for i in g: print(i) | No answer selected | 1 2 Subgen returned: Done |
| 13 | What will be the Output of the Following Code? ef func(a, L=[]): L.append(a) return L print(func(1)) print(func(2)) print(func(3)) | No answer selected | [1], [1, 2], [1, 2, 3] |
| 14 | Which of the following operations will NOT trigger model.save() or signals (pre_save/post_save)? | No answer selected | MyModel.objects.bulk_create([...]) |
| 15 | What will be printed? Component: @Component({ selector: 'app-test', template: '{{ value }}' }) class TestComponent implements OnInit { value = 'initial'; ngOnInit() { setTimeout(() => this.value = 'changed', 0); } } | No answer selected | Initial |
| 16 | What does providing a service in the component (instead of module) do? | No answer selected | Creates a new service instance per component |
| 17 | n a Django + Angular app using REST API, what is a good reason to disable CSRF middleware? | No answer selected | Angular uses JWT Auth and doesn’t send CSRF tokens |
| 18 | If an Angular frontend calls a Django API and receives a CORS error, what should be done? | No answer selected | Configure CORS_ORIGIN_ALLOW_ALL in Django |
| 19 | What will be the Output of the Following Code? stack = [] for i in range(3): stack.append(i) for i in range(2): stack.pop() print(stack) | No answer selected | [0] |
| 20 | What will be the Output of the Following Code? s = "((())" stack = [] for ch in s: if ch == '(': stack.append(ch) else: if stack: stack.pop() print(len(stack)) | No answer selected | Extra '(' remaining |
| 21 | During project setup, if ng serve fails with the error "Local workspace file ('angular.json') could not be found", what is the likely issue? | No answer selected | Problems with node_modules |
| 22 | In Angular, which file is used to define the set of modules, components, and services? | No answer selected | app.module.ts |
| 23 | What will be the Output of the Following Code? def f(x, l=[]): for i in range(x): l.append(i*i) return l print(f(3)) print(f(2)) | No answer selected | [0, 1, 4, 0, 1] |
| 24 | In Angular (≥2+), what is the difference between NgModule.imports and NgModule.exports? | No answer selected | imports declares dependencies the module needs, exports makes parts available to other modules |
| 25 | Which of these is a valid way to lazily load a module in Angular’s router (from Angular 8+)? | No answer selected | { path: 'admin', loadChildren: () => import('./admin/admin.module').then(m => m.AdminModule) } |
| 26 | Given the following models: class Author(models.Model): name = models.CharField(max_length=100) class Book(models.Model): title = models.CharField(max_length=100) author = models.ForeignKey(Author, on_delete=models.CASCADE, related_name='books') Which of these queries returns all Author instances that have no books? | No answer selected | Author.objects.filter(books__isnull=True) |
| 27 | What happens when you call save() on a Django model instance without specifying force_insert or force_update, and the instance has a primary key that already exists in the database? | No answer selected | It will do an UPDATE |
| 28 | In Django REST Framework (DRF), what is the main function of SerializerMethodField? | No answer selected | It enables custom read-only fields whose value is computed by a method |
| 29 | Which of the following is the most efficient way to handle a large number of background tasks in Django? | No answer selected | Integrating with a task queue like Celery. |
| 30 | How would you implement real-time communication (e.g., chat) in a Django application? | No answer selected | Using Django Channels for WebSockets. |
| 31 | What is the primary purpose of ChangeDetectionStrategy.OnPush in Angular? | No answer selected | To improve performance by only checking for changes when input properties change or an event is explicitly triggered. |
| 32 | How can you ensure proper communication between two unrelated Angular components without a direct parent-child relationship? | No answer selected | Utilizing a shared service with a Subject or BehaviorSubject. |
| 33 | When integrating Django as a backend and Angular as a frontend, what is the recommended approach for handling user authentication and authorization? | No answer selected | Implementing token-based authentication (e.g., JWT) where Django issues tokens and Angular stores and sends them. |
| 34 | What will be the Output of the Following Code? Python x = 10 def outer_func(): x = 5 def inner_func(): print(x) inner_func() outer_func() | No answer selected | 5 |
| 35 | What is the best data structure to implement a cache with FIFO eviction policy? | No answer selected | Queue + HashMap |
| 36 | What is the purpose of csrf_token in a Django form? | No answer selected | To prevent Cross-Site Request Forgery (CSRF) attacks by ensuring the request comes from your own site |
| 37 | What is the main advantage of lazy loading feature modules in Angular? | No answer selected | It allows for loading modules on demand, which reduces the initial application load time. |
| 38 | What is the main purpose of the RouterModule.forRoot() method in Angular? | No answer selected | To register the routing service and provide the router configuration for the root application module. |
| 39 | What is the difference between constructor and ngOnInit in an Angular component? | No answer selected | constructor is for dependency injection and simple initializations, while ngOnInit is for more complex logic that should run after the component's inputs are available. |
| 40 | What does the queryset attribute in a Django generic ListView define? | No answer selected | The list of objects that the view will display |
| 41 | In the context of exception handling, what is the purpose of the finally block? | It is always executed, regardless of whether an exception occurred or not. | It is always executed, regardless of whether an exception occurred or not. |
| 42 | What does the pass statement do in Python? | No answer selected | It acts as a placeholder where code is syntactically required but no action is needed. |
| 43 | How do you pass data from a child component back up to a parent component | No answer selected | B) Using @Output() and an EventEmitter. |
| 44 | In the Django MVT (Model-View-Template) architecture, what is the "T"? | No answer selected | Template |
| 45 | How do you pass data from a parent component to a child component? | No answer selected | Using the @Input() decorator. |
Page 1