Web Programming

  1. Which HTTP method is idempotent but not safe?
    A. GET
    B. POST
    C. PUT
    D. CONNECT
    Answer: C
  2. What does the Same-Origin Policy primarily prevent?
    A. SQL Injection
    B. Cross-site scripting
    C. Unauthorized DOM access across domains
    D. DNS spoofing
    Answer: C
  3. In REST architecture, which constraint enforces statelessness?
    A. Cacheable
    B. Client-Server
    C. Stateless
    D. Uniform Interface
    Answer: C
  4. Which JavaScript feature allows asynchronous code execution?
    A. Closure
    B. Callback Queue
    C. Prototype
    D. Hoisting
    Answer: B
  5. What is the default port for HTTPS?
    A. 21
    B. 80
    C. 443
    D. 25
    Answer: C
  6. Which CSS property creates a stacking context?
    A. display
    B. position with z-index
    C. margin
    D. padding
    Answer: B
  7. Which HTML5 API is used for drawing graphics?
    A. WebGL
    B. Canvas
    C. SVG
    D. DOM
    Answer: B
  8. Which HTTP header is used to control caching?
    A. Authorization
    B. Content-Type
    C. Cache-Control
    D. Accept
    Answer: C
  9. What does CORS stand for?
    A. Cross-Origin Resource Sharing
    B. Cross Object Rendering System
    C. Client Object Request System
    D. Cross-Origin Response Security
    Answer: A
  10. Which JavaScript keyword creates block scope?
    A. var
    B. let
    C. function
    D. global
    Answer: B
  11. Which protocol is used for real-time web communication?
    A. HTTP
    B. FTP
    C. WebSocket
    D. SMTP
    Answer: C
  12. Which CSS unit is relative to root element?
    A. em
    B. px
    C. rem
    D. %
    Answer: C
  13. Which tag is used for embedding video in HTML5?
    A. media
    B. video
    C. embed
    D. object
    Answer: B
  14. Which JavaScript method converts JSON string to object?
    A. JSON.stringify()
    B. JSON.parse()
    C. parseJSON()
    D. toObject()
    Answer: B
  15. Which HTTP status code means “Created”?
    A. 200
    B. 201
    C. 204
    D. 301
    Answer: B
  16. What is the main purpose of a Service Worker?
    A. Styling
    B. Background scripts and caching
    C. Database management
    D. DOM manipulation
    Answer: B
  17. Which CSS property controls flex direction?
    A. align-items
    B. flex-direction
    C. justify-content
    D. flex-wrap
    Answer: B
  18. Which attack injects malicious scripts into web pages?
    A. CSRF
    B. XSS
    C. SQL Injection
    D. MITM
    Answer: B
  19. Which database is commonly used with Node.js?
    A. Oracle
    B. MySQL
    C. MongoDB
    D. DB2
    Answer: C
  20. Which JavaScript concept refers to function retaining access to outer scope?
    A. Inheritance
    B. Closure
    C. Callback
    D. Binding
    Answer: B
  21. Which HTML element defines navigation links?
    A. nav
    B. link
    C. menu
    D. section
    Answer: A
  22. Which CSS property is used to create grid layout?
    A. display: flex
    B. display: grid
    C. float
    D. position
    Answer: B
  23. Which HTTP method is not idempotent?
    A. GET
    B. PUT
    C. DELETE
    D. POST
    Answer: D
  24. Which JavaScript method adds element to end of array?
    A. push()
    B. pop()
    C. shift()
    D. unshift()
    Answer: A
  25. Which security mechanism protects against CSRF?
    A. Tokens
    B. Encryption
    C. Hashing
    D. Cookies
    Answer: A
  26. Which HTML attribute specifies inline styles?
    A. class
    B. id
    C. style
    D. css
    Answer: C
  27. Which protocol sends emails?
    A. HTTP
    B. SMTP
    C. FTP
    D. DNS
    Answer: B
  28. Which JavaScript keyword refers to current object?
    A. self
    B. this
    C. current
    D. object
    Answer: B
  29. Which CSS property controls overflow?
    A. overflow
    B. clip
    C. hidden
    D. visible
    Answer: A
  30. Which HTTP status code means “Not Found”?
    A. 200
    B. 301
    C. 404
    D. 500
    Answer: C
  31. Which API allows storing key-value pairs in browser?
    A. DOM
    B. Web Storage
    C. WebRTC
    D. Fetch API
    Answer: B
  32. Which JavaScript loop executes at least once?
    A. for
    B. while
    C. do-while
    D. foreach
    Answer: C
  33. Which CSS property sets text color?
    A. font-color
    B. text-style
    C. color
    D. background-color
    Answer: C
  34. Which HTML tag defines form input?
    A. form
    B. input
    C. field
    D. text
    Answer: B
  35. Which HTTP method retrieves data?
    A. POST
    B. GET
    C. PUT
    D. DELETE
    Answer: B
  36. Which JavaScript method removes last element?
    A. shift()
    B. pop()
    C. push()
    D. splice()
    Answer: B
  37. Which CSS property controls element visibility?
    A. display
    B. opacity
    C. visibility
    D. hide
    Answer: C
  38. Which JavaScript object handles asynchronous HTTP requests?
    A. XMLHttpRequest
    B. DOM
    C. JSON
    D. BOM
    Answer: A
  39. Which HTML tag is used for hyperlink?
    A. link
    B. href
    C. a
    D. url
    Answer: C
  40. Which protocol resolves domain names?
    A. HTTP
    B. DNS
    C. FTP
    D. TCP
    Answer: B
  41. Which JavaScript feature allows inheritance?
    A. Prototype
    B. Closure
    C. Scope
    D. Hoisting
    Answer: A
  42. Which CSS property aligns items horizontally in flexbox?
    A. align-items
    B. justify-content
    C. flex-direction
    D. align-content
    Answer: B
  43. Which HTTP header defines content type?
    A. Accept
    B. Content-Type
    C. Authorization
    D. Host
    Answer: B
  44. Which JavaScript function delays execution?
    A. setTimeout()
    B. setInterval()
    C. delay()
    D. wait()
    Answer: A
  45. Which HTML tag defines table row?
    A. td
    B. tr
    C. th
    D. table
    Answer: B
  46. Which CSS property sets background color?
    A. bg-color
    B. color
    C. background-color
    D. fill
    Answer: C
  47. Which JavaScript method converts object to JSON?
    A. JSON.parse()
    B. JSON.stringify()
    C. toJSON()
    D. convert()
    Answer: B
  48. Which HTTP status code means server error?
    A. 300
    B. 400
    C. 500
    D. 600
    Answer: C
  49. Which HTML tag defines unordered list?
    A. ol
    B. ul
    C. li
    D. list
    Answer: B
  50. Which CSS property controls font size?
    A. text-size
    B. font-size
    C. size
    D. text-style
    Answer: B

Leave a Comment