Trishul API MCQs with answers Page - 19

Here, you will find a collection of MCQ questions on Trishul API . Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 833K Points
Coach

Q. What does get_body() return?

  • (A) Array
  • (B) ResponseBody object
  • (C) JSON string
  • (D) String

A

Admin • 833K Points
Coach

Q. What does get_status_code() return?

  • (A) String
  • (B) Boolean
  • (C) HTTP status code
  • (D) Response object

A

Admin • 833K Points
Coach

Q. Which header is automatically set by json()?

  • (A) Content-Length
  • (B) Content-Type: application/json
  • (C) Authorization
  • (D) Accept

A

Admin • 833K Points
Coach

Q. What is a key design aspect of Response class?

  • (A) Instance-based properties
  • (B) Static properties
  • (C) Thread-safe variables
  • (D) Immutable design

A

Admin • 833K Points
Coach

Q. What is a risk of using static properties in Response?

  • (A) Slow execution
  • (B) Memory leak
  • (C) Issues in concurrent environments
  • (D) Compilation error

A

Admin • 833K Points
Coach

Q. When should headers and cookies be set?

  • (A) After out()
  • (B) Before out()
  • (C) After response sent
  • (D) Never

A

Admin • 833K Points
Coach

Q. What does Response::json() NOT do?

  • (A) Create response object
  • (B) Set status code
  • (C) Send response
  • (D) Set JSON header

A

Admin • 833K Points
Coach

Q. What is correct usage to immediately return response?

Code:
Response::out(HttpStatus::OK, $data);
  • (A) Correct
  • (B) Incorrect - missing header
  • (C) Incorrect - wrong method
  • (D) Incorrect - wrong param

A

Admin • 833K Points
Coach

Q. Which statement is true about Response class?

  • (A) Supports XML and JSON
  • (B) Only supports JSON currently
  • (C) Supports HTML rendering
  • (D) Supports binary responses

A

Admin • 833K Points
Coach

Q. What is the primary responsibility of the Request class in Trishul API?

  • (A) Handling database queries
  • (B) Managing HTTP requests
  • (C) Rendering views
  • (D) Managing background jobs

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ