MCQs / Computer Science / Web Services: Accessing and Creating

Web Services: Accessing and Creating MCQs — Computer Science

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.

1. Which method and status code are typical for successfully creating a resource?

  1. PUT, 404
  2. DELETE, 204
  3. POST, 201 Created
  4. GET, 200

Answer: C) POST, 201 Created

Explanation: Creation with POST returns 201.

Discuss this question

2. A permanent two-way connection used for live chat is provided by:

  1. WebSockets
  2. WSDL
  3. REST polling only
  4. SharedPreferences

Answer: A) WebSockets

Explanation: WebSockets keep an open bidirectional connection.

Discuss this question

3. Which free fake API is used in this course to practise GET requests?

  1. maps.google.com
  2. JSONPlaceholder
  3. localhost:8080
  4. api.android.com

Answer: B) JSONPlaceholder

Explanation: jsonplaceholder.typicode.com returns sample JSON.

Discuss this question

4. REST stands for:

  1. REpresentational State Transfer
  2. Resource Entry State Table
  3. Reliable Encrypted Socket Transfer
  4. Remote Execution Service Technology

Answer: A) REpresentational State Transfer

Explanation: REST was defined by Roy Fielding in 2000.

Discuss this question

5. /api/v1/students includes v1 to support:

  1. API versioning
  2. Pagination
  3. Encryption
  4. Authentication

Answer: A) API versioning

Explanation: Versioning allows changes without breaking old apps.

Discuss this question

6. Which HTTP method is NOT idempotent?

  1. POST
  2. PUT
  3. GET
  4. DELETE

Answer: A) POST

Explanation: Repeating POST may create duplicates.

Discuss this question

7. From the Android emulator, the developer computer's localhost is reached at:

  1. 10.0.2.2
  2. 192.168.0.1
  3. 0.0.0.0
  4. 127.0.0.1

Answer: A) 10.0.2.2

Explanation: 10.0.2.2 is the emulator's alias for the host loopback interface.

Discuss this question

8. On Android, tokens should be encrypted using the:

  1. strings.xml file
  2. Android Keystore system
  3. res/raw folder
  4. Logcat

Answer: B) Android Keystore system

Explanation: The Keystore protects cryptographic keys.

Discuss this question

9. A token sent with each request in the header usually looks like:

  1. Host: token
  2. Cookie: password=1234
  3. Content-Type: token
  4. Authorization: Bearer eyJhbGciOi...

Answer: D) Authorization: Bearer eyJhbGciOi...

Explanation: Bearer tokens (often JWT) authenticate API requests.

Discuss this question

10. OpenAPI (Swagger) is used to:

  1. Encrypt APIs
  2. Document APIs and provide interactive testing pages
  3. Compile Kotlin
  4. Host databases

Answer: B) Document APIs and provide interactive testing pages

Explanation: OpenAPI describes endpoints, parameters and responses.

Discuss this question

11. A successful DELETE that returns no body usually responds with:

  1. 500
  2. 301
  3. 204 No Content
  4. 200 with HTML

Answer: C) 204 No Content

Explanation: 204 indicates success without content.

Discuss this question

12. Which tool is widely used to test API endpoints by sending requests manually?

  1. Logcat
  2. Postman
  3. Figma
  4. Gradle

Answer: B) Postman

Explanation: Postman sends HTTP requests and shows responses.

Discuss this question

13. REST is best described as a:

  1. Database
  2. Programming language
  3. Architectural style
  4. Protocol

Answer: C) Architectural style

Explanation: REST is a set of architectural constraints, not a protocol.

Discuss this question

14. A web service is mainly designed for:

  1. Machine-to-machine communication over a network
  2. Drawing layouts
  3. Storing preferences on the phone
  4. Designing app icons

Answer: A) Machine-to-machine communication over a network

Explanation: Web services let programs exchange data over the web.

Discuss this question

15. Before an API is used by a real app it should be deployed with:

  1. HTTP only
  2. No domain
  3. HTTPS on a public server or cloud platform
  4. A WSDL file only

Answer: C) HTTPS on a public server or cloud platform

Explanation: Production APIs must be reachable over HTTPS.

Discuss this question

16. Firebase and Supabase are examples of:

  1. IDEs
  2. Backend-as-a-Service (BaaS) platforms
  3. Mobile operating systems
  4. Programming languages

Answer: B) Backend-as-a-Service (BaaS) platforms

Explanation: BaaS platforms provide databases, auth and APIs without writing a full server.

Discuss this question

17. Which API technology lets the client request exactly the fields it needs?

  1. FTP
  2. SMTP
  3. SOAP
  4. GraphQL

Answer: D) GraphQL

Explanation: GraphQL queries specify the required fields.

Discuss this question

18. Which of these is a popular JavaScript framework for building REST APIs?

  1. Jetpack Compose
  2. Express (Node.js)
  3. Retrofit
  4. Room

Answer: B) Express (Node.js)

Explanation: Express runs on Node.js to build web servers and APIs.

Discuss this question

19. Which Python framework is commonly used to build REST APIs?

  1. ASP.NET
  2. Spring Boot
  3. Django REST Framework / FastAPI / Flask
  4. Laravel

Answer: C) Django REST Framework / FastAPI / Flask

Explanation: Python has several API frameworks.

Discuss this question

20. Why should secret API keys not be stored inside the APK?

  1. Google Play rejects all strings
  2. Keys slow down the app
  3. APKs cannot hold strings
  4. APKs can be decompiled and the keys extracted

Answer: D) APKs can be decompiled and the keys extracted

Explanation: Secrets in the client are not secure; keep them on the server.

Discuss this question

21. "Sign in with Google" is based on which standard?

  1. FTP
  2. SMTP
  3. SOAP
  4. OAuth 2.0 / OpenID Connect

Answer: D) OAuth 2.0 / OpenID Connect

Explanation: OAuth 2.0 and OpenID Connect handle delegated authentication.

Discuss this question

22. In res.status(201).json(item), 201 tells the client that:

  1. The resource was deleted
  2. Authentication is needed
  3. A new resource was created
  4. The request failed

Answer: C) A new resource was created

Explanation: 201 Created confirms creation.

Discuss this question

23. Which is TRUE about REST compared with SOAP?

  1. REST cannot use HTTP
  2. REST needs WSDL
  3. REST only uses XML
  4. REST is lighter, usually uses JSON and is better suited to mobile apps

Answer: D) REST is lighter, usually uses JSON and is better suited to mobile apps

Explanation: REST's lightweight JSON messages suit mobile networks.

Discuss this question

24. Which OkHttp feature can add an Authorization header to every request automatically?

  1. Interceptor
  2. Converter
  3. Dispatcher
  4. Adapter

Answer: A) Interceptor

Explanation: Interceptors modify requests and responses.

Discuss this question

25. GET /api/students?semester=5&page=2 uses query parameters for:

  1. Creating a record
  2. Deleting records
  3. Authentication
  4. Filtering and pagination

Answer: D) Filtering and pagination

Explanation: Query strings filter and paginate lists.

Discuss this question

Page 1 of 2 Next

Practise Web Services: Accessing and Creating MCQs

More Computer Science chapters