MCQs / Computer Science / Lab: Supabase Backend and Retrofit
Lab: Supabase Backend and Retrofit MCQs — Computer Science 12 multiple-choice questions on Lab: Supabase Backend and Retrofit 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 policy lets users who are not signed in read notices? for insert to anon with check (false) No policy is needed with RLS on for select to anon, authenticated using (true) for delete using (true) Answer: C) for select to anon, authenticated using (true)
Explanation: anon is the role without a signed-in user.
Discuss this question
2. Why does inserting a 2-character notice fail even with an insert policy? Gson cannot send short strings Retrofit trims it RLS blocks short text The CHECK constraint requires 3–200 characters Answer: D) The CHECK constraint requires 3–200 characters
Explanation: Constraints still apply after RLS allows the insert.
Discuss this question
3. Which call shows a newly posted notice in the list? Restarting the emulator Clearing app data Calling load() again after the insert succeeds notifyItemRemoved(0) Answer: C) Calling load() again after the insert succeeds
Explanation: Re-fetching updates the adapter.
Discuss this question
4. A 404 from /rest/v1/notice (without s) most likely means: The body was too long The key expired RLS blocked it The table name is wrong Answer: D) The table name is wrong
Explanation: PostgREST returns 404 for an unknown table.
Discuss this question
5. "Unresolved reference: BuildConfig" is fixed by: Renaming MainActivity Deleting local.properties buildConfig = true in buildFeatures and rebuilding Adding INTERNET permission Answer: C) buildConfig = true in buildFeatures and rebuilding
Explanation: BuildConfig generation is off by default in new projects.
Discuss this question
6. Why can't you test the notices API by just opening the URL in a browser? The URL must start with ftp Browsers cannot show JSON The apikey must be sent in a request header Supabase blocks Chrome Answer: C) The apikey must be sent in a request header
Explanation: Use curl or Postman to add headers.
Discuss this question
7. UnknownHostException in SupaNotes usually means: No internet or wrong host name The adapter is empty RLS denied the request The table has no rows Answer: A) No internet or wrong host name
Explanation: DNS failed to resolve the host.
Discuss this question
8. The baseUrl passed to Retrofit must: Contain the table name End with a slash Use http only Include the API key Answer: B) End with a slash
Explanation: Retrofit requires a trailing / on baseUrl.
Discuss this question
9. Which permission must SupaNotes declare? SENDSMS android.permission.INTERNET ACCESSFINELOCATION CAMERA Answer: B) android.permission.INTERNET
Explanation: Network calls need INTERNET.
Discuss this question
10. In the lab, "generated always as identity" on the id column means: The id can be edited The id is a UUID The app must send an id The database numbers rows automatically Answer: D) The database numbers rows automatically
Explanation: Identity columns auto-increment.
Discuss this question
11. Why are id and createdat not sent when posting a notice? They are sent as zero Retrofit deletes them Gson skips null fields, so the database fills them in Supabase forbids those names Answer: C) Gson skips null fields, so the database fills them in
Explanation: Defaults are applied by the database.
Discuss this question
12. In curl, -H "apikey: …" adds: A request header A cookie file A JSON body A query parameter Answer: A) A request header
Explanation: -H sets headers; -d sends a body.
Discuss this question
Practise Lab: Supabase Backend and Retrofit MCQs
More Computer Science chapters