(Section 02 — Leach)
EXAM 1 COMPREHENSIVE PREP
Practice Questions · Correct Answers · Rationales
WEB BASICS · SESSIONS · ENCRYPTION · SECURITY
REST APIs · JAVASCRIPT
Aligned with schedule through JavaScript 2 (Exam 1)
HIGH-QUALITY · EXAM-READY
,CS 4288 WEB SYSTEMS (LEACH) | EXAM 1 PREP Comprehensive Practice
PRACTICE SET 1
1. HTTP is a stateless request-response protocol at the application layer.
A. True
B. False
C. Only stateful
D. Only UDP
Correct Answer: A
Rationale:
Cookies/sessions add application state.
Typically over TCP.
2. Default ports: HTTP 80, HTTPS 443.
A. True
B. False
C. Reverse
D. Both 8080
Correct Answer: A
Rationale:
Well-known ports.
Shown in URL when non-default.
3. GET should be safe and idempotent.
A. True
B. False
C. Only POST is safe
D. GET always mutates
Correct Answer: A
Rationale:
Retrieve resources.
No intended side effects.
4. POST is commonly used to create resources and submit forms.
A. True
B. False
C. Only for deletes
D. Always idempotent
Correct Answer: A
Rationale:
Not generally idempotent.
Contrast with PUT.
Page 2
,CS 4288 WEB SYSTEMS (LEACH) | EXAM 1 PREP Comprehensive Practice
PRACTICE SET 2
5. 200 OK indicates success; 404 Not Found; 500 server error.
A. True
B. False
C. 404 is success
D. 200 is redirect
Correct Answer: A
Rationale:
2xx success, 4xx client, 5xx server.
301/302 redirects.
6. Cookies travel on later requests via the Cookie header.
A. True
B. False
C. Only Set-Cookie forever
D. Only Authorization
Correct Answer: A
Rationale:
Server sets with Set-Cookie.
Scope: Domain, Path, flags.
7. SameSite helps mitigate CSRF.
A. True
B. False
C. Only XSS
D. Only SQLi
Correct Answer: A
Rationale:
Controls cross-site cookie sending.
Use with CSRF tokens.
8. HttpOnly prevents document.cookie access to the cookie.
A. True
B. False
C. Prevents all network send
D. Forces HTTP
Correct Answer: A
Rationale:
XSS mitigation.
Still sent on HTTP requests.
Page 3
, CS 4288 WEB SYSTEMS (LEACH) | EXAM 1 PREP Comprehensive Practice
PRACTICE SET 3
9. Server sessions store data server-side; client holds a session ID.
A. True
B. False
C. All data only in URL
D. No server state ever
Correct Answer: A
Rationale:
More control than pure client storage.
Fixation: rotate ID at login.
10. Secure cookie flag restricts cookie to HTTPS.
A. True
B. False
C. Means signed
D. Means HttpOnly
Correct Answer: A
Rationale:
Combine Secure+HttpOnly+SameSite.
Production HTTPS required.
11. Symmetric crypto: same key encrypts and decrypts (e.g., AES).
A. True
B. False
C. Only public keys
D. Hash only
Correct Answer: A
Rationale:
Fast bulk encryption.
Key distribution challenge.
12. Asymmetric crypto: public/private key pair (RSA, ECC).
A. True
B. False
C. Same key both ways only
D. No math
Correct Answer: A
Rationale:
Signatures and key exchange.
TLS uses both symmetric and asymmetric.
Page 4