Top 150 MCQs on Fullstack Web Development (HTML, CSS, JavaScript, Docker, Node.js, React & More)
Prepare for your Fullstack Web Development exams with these 150+ multiple-choice questions (MCQs) with answers. Topics covered include HTML, CSS, JavaScript, Containers with Docker, Kubernetes & OpenShift, Node.js & Express, and React. Perfect for students, beginners, and professionals revising web development concepts.
📝MCQs – Introduction to HTML, CSS, JavaScript
**HTML
1. Which HTML5 element is used to define navigation links?
a) <nav>
b) <menu>
c) <navigation>
d) <links>
Answer: a) <nav>
2. Which input type is used to create a slider in HTML5?
a) range
b) slider
c) scale
d) progress
Answer: a) range
3. Which tag is used to embed a video in HTML5?
a) <media>
b) <movie>
c) <video>
d) <embed>
Answer: c) <video>
4. In HTML5, which attribute specifies that an input field must be filled before submitting?
a) validate
b) placeholder
c) required
d) checked
Answer: c) required
5. Which attribute is used with the <form>
element to specify where to send form data?
a) method
b) action
c) target
d) enctype
Answer: b) action
6. Which HTML element is used to define important text?
a) <strong>
b) <em>
c) <b>
d) <i>
Answer: a) <strong>
7. Which element is used to display scalar measurements within a known range?
a) <progress>
b) <meter>
c) <range>
d) <scale>
Answer: b) <meter>
8. Which tag is used to display preformatted text in HTML?
a) <p>
b) <pre>
c) <code>
d) <format>
Answer: b) <pre>
9. Which attribute specifies the character encoding in HTML?
a) charset
b) encoding
c) lang
d) code
Answer: a) charset
10. The correct HTML5 element for the main content of a webpage is:
a) <body>
b) <main>
c) <section>
d) <article>
Answer: b) <main>
11. Which HTML attribute is used to provide a tooltip when the mouse hovers?
a) name
b) alt
c) title
d) tooltip
Answer: c) title
12. Which HTML tag is semantic?
a) <div>
b) <span>
c) <article>
d) <font>
Answer: c) <article>
13. Which tag is used to embed an external web page in HTML?
a) <embed>
b) <iframe>
c) <frame>
d) <object>
Answer: b) <iframe>
14. Which attribute is used with <audio>
to start playing automatically?
a) start
b) play
c) autoplay
d) auto
Answer: c) autoplay
15. Which tag is used for inline quotations?
a) <q>
b) <blockquote>
c) <cite>
d) <quote>
Answer: a) <q>
16. Which HTML element defines the footer of a document?
a) <bottom>
b) <footer>
c) <section>
d) <aside>
Answer: b) <footer>
17. Which is the correct way to write a comment in HTML?
a) // comment
b) <!-- comment -->
c) /* comment */
d) ** comment **
Answer: b) <!-- comment -->
CSS
18. Which CSS property controls the text size?
a) text-size
b) font-size
c) font-style
d) size
Answer: b) font-size
19. Which CSS property is used to change text color?
a) text-color
b) font-color
c) color
d) background-color
Answer: c) color
20. Which CSS property is used for controlling the space between letters?
a) word-spacing
b) line-height
c) letter-spacing
d) text-indent
Answer: c) letter-spacing
21. The default position value of an HTML element in CSS is:
a) absolute
b) relative
c) static
d) fixed
Answer: c) static
22. Which CSS property is used to make text bold?
a) font-weight
b) text-style
c) font-bold
d) text-weight
Answer: a) font-weight
23. Which CSS property sets the transparency of an element?
a) visibility
b) opacity
c) filter
d) transparency
Answer: b) opacity
24. Which CSS unit is relative to the parent element’s font-size?
a) px
b) em
c) %
d) rem
Answer: b) em
25. Which property is used to make a flex container?
a) display: flex
b) flex: container
c) position: flex
d) flex: block
Answer: a) display: flex
26. Which property in CSS is used to change the cursor style?
a) cursor
b) pointer
c) mouse-style
d) hover
Answer: a) cursor
27. In CSS, which symbol is used to target an ID selector?
a) .
b) #
c) *
d) :
Answer: b) #
28. Which pseudo-class is used when a user hovers over an element?
a) :hover
b) :focus
c) :active
d) :visited
Answer: a) :hover
29. Which CSS property is used to control stacking order?
a) z-index
b) stack
c) order
d) position
Answer: a) z-index
30. Which property is used to add shadows to text in CSS?
a) box-shadow
b) text-shadow
c) shadow
d) font-shadow
Answer: b) text-shadow
31. Which CSS property defines the space between content and border?
a) margin
b) padding
c) border-spacing
d) spacing
Answer: b) padding
32. Which property is used for rounded corners in CSS?
a) border-corner
b) border-style
c) border-radius
d) border-round
Answer: c) border-radius
33. Which CSS method is NOT valid?
a) Inline CSS
b) Internal CSS
c) External CSS
d) Remote CSS
Answer: d) Remote CSS
JavaScript
34. Which symbol is used for comments in JavaScript?
a) <!-- -->
b) //
c) **
d) ##
Answer: b) //
35. Which company developed JavaScript?
a) Microsoft
b) Sun Microsystems
c) Netscape
d) Oracle
Answer: c) Netscape
36. Which keyword is used to declare a constant in JavaScript?
a) var
b) let
c) const
d) define
Answer: c) const
37. What will typeof null
return in JavaScript?
a) null
b) object
c) undefined
d) boolean
Answer: b) object
38. Which operator is used for strict equality in JavaScript?
a) ==
b) ===
c) =
d) :=
Answer: b) ===
39. Which method is used to parse a string into an integer?
a) parseInt()
b) parseFloat()
c) Number()
d) toInteger()
Answer: a) parseInt()
40. Which JavaScript method is used to select an element by ID?
a) getElement()
b) querySelector()
c) getElementById()
d) getById()
Answer: c) getElementById()
41. Which of the following is NOT a JavaScript data type?
a) Number
b) Boolean
c) Character
d) Object
Answer: c) Character
42. Which keyword is used to exit from a loop prematurely?
a) stop
b) exit
c) break
d) return
Answer: c) break
43. Which function displays a popup with a message and an OK button?
a) alert()
b) confirm()
c) prompt()
d) notify()
Answer: a) alert()
44. What is the result of 2 + "2"
in JavaScript?
a) 4
b) 22
c) Error
d) NaN
Answer: b) 22
45. Which array method adds one or more elements to the end of an array?
a) push()
b) pop()
c) shift()
d) unshift()
Answer: a) push()
46. Which function is used to delay execution of code in JavaScript?
a) delay()
b) wait()
c) setTimeout()
d) setInterval()
Answer: c) setTimeout()
47. Which loop is guaranteed to run at least once?
a) for
b) while
c) do...while
d) foreach
Answer: c) do...while
48. Which statement is used to handle exceptions in JavaScript?
a) try...catch
b) do...catch
c) if...else
d) throw...if
Answer: a) try...catch
49. Which function converts a JSON string into a JavaScript object?
a) JSON.parse()
b) JSON.stringify()
c) parseJSON()
d) toJSON()
Answer: a) JSON.parse()
50. Which keyword is used to define a class in JavaScript?
a) function
b) class
c) object
d) constructor
Answer: b) class
Docker
51. Docker is primarily used for:
a) Virtual Machines
b) Application containerization
c) Cloud storage
d) Networking
Answer: b) Application containerization
52. Which of the following is NOT a component of Docker?
a) Docker Engine
b) Docker CLI
c) Docker Compose
d) Docker Hive
Answer: d) Docker Hive
53. The default Docker network driver is:
a) none
b) bridge
c) host
d) overlay
Answer: b) bridge
54. Which command lists all running Docker containers?
a) docker ps
b) docker run
c) docker images
d) docker start
Answer: a) docker ps
55. Which command is used to build a Docker image from a Dockerfile?
a) docker run
b) docker build
c) docker commit
d) docker create
Answer: b) docker build
56. Which file is used to define multi-container Docker applications?
a) Dockerfile
b) docker-compose.yml
c) DockerManifest.json
d) docker-config.yml
Answer: b) docker-compose.yml
57. Which command is used to remove all stopped containers, unused networks, and dangling images?
a) docker clean
b) docker prune
c) docker remove
d) docker reset
Answer: b) docker prune
58. In Dockerfile, which instruction is used to set the base image?
a) RUN
b) CMD
c) FROM
d) ENTRYPOINT
Answer: c) FROM
59. Which command shows Docker’s system-wide information?
a) docker status
b) docker info
c) docker inspect
d) docker system
Answer: b) docker info
60. The default storage driver for Docker on Linux is:
a) aufs
b) overlay2
c) btrfs
d) zfs
Answer: b) overlay2
61. What does the EXPOSE
instruction in a Dockerfile do?
a) Opens a port at runtime
b) Documents the port used
c) Secures the container
d) Starts the service
Answer: b) Documents the port used
62. Which command is used to fetch an image from Docker Hub?
a) docker fetch
b) docker pull
c) docker get
d) docker clone
Answer: b) docker pull
63. Which isolation technology does Docker rely on in Linux?
a) VirtualBox
b) Hyper-V
c) cgroups and namespaces
d) Xen
Answer: c) cgroups and namespaces
64. Which of the following is true about containers?
a) Containers are heavier than VMs
b) Containers include OS kernel
c) Containers share host OS kernel
d) Containers run only on Windows
Answer: c) Containers share host OS kernel
65. Which file contains instructions to create a custom Docker image?
a) Dockerfile
b) docker-compose.yml
c) DockerEngine.conf
d) config.json
Answer: a) Dockerfile
66. Which Docker command is used to attach a container’s STDIN/STDOUT to your terminal?
a) docker start
b) docker exec
c) docker attach
d) docker connect
Answer: c) docker attach
67. Which of these is NOT a Docker object?
a) Image
b) Container
c) Volume
d) Slot
Answer: d) Slot
68. Docker images are:
a) Read-only templates
b) Running containers
c) YAML files
d) Virtual machines
Answer: a) Read-only templates
69. Which Docker command stops a running container?
a) docker pause
b) docker remove
c) docker stop
d) docker kill
Answer: c) docker stop
70. Which command is used to view logs of a container?
a) docker logs
b) docker history
c) docker events
d) docker inspect
Answer: a) docker logs
71. Which Docker feature is used to persist container data?
a) Network
b) Volume
c) Overlay
d) Bind
Answer: b) Volume
72. Which Docker component manages communication between containers?
a) Registry
b) Orchestrator
c) Networking driver
d) Engine
Answer: c) Networking driver
Kubernetes
73. Kubernetes was originally developed by:
a) Amazon
b) Google
c) Microsoft
d) IBM
Answer: b) Google
74. The smallest deployable unit in Kubernetes is:
a) Pod
b) Node
c) Service
d) Cluster
Answer: a) Pod
75. Which Kubernetes component schedules workloads on nodes?
a) kube-proxy
b) kube-scheduler
c) kube-controller-manager
d) etcd
Answer: b) kube-scheduler
76. Which Kubernetes object exposes a set of Pods as a network service?
a) ConfigMap
b) Service
c) Deployment
d) StatefulSet
Answer: b) Service
77. Which command-line tool is used to interact with Kubernetes?
a) kubeconfig
b) kubectl
c) kubeadm
d) k8s-cli
Answer: b) kubectl
78. Which Kubernetes object is used for storing non-confidential configuration data?
a) Secret
b) ConfigMap
c) Volume
d) PodSpec
Answer: b) ConfigMap
79. etcd in Kubernetes is used for:
a) Logging
b) Monitoring
c) Cluster state storage
d) Networking
Answer: c) Cluster state storage
80. Which type of Kubernetes Service provides a static IP within the cluster?
a) ClusterIP
b) NodePort
c) LoadBalancer
d) ExternalName
Answer: a) ClusterIP
81. Which controller ensures that the desired number of Pod replicas are running?
a) ReplicaSet
b) Deployment
c) DaemonSet
d) StatefulSet
Answer: a) ReplicaSet
82. In Kubernetes, a worker machine is called a:
a) Pod
b) Node
c) Service
d) Controller
Answer: b) Node
83. Which Kubernetes resource provides unique, stable network identities for Pods?
a) Service
b) Deployment
c) StatefulSet
d) ReplicaSet
Answer: c) StatefulSet
84. What is the default namespace in Kubernetes?
a) kube-system
b) default
c) kube-public
d) prod
Answer: b) default
85. Which Kubernetes resource is used to manage secrets like passwords?
a) Secret
b) ConfigMap
c) Volume
d) ServiceAccount
Answer: a) Secret
86. A DaemonSet ensures:
a) Only one pod per cluster
b) Pods run on all nodes
c) Scaling of deployments
d) Load balancing
Answer: b) Pods run on all nodes
87. Which YAML field specifies the desired state of a Kubernetes object?
a) metadata
b) spec
c) status
d) apiVersion
Answer: b) spec
88. Which Kubernetes object updates Pods without downtime?
a) StatefulSet
b) Deployment
c) Job
d) CronJob
Answer: b) Deployment
89. In Kubernetes, Helm is used for:
a) Logging
b) Monitoring
c) Package management
d) Networking
Answer: c) Package management
90. The default container runtime used by Kubernetes is:
a) Docker
b) CRI-O
c) containerd
d) rkt
Answer: c) containerd
91. Which Kubernetes object runs a task to completion?
a) Pod
b) Job
c) Deployment
d) StatefulSet
Answer: b) Job
92. Kubernetes Ingress is used for:
a) Internal networking
b) API authentication
c) HTTP/HTTPS routing
d) Pod storage
Answer: c) HTTP/HTTPS routing
93. Which Kubernetes object is used to schedule tasks at fixed times?
a) Job
b) CronJob
c) ReplicaSet
d) StatefulSet
Answer: b) CronJob
OpenShift
94. OpenShift is built on top of:
a) VMware
b) Docker + Kubernetes
c) VirtualBox
d) Terraform
Answer: b) Docker + Kubernetes
95. Which company develops OpenShift?
a) Red Hat
b) Google
c) Microsoft
d) IBM
Answer: a) Red Hat
96. Which OpenShift command-line tool is used to manage clusters?
a) kubectl
b) oc
c) docker
d) osctl
Answer: b) oc
97. OpenShift adds which feature on top of Kubernetes?
a) Built-in CI/CD and developer tools
b) New container runtime
c) Replacement for Pods
d) Alternative to Helm
Answer: a) Built-in CI/CD and developer tools
98. The OpenShift Web Console provides:
a) Monitoring only
b) Full UI for managing projects, apps, and users
c) Only networking configuration
d) Storage configuration
Answer: b) Full UI for managing projects, apps, and users
99. Which OpenShift object represents an application deployment?
a) BuildConfig
b) DeploymentConfig
c) ServiceAccount
d) Route
Answer: b) DeploymentConfig
100. In OpenShift, Routes are used for:
a) Connecting containers internally
b) Exposing services to external clients
c) Mounting storage
d) Defining pod limits
Answer: b) Exposing services to external clients
Node.js & Express
101. Node.js is built on which JavaScript engine?
a) SpiderMonkey
b) V8
c) Chakra
d) Nashorn
Answer: b) V8
102. Which module in Node.js is used to create a web server?
a) url
b) http
c) net
d) server
Answer: b) http
103. Which command initializes a new Node.js project with a package.json file?
a) node init
b) npm install
c) npm init
d) node install
Answer: c) npm init
104. What is the default scope of variables declared with var
in Node.js?
a) Global
b) Function
c) Block
d) Module
Answer: b) Function
105. Which method is used to import modules in Node.js (CommonJS)?
a) import
b) require()
c) include()
d) use()
Answer: b) require()
106. Which of the following is NOT a built-in Node.js module?
a) fs
b) events
c) express
d) path
Answer: c) express
107. What is the default port number used by Express if not specified?
a) 80
b) 3000
c) 8080
d) 5000
Answer: b) 3000
108. In Express, app.use(express.json())
is used for:
a) Parsing URL parameters
b) Parsing JSON request body
c) Setting content-type
d) Sending JSON response
Answer: b) Parsing JSON request body
109. Which function in Express is used to define middleware?
a) app.listen()
b) app.get()
c) app.use()
d) app.post()
Answer: c) app.use()
110. What is the purpose of next()
in Express middleware?
a) Stops the request
b) Passes control to the next middleware
c) Restarts the request
d) Sends the response
Answer: b) Passes control to the next middleware
111. Which HTTP method is idempotent and used to retrieve data?
a) POST
b) GET
c) PUT
d) DELETE
Answer: b) GET
112. In Express, how do you send a JSON response?
a) res.sendJSON()
b) res.json()
c) res.stringify()
d) res.sendFile()
Answer: b) res.json()
113. Which method is used in Node.js to read a file asynchronously?
a) fs.readFile()
b) fs.read()
c) fs.getFile()
d) fs.openFile()
Answer: a) fs.readFile()
114. Which Express middleware is commonly used for handling file uploads?
a) body-parser
b) multer
c) cookie-parser
d) morgan
Answer: b) multer
115. Which status code means "Created" in HTTP responses?
a) 200
b) 201
c) 202
d) 204
Answer: b) 201
116. Which statement about package-lock.json
is correct?
a) Stores environment variables
b) Locks exact versions of dependencies
c) Used for logging requests
d) Contains Express configuration
Answer: b) Locks exact versions of dependencies
117. Which Express function is used to serve static files (e.g., HTML, CSS)?
a) app.static()
b) express.static()
c) app.useStatic()
d) res.static()
Answer: b) express.static()
118. Which global object in Node.js is similar to window
in browsers?
a) document
b) process
c) global
d) system
Answer: c) global
119. In Express, what does app.listen(3000)
do?
a) Creates a new server
b) Binds and listens for connections on port 3000
c) Runs database on port 3000
d) Sends a request on port 3000
Answer: b) Binds and listens for connections on port 3000
120. Which of the following is true about Express?
a) It is a front-end framework
b) It is built on top of Node.js
c) It replaces Node.js
d) It runs only on Python
Answer: b) It is built on top of Node.js
React (121–150)
121. React was developed by:
a) Google
b) Facebook
c) Microsoft
d) Twitter
Answer: b) Facebook
122. What type of architecture does React follow?
a) MVC
b) MVVM
c) Component-based
d) Layered
Answer: c) Component-based
123. JSX in React stands for:
a) JavaScript Extension
b) Java Syntax Extension
c) JavaScript XML
d) JSON XML
Answer: c) JavaScript XML
124. Which method is used to create components in modern React?
a) React.createClass()
b) function or class components
c) React.component()
d) React.module()
Answer: b) function or class components
125. In React, what is used to pass data from parent to child components?
a) state
b) props
c) context
d) reducers
Answer: b) props
126. The default method to render React elements into the DOM is:
a) ReactDOM.render()
b) React.renderDOM()
c) React.render()
d) DOM.render()
Answer: a) ReactDOM.render()
127. In React, which hook is used to manage component state in a functional component?
a) useEffect
b) useState
c) useContext
d) useReducer
Answer: b) useState
128. Which hook is used to perform side effects in React components?
a) useEffect
b) useState
c) useRef
d) useMemo
Answer: a) useEffect
129. What is the default behavior of React components when state changes?
a) Nothing happens
b) Component re-renders
c) Page reloads
d) Only parent updates
Answer: b) Component re-renders
130. Which property of React elements must be unique among siblings in a list?
a) id
b) key
c) name
d) ref
Answer: b) key
131. Which command is used to create a new React app using Create React App?
a) create-react
b) npx create-react-app app-name
c) npm new react app-name
d) react init app-name
Answer: b) npx create-react-app app-name
132. In React, which attribute replaces "class" in HTML?
a) classname
b) css-class
c) className
d) styleClass
Answer: c) className
133. What does the useRef
hook in React return?
a) Mutable object
b) Immutable state
c) DOM tree
d) Event listener
Answer: a) Mutable object
134. Which method is used to handle events in React?
a) Inline JavaScript
b) addEvent()
c) camelCase event handlers
d) bindEvent()
Answer: c) camelCase event handlers
135. Which hook is commonly used as an alternative to Redux for managing complex state?
a) useEffect
b) useContext + useReducer
c) useMemo
d) useRef
Answer: b) useContext + useReducer
136. React uses which algorithm to update the UI efficiently?
a) Sorting
b) Diffing (Virtual DOM)
c) Recursion
d) Binary search
Answer: b) Diffing (Virtual DOM)
137. Which statement about React components is correct?
a) They must return only one root element
b) They can return multiple root elements
c) They cannot contain JSX
d) They must always use classes
Answer: a) They must return only one root element
138. React.Fragment (<> </>
) is used for:
a) Styling components
b) Wrapping multiple elements without adding extra nodes
c) Passing props
d) Handling events
Answer: b) Wrapping multiple elements without adding extra nodes
139. Which React feature allows passing data deeply without prop drilling?
a) Context API
b) Redux
c) useState
d) Reducers
Answer: a) Context API
140. Which lifecycle method is called once after the component is inserted into the DOM (in class components)?
a) componentDidMount()
b) componentWillUnmount()
c) shouldComponentUpdate()
d) render()
Answer: a) componentDidMount()
141. Which command is used to start a React app in development mode?
a) npm build
b) npm start
c) npm run prod
d) react start
Answer: b) npm start
142. What does useMemo
hook do in React?
a) Stores DOM references
b) Memoizes expensive calculations
c) Stores global state
d) Runs side effects
Answer: b) Memoizes expensive calculations
143. Which tool is often used with React for state management?
a) Lodash
b) Redux
c) Axios
d) Babel
Answer: b) Redux
144. Which library is commonly used with React for routing?
a) react-router-dom
b) express-router
c) redux-router
d) node-router
Answer: a) react-router-dom
145. In React, controlled components refer to:
a) Components that manage their own state
b) Components controlled by props and React state
c) Components controlled by the DOM
d) Components with CSS styling
Answer: b) Components controlled by props and React state
146. Which React hook is useful for persisting values across renders without causing re-renders?
a) useState
b) useRef
c) useMemo
d) useEffect
Answer: b) useRef
147. Which command creates a production build of a React app?
a) npm run build
b) npm prod
c) npm deploy
d) react build
Answer: a) npm run build
148. In React, keys help with:
a) Styling components
b) Improving performance in lists
c) Passing props
d) Handling errors
Answer: b) Improving performance in lists
149. Which hook is introduced to simplify data fetching in React 18 with Suspense?
a) useData
b) useFetch
c) useTransition
d) None (React Query handles this externally)
Answer: c) useTransition
150. Which feature of React 18 allows multiple UI updates to be batched together for efficiency?
a) Concurrent Rendering
b) Strict Mode
c) Suspense
d) Hydration
Answer: a) Concurrent Rendering