Loading

Quipoin Menu

Learn • Practice • Grow

angular / Introduction to HttpClient
mcq
Direction: Choose the correct option

Q1.

What is HttpClient in Angular?
A. A service for making HTTP requests
B. An HTTP server
C. A client for HTTP
D. A testing tool
Direction: Choose the correct option

Q2.

Which module provides HttpClient?
A. HttpModule
B. HttpClientModule
C. HttpClient
D. Http
Direction: Choose the correct option

Q3.

How do you inject HttpClient into a service?
A. Using `@Inject`
B. Using `new HttpClient()`
C. Using `@Autowired`
D. Via constructor: `constructor(private http: HttpClient) {}`
Direction: Choose the correct option

Q4.

What does HttpClient return by default?
A. Observable
B. Promise
C. Array
D. String
Direction: Choose the correct option

Q5.

Why does HttpClient use Observables?
A. They are required by Angular
B. They are faster
C. They provide powerful operators and can be cancelled
D. They are easier to use
Direction: Choose the correct option

Q6.

What is the `HttpHeaders` class used for?
A. To create headers
B. To construct and manage HTTP headers
C. To send headers
D. To store headers
Direction: Choose the correct option

Q7.

What is the `HttpParams` class used for?
A. To manage parameters
B. To send parameters
C. To store parameters
D. To construct URL query parameters
Direction: Choose the correct option

Q8.

What is the `HttpResponse` class?
A. Represents request
B. Represents error response
C. Represents response body
D. Represents the full HTTP response including headers and status
Direction: Choose the correct option

Q9.

What is the `HttpErrorResponse` class?
A. Represents an error from HTTP request
B. All of the above
C. Represents network error
D. Represents error response
Direction: Choose the correct option

Q10.

What is the `observe` option in HTTP methods used for?
A. To observe the request
B. To monitor HTTP
C. To specify what part of the response to return (body, response, events)
D. To observe the response