NODE JS & REST API - QB
Module 1: [Link] and Express Framework
1. [Link] is built on which JavaScript engine?
A. SpiderMonkey
B. Chakra
C. V8
D. Nashorn
✅ Answer: C. V8
2. What is the purpose of the npm command?
A. Network Performance Monitor
B. Node Package Manager
C. Node Project Manager
D. Node Plugin Manager
✅ Answer: B. Node Package Manager
3. Which module in [Link] is used to create a web server?
A. express
B. http
C. fs
D. path
✅ Answer: B. http
4. Which function is used to import external modules in [Link]?
A. include()
B. import()
C. require()
D. load()
✅ Answer: C. require()
5. The [Link] framework is primarily used for:
A. File system management
B. Building web applications and APIs
C. Database connectivity
D. UI rendering
✅ Answer: B. Building web applications and APIs
6. What does middleware in [Link] do?
A. Handles requests and responses between client and server
B. Connects to databases
C. Stores user sessions
D. Handles frontend routing
✅ Answer: A. Handles requests and responses between client and server
7. Which command initializes a new [Link] project?
A. npm create project
B. npm start
C. npm init
D. node install
✅ Answer: C. npm init
8. How can you send a response to the client in Express?
A. [Link]()
B. [Link]()
C. [Link]()
D. [Link]()
✅ Answer: C. [Link]()
9. Which module is used to send emails from [Link]?
A. mailer
B. nodemailer
C. postman
D. smtp-node
✅ Answer: B. nodemailer
10. What is JWT used for in [Link] applications?
A. File compression
B. Session and user authentication
C. Code debugging
D. Server management
✅ Answer: B. Session and user authentication
11. Which statement best describes asynchronous programming in [Link]?
A. Tasks execute sequentially
B. Tasks block execution until completed
C. Tasks run independently using callbacks or promises
D. Tasks execute only after compilation
✅ Answer: C. Tasks run independently using callbacks or promises
12. Which method in Express handles GET requests?
A. [Link]()
B. [Link]()
C. [Link]()
D. [Link]()
✅ Answer: C. [Link]()
Module 2: React Basics and Component Architecture
13. React is mainly used for:
A. Server-side rendering
B. Building dynamic user interfaces
C. File management
D. REST API design
✅ Answer: B. Building dynamic user interfaces
14. JSX stands for:
A. JavaScript XML
B. Java Syntax Extension
C. Java Simple Exchange
D. JavaScript Execution
✅ Answer: A. JavaScript XML
15. What is the smallest building block of a React app?
A. State
B. Component
C. Module
D. Controller
✅ Answer: B. Component
16. Props in React are:
A. Mutable data
B. Static HTML
C. Immutable inputs to components
D. Functions to modify state
✅ Answer: C. Immutable inputs to components
17. Which hook is used for side effects in React?
A. useMemo
B. useEffect
C. useCallback
D. useReducer
✅ Answer: B. useEffect
18. State in React is used to:
A. Store component-specific data
B. Manage backend sessions
C. Configure routing
D. Style components
✅ Answer: A. Store component-specific data
19. Which React lifecycle method is used to initialize state?
A. render()
B. componentDidMount()
C. constructor()
D. shouldComponentUpdate()
✅ Answer: C. constructor()
20. Conditional rendering in React means:
A. Rendering based on certain conditions
B. Rendering only static content
C. Disabling user input
D. Preventing re-render
✅ Answer: A. Rendering based on certain conditions
21. The Virtual DOM in React helps to:
A. Directly modify HTML files
B. Optimize performance by updating only changed elements
C. Store CSS
D. Handle server logic
✅ Answer: B. Optimize performance by updating only changed elements
22. Which keyword is used to export a component in React?
A. export
B. module
C. release
D. share
✅ Answer: A. export
23. What is the purpose of memoization in React?
A. Storing user credentials
B. Preventing unnecessary re-renders
C. Saving CSS
D. Managing routes
✅ Answer: B. Preventing unnecessary re-renders
24. React components that handle only presentation and no logic are called:
A. Stateful components
B. Presentational components
C. Logical components
D. Context components
✅ Answer: B. Presentational components
Module 3: React State Management and Routing
25. Context API in React is used for:
A. API communication
B. Global state management
C. Handling animations
D. Configuring routers
✅ Answer: B. Global state management
26. Which hook provides access to context values?
A. useContext
B. useState
C. useMemo
D. useEffect
✅ Answer: A. useContext
27. React Router is used for:
A. Navigating between different components
B. Managing APIs
C. Designing CSS
D. Fetching data
✅ Answer: A. Navigating between different components
28. The useReducer hook is mainly used for:
A. Complex state logic management
B. CSS transitions
C. File uploads
D. Rendering static pages
✅ Answer: A. Complex state logic management
29. Which React Router component is used to define routes?
A. <Route>
B. <Link>
C. <RouterView>
D. <Path>
✅ Answer: A. <Route>
30. The useNavigate hook in React Router is used to:
A. Navigate programmatically between pages
B. Create components
C. Store API data
D. Load CSS files
✅ Answer: A. Navigate programmatically between pages
31. Custom hooks in React are defined using:
A. The use prefix before the function name
B. The createHook keyword
C. new Hook() constructor
D. React module
✅ Answer: A. The use prefix before the function name
32. Which hook allows reusing logic across multiple components?
A. useEffect
B. Custom Hook
C. useCallback
D. useMemo
✅ Answer: B. Custom Hook
33. Which method helps in styling React components?
A. Inline styles or CSS Modules
B. Using JSON files
C. Using JSX only
D. Using XML
✅ Answer: A. Inline styles or CSS Modules
34. The <Link> component in React Router is used to:
A. Navigate without reloading the page
B. Load external CSS
C. Fetch data
D. Manage login sessions
✅ Answer: A. Navigate without reloading the page
35. The useEffect hook’s dependency array controls:
A. When the side effect runs
B. Component mounting
C. Error handling
D. Memory management
✅ Answer: A. When the side effect runs
36. React Context API replaces:
A. Prop drilling
B. Redux always
C. HTML rendering
D. DOM manipulation
✅ Answer: A. Prop drilling
Module 4: RESTful APIs with NodeJS, Express, and
MongoDB
37. REST stands for:
A. Representational State Transfer
B. Remote Execution State Transfer
C. Request Service Transfer
D. Resource State Transaction
✅ Answer: A. Representational State Transfer
38. Which HTTP method is used to retrieve data?
A. POST
B. GET
C. PUT
D. DELETE
✅ Answer: B. GET
39. CRUD stands for:
A. Create, Read, Update, Delete
B. Connect, Replace, Update, Deploy
C. Create, Run, Upload, Delete
D. Connect, Read, Undo, Delete
✅ Answer: A. Create, Read, Update, Delete
40. Which database is commonly used with [Link] in REST APIs?
A. Oracle
B. MongoDB
C. MySQL
D. PostgreSQL
✅ Answer: B. MongoDB
41. What is Mongoose in [Link]?
A. ORM/ODM for MongoDB
B. Web server
C. Data encryption tool
D. UI library
✅ Answer: A. ORM/ODM for MongoDB
42. Which tool is commonly used to test REST APIs?
A. Postman
B. GitHub
C. npm
D. Jenkins
✅ Answer: A. Postman
43. Express middleware function signature includes:
A. (req, res, next)
B. (request, response)
C. (request)
D. (res, req)
✅ Answer: A. (req, res, next)
44. Which status code indicates a successful API response?
A. 200
B. 404
C. 500
D. 401
✅ Answer: A. 200
45. What does 404 status code mean?
A. Bad Request
B. Not Found
C. Forbidden
D. Created
✅ Answer: B. Not Found
46. Which command installs Mongoose?
A. npm install mongo
B. npm install mongoose
C. npm get mongoose
D. node install db
✅ Answer: B. npm install mongoose
47. What does middleware like body-parser do?
A. Parses incoming request bodies
B. Handles cookies
C. Manages routes
D. Encrypts passwords
✅ Answer: A. Parses incoming request bodies
48. The purpose of JWT in RESTful APIs is:
A. Secure authentication and authorization
B. Data backup
C. Database creation
D. Route configuration
✅ Answer: A. Secure authentication and authorization
Module 5: Full Stack Project and Web Services using
Java
49. JAXB in Java stands for:
A. Java Architecture for XML Binding
B. Java API for Binary Linking
C. Java Application Base Library
D. Java Array Binding Layer
✅ Answer: A. Java Architecture for XML Binding
50. Which method in REST corresponds to data creation?
A. GET
B. POST
C. PUT
D. DELETE
✅ Answer: B. POST
51. What does SOAP stand for?
A. Simple Object Access Protocol
B. Server Oriented Application Protocol
C. System Object API Process
D. Secure Object Access Policy
✅ Answer: A. Simple Object Access Protocol
52. Which format is typically used for REST API data?
A. XML or JSON
B. CSV
C. HTML
D. TXT
✅ Answer: A. XML or JSON
53. WSDL is associated with:
A. SOAP Web Services
B. REST APIs
C. React Components
D. Node Modules
✅ Answer: A. SOAP Web Services
54. UDDI stands for:
A. Universal Description, Discovery and Integration
B. Unified Data Delivery Interface
C. User Defined Data Integration
D. Universal Data Design Interface
✅ Answer: A. Universal Description, Discovery and Integration
55. In REST API, status code 201 indicates:
A. Bad Request
B. Created
C. Unauthorized
D. Internal Error
✅ Answer: B. Created
56. What is the role of JAXB in RESTful integration?
A. Converts Java objects to XML and vice versa
B. Manages database connections
C. Sends HTTP requests
D. Handles authentication
✅ Answer: A. Converts Java objects to XML and vice versa
57. Which Java package is used for RESTful web services?
A. [Link]
B. [Link]
C. [Link]
D. [Link]
✅ Answer: A. [Link]
58. The HTTP method PUT is used for:
A. Updating existing data
B. Retrieving data
C. Deleting resources
D. Creating new records
✅ Answer: A. Updating existing data
59. Which REST API feature ensures stateless communication?
A. Each request contains complete information
B. Server stores session data
C. Client keeps state on the server
D. Session caching is mandatory
✅ Answer: A. Each request contains complete information
60. Which Java class handles REST client calls in JAXB integration?
A. ClientBuilder
B. WebClient
C. RestCaller
D. APIConnector
✅ Answer: A. ClientBuilder