Programming MCQs Feed

📊 Angular
Q. Which directive is used for looping in Angular templates?
  • (A) *ngIf
  • (B) *ngSwitch
  • (C) *ngFor
  • (D) ngLoop
💬 Discuss
✅ Correct Answer: (C) *ngFor

Explanation: *ngFor is used to iterate over a collection in templates.

📊 Angular
Q. Which file is the root module of an Angular application?
  • (A) main.ts
  • (B) index.html
  • (C) app.module.ts
  • (D) app.component.ts
💬 Discuss
✅ Correct Answer: (C) app.module.ts

Explanation: app.module.ts is the root module that bootstraps the Angular app.

📊 Angular
Q. Which service is used to make HTTP calls in Angular?
  • (A) HttpService
  • (B) HttpClient
  • (C) WebClient
  • (D) ApiService
💬 Discuss
✅ Correct Answer: (B) HttpClient

Explanation: HttpClient service is used for HTTP communication in Angular.

📊 Angular
Q. Which operator is used to bind data from component to template?
  • (A) ()
  • (B) []
  • (C) [()]
  • (D) {}
💬 Discuss
✅ Correct Answer: (B) []

Explanation: Property binding uses square brackets [] to bind data.

📊 Laravel
Q. Which Laravel file defines web routes?
  • (A) routes/api.php
  • (B) routes/web.php
  • (C) routes/console.php
  • (D) routes/channels.php
💬 Discuss
✅ Correct Answer: (B) routes/web.php

Explanation: web.php contains routes for web interface.

📊 Laravel
Q. Which Laravel file defines API routes?
  • (A) routes/web.php
  • (B) routes/api.php
  • (C) routes/console.php
  • (D) routes/services.php
💬 Discuss
✅ Correct Answer: (B) routes/api.php

Explanation: api.php contains stateless API routes.

📊 Laravel
Q. Which Laravel command creates a controller?
  • (A) php artisan make:model
  • (B) php artisan make:controller
  • (C) php artisan make:view
  • (D) php artisan make:route
💬 Discuss
✅ Correct Answer: (B) php artisan make:controller

Explanation: Creates a controller class.

📊 Laravel
Q. Which Laravel command creates a migration?
  • (A) php artisan make:model
  • (B) php artisan make:migration
  • (C) php artisan migrate
  • (D) php artisan db:migrate
💬 Discuss
✅ Correct Answer: (B) php artisan make:migration

Explanation: Creates a migration file.

📊 Laravel
Q. Which Laravel method returns a view?
  • (A) render()
  • (B) view()
  • (C) returnView()
  • (D) loadView()
💬 Discuss
✅ Correct Answer: (B) view()

Explanation: view() returns a Blade view.

📊 Laravel
Q. Which Laravel feature handles HTTP request filtering?
  • (A) Controllers
  • (B) Middleware
  • (C) Policies
  • (D) Guards
💬 Discuss
✅ Correct Answer: (B) Middleware

Explanation: Middleware filters HTTP requests.