MCQs / Computer Science / Web Services: Accessing and Creating

Web Services: Accessing and Creating MCQs — Computer Science (page 2)

35 multiple-choice questions on Web Services: Accessing and Creating from Computer Science, each with the correct answer and, where available, a teacher's explanation. Read through them to revise the chapter, then practise the same questions one by one to test yourself.

26. In Express, app.use(express.json()) is needed to:

  1. Send HTML
  2. Connect to MySQL
  3. Parse JSON request bodies into req.body
  4. Start HTTPS

Answer: C) Parse JSON request bodies into req.body

Explanation: The JSON middleware parses incoming JSON.

Discuss this question

27. JWT stands for:

  1. JavaScript Web Transfer
  2. Joint Web Technology
  3. JSON Web Token
  4. Java Web Toolkit

Answer: C) JSON Web Token

Explanation: JWTs are signed JSON tokens used for authentication.

Discuss this question

28. "Stateless" in REST means:

  1. The app has no UI
  2. Each request contains all information needed; the server stores no client session between requests
  3. The server has no database
  4. Responses cannot be cached

Answer: B) Each request contains all information needed; the server stores no client session between requests

Explanation: Statelessness makes REST scalable.

Discuss this question

29. Prepared statements in PHP/MySQL protect against:

  1. SQL injection
  2. Slow networks
  3. Battery drain
  4. Rotation

Answer: A) SQL injection

Explanation: Parameters are sent separately from the SQL command.

Discuss this question

30. Checking response.isSuccessful in Retrofit tells you whether the status code is:

  1. A redirect
  2. Exactly 404
  3. Above 500
  4. In the 200–299 range

Answer: D) In the 200–299 range

Explanation: isSuccessful is true for 2xx codes.

Discuss this question

31. The curl option -X POST specifies the:

  1. Port number
  2. HTTP method
  3. Response format
  4. Header

Answer: B) HTTP method

Explanation: -X sets the request method.

Discuss this question

32. SOAP messages are written in:

  1. YAML
  2. JSON
  3. XML
  4. CSV

Answer: C) XML

Explanation: SOAP uses XML envelopes.

Discuss this question

33. The file that describes a SOAP service is called:

  1. OpenAPI only
  2. Gradle file
  3. manifest.json
  4. WSDL

Answer: D) WSDL

Explanation: Web Services Description Language describes SOAP operations.

Discuss this question

34. Which endpoint follows REST naming best practice for listing students?

  1. GET /api/students
  2. POST /api/students/list
  3. GET /getAllStudents
  4. GET /api/studentlist.php?action=get

Answer: A) GET /api/students

Explanation: Use plural nouns for resources and HTTP methods for actions.

Discuss this question

35. Which component in a server receives a request and passes it to business logic?

  1. Route / controller
  2. ViewHolder
  3. Layout
  4. Content provider

Answer: A) Route / controller

Explanation: Routes/controllers map URLs to handler code.

Discuss this question

Previous Page 2 of 2

Practise Web Services: Accessing and Creating MCQs

More Computer Science chapters