csci 4300 web programming
Which of the following is a valid selector for a class named menu? Question options: menu #menu .menu class.menu
.menu
How many servers (ie. different machines serving and executing some code) are typically involved in a MERN stack app? Question options: 1 server which serves React, Node/Express and the MongoDB database. 2 servers: One for the react.js and one for Node/Express + MongoDB. 3 servers: One for the React.js app, one for the Node/Express API and one for the MongoDB database. no servers
3 servers: One for the React.js app, one for the Node/Express API and one for the MongoDB database.
html specifies _______ levels of headings Question options: 4 5 6 as many as you specify
6
How do you add comments in HTML? Question options: /* */ // <! !> <!-- -->
<!-- -->
What are the basic building blocks of an HTML document? Question options: <!DOCTYPE html><html><head><body> <html><style><content> <script><heading><body> <html><head><body><footer>
<!DOCTYPE html><html><head><body>
html tags used to create sections of the page <sec></sec> <div></div <part></part> <box></box>
<div></div
How do you create an ordered list and an unordered list in HTML? Question options: <ol><li></li><li></li>...</ol><ul><li></li><li></li>.../ul> <olist><li></li><li></li>...</olist><ulist><li></li><li></li>.../ulist> <oli></oli><oli></oli><oli></oli><uli></uli><uli></uli><uli></uli> <li atr="ordered"></li><li atr="unordered"></li>
<ol><li></li><li></li>...</ol><ul><li></li><li></li>.../ul>
What is the output to the console of this javaScript? ==CON START==starting promiseAsunpromiseA is donestarting promiseBfunpromiseB is done ==CON START==starting promiseApromiseA is donestarting promiseBpromiseB is donesunfun ==CON START==starting promiseApromiseA is donesunstarting promiseBpromiseB is donefun ==CON START==starting promiseAstarting promiseBpromiseB is donepromiseA is donesunfun
==CON START==starting promiseAstarting promiseBpromiseB is donepromiseA is donesunfun
What is Node.js? Question options: A JavaScript runtime that allows you to execute JS outside of a browser. A framework for Express.js which in turn is a JavaScript runtime. A programming language that allows you to directly interact with databases. A frontend development environment for rendering component interfaces.
A JavaScript runtime that allows you to execute JS outside of a browser.
What is Express.js? Question options: A JavaScript runtime that allows you to execute JS code outside of a browser. A framework for React.js. A framework for Node.js A templating engine for frontend development.
A framework for Node.js
What elements would the style rule that follows apply to? .red { color: red; } Question options: The only element with an id of red All elements with an id of red The only element with a class named red All elements with the class named red
All elements with the class named red
How can we know if this variable is an array?const names = ["Dee", "Ron", "Ben", "Batman"] Question options: typeof names names.isArray() Array.isArray(names) typeof names[]
Array.isArray(names)
What is the root node of the DOM? Question options: Root Init Document H1
Document
What does this code do? router.post('/', (req,res) => { Item.find() .then((item) => res.json(items)) .catch((err) => res.status(404).json({noitemsfound: 'No items found'})); }); Question options: Responds to all requests on the root route. Posts new items on the root route Establishes a server endpoint for retrieval of a specific item Establishes a server endpoint for retrieval of a list of items
Establishes a server endpoint for retrieval of a list of items
What does the following code accomplish? router.post('/', (req,res) => { Item.create(req.body) .then((item) => res.json({ msg: 'item message'})) .catch((err) => res.status(400).json({error: 'Error'})); }); Question options: Establishes a server endpoint to handle post request and add a new item to the database. Makes a post request to the server to send a message body. Makes a post request at the user route to receive a message body. Creates a post request to send a json message to the client.
Establishes a server endpoint to handle post request and add a new item to the database.
What does this code accomplish? router.get('/home', (req,res) => { res.send('Hello,this is home router'); }); Question options: Creates a client-side home route. Gets a message from the database and sends to server. Establishes an endpoint at /home to accept new data on the server. Establishes an endpoint at /home to respond with a message from the server.
Establishes an endpoint at /home to respond with a message from the server.
We retrieve items with an Http ________ request. Question options: POST GET RESP RET
GET
Which form method attribute sends data along with the page URL. Question options: GET PUT POST SEND
GET
What is meant by a Higher Order function in JavaScript? Question options: Higher Order functions are used as callback functions. Higher Order functions take functions as parameters. Higher Order functions have unrestricted scope. Higher Order functions are templates for creating functions.
Higher Order functions take functions as parameters.
an open standard file format written in key/value pairs of human-readable text to store and transmit data on the web. Question options: key-store JSON JWT express
JSON
How does JavaScript handle data types? Question options: JavaScript is strictly typed JavaScript is dynamically typed JavaScript is strongly typed JavaScript has only primitive types
JavaScript is dynamically typed
app.listen(5000, () => { console.log("What does this callback do?") }) What does this code do? Question options: Listens to pending requests on the database for 5000 ms. Listens for requests in the UI (frontend) on port 5000. Listens for requests on the backend (server) on port 5000. Listens for user input to the app and invokes the event handler.
Listens for requests on the backend (server) on port 5000.
The following css: .special { color: green; margin: 0 0 0 12px; } Makes all paragraphs green with 12px margin bottom Makes paragraphs green with an optional 12px margin. Makes class special elements green with 12px left margin. Makes id special elements green with 12 px margin bottom
Makes class special elements green with 12px left margin.
Which are true about NoSQL databases? Question options: MongoDB is an example Enforces a strict data schema Less focused on relations than SQL Relations are a core feature Great for shopping carts Great for messages Composed of independent documents
MongoDB is an example Less focused on relations than SQL Great for messages Composed of independent documents
Which part of the MERN app is the "Backend"? Question options: Node / Express, in combination with MongoDB forms the backend. React.js / Node form the backend. The user of our app is the frontend, all MERN parts are the backend. The React.js part is the backend of the application
Node / Express, in combination with MongoDB forms the backend.
How often do you run your server-side script with Node.js when you want to start a server and handle incoming requests? Question options: Once for every request. Once for every request and every response. Once to start the server, register middleware, and begin listening for requests . Once for every user.
Once to start the server, register middleware, and begin listening for requests .
Which form method attribute transfers information in the request body: Question options: GET PUT POST SEND
POST
What does this function return? async function helloWorld () { some code ... } Question options: async await Promise nothing
Promise
Website colors can be specified in ______ format as a 6 digit ______ number
RGB hex
What is being tested in this image? GET /items/ Question options: Retrieval of a specific item from the database Retrieval of all items from the database Creation of a new item in the database Updating of an item in the database
Retrieval of all items from the database
What is HTML and what is its role in web development? Question options: A high-level programming language interpreted by a browser. The standard markup language used for creating web pages and web applications. Html is a client-side markup language processed by the web browser. An object-oriented language to be compiled with an html compiler.
The standard markup language used for creating web pages and web applications. Html is a client-side markup language processed by the web browser.
JavaScript is single threaded. Question options: True False
True
The HTML5 semantic elements are used to define different parts of a web page by their use. Question options: True False
True
When you use an external style sheet with an HTML document, you get all but one of the benefits that follow. Which one is it? Your CSS coding is simpler You separate the CSS code from the HTML code You provide consistent styling for all of the pages that use the style sheet You can modify the styling for all of the related pages by changing one style sheet
Your CSS coding is simpler
What is the result of the following: let array1 = ['h', 'e', 'y']; let array2 = [...array1]; console.log(array2); Question options: [...] array1 [ 'h', 'e', 'y' ] [ 'y', 'e', 'h' ]
[ 'h', 'e', 'y' ]
The CSS Box Model consists of the following elements in (inside-out) order: padding margin border content
__2__padding __4__margin __3__border __1__content
The size of JavaScript arrays Question options: can be empty is constant and cannot be changed once declared can be changed dynamically a and b a and c
a and c
Which is a valid arrow syntax for the following function:function myfn (a) {return a * a;} Question options: (a) => { return a * a; } (a) => a * a; a => a * a; a and b a, b and c none are valid
a, b and c
Which of the following are valid JavaScript arrays: Question options: const years = [1855, 1648, 1420]; const days = ["Monday", "Tuesday", "Wednesday"] const mix = [1855, "1855", 1648, "1648"] const mess = [1420, "Monday", 1648, false] a and b a, b and c a, b, c and d
a, b, c and d
Full addresses to the destination page/link. Question options: absolute URL relative URL destination URL sync path
absolute URL
This attribute specifies the action to be performed after a form is submitted. Question options: action method task source
action
The JavaScript output that requires user interaction: Question options: alert write console.log document.write
alert
In HTML, a numbered list is coded with a ul element that contains li elements an ol element that contains li elements an li element that contains ul elements an li element that contains ol elements
an ol element that contains li elements
How do you create hyperlinks in HTML? Question options: anchor tag hyper tag link tag underline tag
anchor tag
html tags Question options: are always found in pairs are enclosed in <> are used to define or label the key elements of a web page are usually found in pairs
are enclosed in <> are used to define or label the key elements of a web page are usually found in pairs
Node.js uses a ____________ architecture. (Check all that apply.) Question options: nonblocking blocking synchronous asynchronous single-thread multle-threaded
asynchronous single-thread nonblocking
part of the html tag used to specify additional style or information about the html tag, Question options: sources attributes meta items
attributes
Which type of element is displayed on a new line? Question options: all types inline block semantic
block
___________ level elements always start on a new line with some space before and after the element, always takes up the full width available. Question options: outline inline block semantic
block
The HTML element that contains content displayed in the browser: Question options: section element body element main element div element
body element
Which CSS snippet would set the border radius for a div element as shown in this screenshot? Question options: border-radius: 20px; border-radius: 0 20px 10px; border-radius: 30px 10px 20px 10px; border-radius: 10px 100px;
border-radius: 10px 100px;
JavaScript is read and interpreted by Question options: the JavaScript compiler browsers java runtime environment script editors
browsers
How do you implement asynchronous coding in JavaScript? Question options: callbacks and promises promises and async / await props and state callbacks, promises, and async / await
callbacks, promises, and async / await
In CSS which selectors allow you to target multiple elements on the page? ids classes RFDs properties
classes
___________ in MongoDB are equivalent to tables in a relational database. Question options: collections tablets structs objects
collections
let numbers = [4,5,3,2,7,8,9,0] How do you select all the numbers less than or equal to 3? Question options: const ans = numbers.map(n <= 3) const ans = numbers.map(n => n <= 3) const ans = numbers.filter(n <= 3) const ans = numbers.filter(n => n <= 3)
const ans = numbers.filter(n => n <= 3)
const prices = [45, 90, 20] How do we add a $5.4 charge on every price to produce a new array like [50.4, 95.4, 25.4] Question options: const newArray = prices.map(p=> p + 5.4) const newArray = prices.map(prices[] + 5.4) const newArray = prices.filter(p=> p + 5.4) const newArray = prices.reduce(price + 5.4);
const newArray = prices.map(p=> p + 5.4)
The Mongoose _______ method adds a new item in the database. Question options: store write create sync
create
The following <a> element <a href="update.html">Update</a> displays "Update" as a link to update.html displays "update.html" as an attribute of Update displays "update" as plain text displays "update.html" as plain text
displays "Update" as a link to update.html
Which method will look through the document and return an element with id myId. Question options: get_element.id(myId); id = myId;get_element_id(id); document.getElementById("myId"); document.get(id:myId);
document.getElementById("myId");
Inline elements: Question options: always starts on a new line does not start on a new line takes the full width of the container takes the full width of the page only takes up as much width to hold the element
does not start on a new line only takes up as much width to hold the element
A web page is made up of multiple html ________. Question options: elements contracts phases sections
elements
The JavaScript runtime model in which the browser handles tasks in the background before being put on the call stack: Question options: worker threads event loop keyframes synchronous events
event loop
Which positioning would you use to keep an element from scrolling off the page?
fixed
Which CSS layout method is best suited to achieve this layout?
flex
Used to collect data from users on a webpage: Question options: entry input_el drop_box form
form
Which css grid property establishes a 3 equal column layout? columns: .33 .33 .33 row: 3 3 3 grid-template-columns: 1fr 1fr 1fr child: 1em 1em 1em
grid-template-columns: 1fr 1fr 1fr
What attribute is used to specify the link address in an anchor tag? Question options: attr addr href src
href
Which of the following are css selectors? element class tag id
id element class
_______ elements do not start on a new line. They only take up as much width as necessary. Question options: outline inline block semantic
inline
The ______ keyword allows you to declare variables that are limited in scope to a block or expression. The ______ keyword declares a variable globally or to an entire function.
let var
Which of the following CSS selects all links that are nested inside a list item? ul .a {...} a:hover ul.li {...} a:link list-item {...} li a {....}
li a {....}
To horizontally center block elements use: padding-left-right: auto padding: auto margin: 0 auto block: center
margin: 0 auto
Allow us to modify styling and layout based on screen width: media queries device queries media selector view selector
media queries
allow us to modify our styles depending on parameters like width of the window or device type. view options media queries classes selectors
media queries
constructors that take a schema and create an instance of a database document. Question options: model query key mapper
model
A JavaScript runtime that executes code outside of the browser. Question options: node.js code assist jsRun codelens
node.js
All elements within an HTML document are: Question options: nodes tags attributes types
nodes
Mongoose is a(n) ______________ which maps the documents from a database into JavaScript objects. Question options: client framework responsive web framework object data mapper / object document mapper asynchronous javascript method
object data mapper / object document mapper
JavaScript functions are ____________. Question options: objects classes primitives constructors
objects
Which of the following are block elements? links images paragraphs headers lists
paragraphs headers lists
Which of the following are states of a Promise object? Question options: sent success pending fetch fulfilled rejected
pending fulfilled rejected
When async is placed before a function, it always returns a ____________ Question options: javascript object promise function hook
promise
a link address described as a relation to the present directory Question options: absolute URL relative URL destination URL sync path
relative URL
With express, we have access to two object parameters, _________ and _________ . Question options: request and response get and put get and post send and receive
request and response
What are two possible outcomes of a promise? Question options: accept or deny sync or async resolve or reject block or nonblock
resolve or reject
A web design approach that creates dynamic changes to the apprearance of a website based on the screen size of the device used to view it. Question options: search engine optimization cross-browser compatibility user accessibility responsive web design
responsive web design
When a browser makes a request for a static web page, the web server Question options: returns the HTML for the page and the browser renders it renders the HTML for the page and returns it to the browser generates the HTML for the page and returns it to the browser finds the HTML for the page and renders it
returns the HTML for the page and the browser renders it
Express is a popular node.js module that lets you parse incoming requests and match those requests to particular ________ or URLs. Question options: paths routes threads nodes
routes
The endpoints of a server that determine the way an application responds to a client request. Question options: components nodes routes paths
routes
With Mongoose, each _______ is the blueprint of the document that we want to store. Question options: structs schema arrays tables
schema
Because applications like Google and Bing rank the pages of a website, a web developer needs to be concerned with Question options: search engine optimization cross-browser compatibility user accessibility responsive web design
search engine optimization
What is the purpose of the alt attribute in the img tag? Question options: specify an alternate address for accessing the image specify an alternate image if the image is not found specify an alternate path to the image specify an alternate text for an image that is required for screen readers
specify an alternate text for an image that is required for screen readers
What attribute can set an html link to open in a new window vs the same window. Question options: target attr src href
target
How do you chain subsequent methods using promises? Question options: async await then resolve
then
What is this testing? PUT Question options: updating an item in the database creating a new item in the database returning a list of items from the database reading a specific item from the database
updating an item in the database