Loading

Quipoin Menu

Learn • Practice • Grow

angular / Making GET and POST Requests
mcq
Direction: Choose the correct option

Q1.

How do you make a GET request with HttpClient?
A. `this.http.fetch('/api/users')`
B. `this.http.get('/api/users')`
C. `this.http.request('GET', '/api/users')`
D. `this.http.getData('/api/users')`
Direction: Choose the correct option

Q2.

How do you make a POST request with data?
A. `this.http.send('/api/users', userData)`
B. `this.http.post('/api/users', userData)`
C. `this.http.put('/api/users', userData)`
D. `this.http.post('/api/users', {body: userData})`
Direction: Choose the correct option

Q3.

How do you type the response from HttpClient?
A. Using `as` keyword
B. Using `response.json()`
C. Using generics: `http.get<User[]>`
D. Using `map` operator
Direction: Choose the correct option

Q4.

What does the `http.put()` method do?
A. Sends a PUT request to update a resource
B. Sends a PATCH request
C. Sends a DELETE request
D. Sends a POST request
Direction: Choose the correct option

Q5.

How do you send request headers with HttpClient?
A. Use `setHeader` method
B. Add headers in the URL
C. Headers are sent automatically
D. Pass an `HttpHeaders` object in the request options
Direction: Choose the correct option

Q6.

How do you send URL query parameters?
A. Pass an `HttpParams` object in the `params` option
B. Use `?` in URL
C. Append to URL string
D. All of the above
Direction: Choose the correct option

Q7.

What is the `http.delete()` method used for?
A. To delete data
B. To cancel requests
C. To remove HTTP
D. To send DELETE request to remove a resource
Direction: Choose the correct option

Q8.

How do you make a PATCH request?
A. `http.patch(url, data)`
B. `http.put(url, data)`
C. `http.update(url, data)`
D. `http.modify(url, data)`
Direction: Choose the correct option

Q9.

What is the purpose of the `reportProgress` option?
A. To report progress
B. To track upload/download progress events
C. To monitor progress
D. To log progress
Direction: Choose the correct option

Q10.

What is the `responseType` option used for?
A. To specify the expected response type (json, text, blob, arraybuffer)
B. To define response
C. To format response
D. To set response type