Web Application Design and Development Midterm
Which of the following statements are true about JavaScript? (Select all that apply) a. Browsers may use different JavaScript engines. b. JavaScript and Java are the same programming language. c. JavaScript programs do not need to be compiled before executing. d. JavaScript can only be executed in the browser
Both answers below are correct: a. Browsers may use different JavaScript engines. c. JavaScript programs do not need to be compiled before executing.
What is the output of the following code: let x = 30; let.y = "200"; console.log(x+y);
30200
True or False: Passwords from the password widget that are sent to the server using HTTP are safe from prying eyes
False
True or False: The <a> tag is a void/empty element, an HTML tag that does not have a closing tag.
False
True or False: The <td> opening and closing tags create a table row, which contains all the row's cells.
False
True or False: The main difference between HTTP and HTTPS is that HTTP encrypts traffic between a browser and a web server, so a network sniffer cannot intercept sensitive information, and HTTPS does not
False
True or False: the <form> tag has two primary attributes: GET and POST
False
True or false: The web browser will always create a new window for hyperlinks whose target attribute is _blank.
False
HyperText Markup Language (HTML) is a. the language used for creating web pages b. the protocol for transferring files among computers via the web c. a program for viewing web pages d. Web Document that is view in a web browser
a. the language used for creating web pages
True or False: A relative URL specifies the relative path to the web resource with no scheme or hostname
True
True or False: The "<" character normally marks the beginning of a tag, so "<" is used to display the "<" character on the page when "<" is not part of a tag
True
True or False: The <form> tag allows the web browser to submit information from the user to the server.
True
Given the following HTML and styles, select all correct answers. <head> <style> #box { position: static; right: 50px; top: 100px; } </style> <head> a. The element with the id "box" is displayed 50px from the viewport's right edge. b. The element with the id "box" is displayed 50px from the right edge of the element with id "box". c. The element with the id "box" is displayed 100px from the top edge of the element with id "box". d. The element with the id "box" is displayed 100px from the viewport's top edge. e. The element with the id "box" scrolls with the page contents
a and d are correct: a. The element with the id "box" is displayed 50px from the viewport's right edge. d. The element with the id "box" is displayed 100px from the viewport's top edge.
Within a CSS style rule, a property declaration includes a. a selector and value b. a property and a selector c. a selector and a declaration block d. a property and a value
a property and a value
The ________ is the distance between the content and its border. a. margin b. padding c. border d. float
b. padding
Select all that are truthy values. a. 'false' b. 0 c. null d. '0' e. NaN
a. 'false' d. '0'
const nums = [0, 3, 7, 8]; nums.indexOf(7) returns (a)____ nums.indexOf(1) returns (b)____
a. 2 b. -1
Which of the following hyperlinks is invalid? a. <a href="[email protected]">email me</a> b. <a href="[email protected]">email me</a> c. <a href="#History">History</a> d. <a href="course.html#Notes">Notes</a>
a. <a href="[email protected]">email me</a>
A value that provides additional information about a particular HTML tag and is included after the tag name but before the ">" a. A tag attribute b. An opening tag c. A void element d. A closing tag
a. A tag attribute
What does the following code output? let str = "Donny,Duck"; let index = str.indexOf(","); console.log(str.substring(index+1)); a. Duck b. ,Duck c. ,Duc d. Duc
a. Duck
All the elements in a JS array must be of the same type. a. False b. True
a. False
Which of the following statements about function declarations and function expressions is NOT true? a. Function declarations cannot return a value. b. The JavaScript interpreter hoists all function declarations to the top of the scope that calls them. c. Function declarations can be coded after the statements that call them. d. Function expressions must be coded before any statements that call them.
a. Function declarations cannot return a value.
In JavaScript, arrays can have other arrays as elements. a. True b. False
a. True
What is the output of the following program? const nums = [10, 20, 8, 17]; nums.filter(e => e > 10); console.log(nums); a. [10, 20, 8, 17] b. [10, 8] c. [20, 17] d. [20]
a. [10, 20, 8, 17] note: the function nums did not call the .filter() method in the console.log() method, so it never printed the updated array. So our array remains the same.
You can use a link in an HTML document to provide a. an external style sheet b. either an embedded or external style sheet c. an embedded style sheet d. neither an embedded or external style sheet
a. an external style sheet
Which of the following declaration define a 6px, dashed and red border? a. border: 6px dashed red; b. border: 6px-dashed-red; c. border: 6px, dashed, red; d. 6px; dashed; red;
a. border: 6px dashed red;
Which of the following statements is false? A JavaScript identifier a. can start with a number b. is case-sensitive c. can start with a $ sign d. can be more than 128 characters long
a. can start with a number
To position an element relative to the viewport, ie., it always stays in the same place even if the page is scrolled, its position property is set to a. fixed b. relative c. static d. absolute
a. fixed
Where in an HTML document is the correct place to refer to an external style sheet? a. in the head section b. at the bottom of the document c. at the top of the document d. in the body section
a. in the head section
Which attribute must be set to create a text box widget? a. no attribute b. type c. id d. name
a. no attribute
What is the correct CSS syntax for making all the <p> elements bold? a. p {font-weight:bold} b. p {text-size:bold} c. <p style="text-size:bold"> d. <p style="font-weight:bold">
a. p {font-weight:bold}
To move an element away from its normal position while other elements will not be adjusted to fit into any gap left by the element, the element's position is set to _______. a. relative b. fixed c. static d. absolute
a. relative
Which HTML attribute is used to define inline styles? a. style b. link c. class d. ref
a. style
URL (Uniform Resource Locator) is a. The location of a web resource on the web b. The protocol for transferring files among computers via the web c. A continually evolving HTML standard without version numbers ( to replaces HTML5) and produced by Web Hypertext Application Technology Working Group (WHATWG) d. A name for an IP address, such as the name wikipedia.org for the IP address 198.35.26.96
a. the location of a web resource on the web
Which of the following declarations set the margin all around to 2 pixels? Select all that apply a. margin: 2px; b. margin: 2px 2px 2px; c. margin: 2px 2px 2px 2px; d. margin: 2px 2px
all options are correct
Which of the following are valid identifiers in JavaScript? price! (there may be more than one answer) a. 9apples b. $item1 c. nums d. totalPoints
b. $item1 c. nums d. totalPoints
Assume the grid container has a width of 500 pixels, what would the width of the four columns be in this layout? .grid { display: grid; grid-template-columns: 50px 1fr 3fr 1fr; } a. 50px, 50px, 400px, 100px; b. 50px, 90px, 270px, 90px c. 50px, 50px, 400px, 50px; d. 50px, 100px, 300px, 50px;
b. 50px, 90px, 270px, 90px
Which tag includes a picture in a web page? a. <picture> b. <img> c. <pict> d. <image>
b. <img>
If you want the block of code in a loop to be executed at least once, you would normally use a. All loops can do this b. a do-while loop c. a for loop d. a while loop
b. A do while loop
HyperText Transfer Protocol (HTTP) is a. The language used for a text file that describes a web page b. The protocol for transferring files among computers via the web c. A program for viewing web pages d. Web document that is viewed in a web browser
b. The protocol for transferring files among computers via the web
To make a website available to other computers over a network, the website is stored on a. an application server b. a web server c. the Internet
b. a web server
Refer to the form below. <form method="POST" action="http://example.org/"><input type="text" name="item"><input type="text" name="price"><input type="submit"></form> What URL does the browser request if the user submits "oranges" and "1.99" in the text boxes? a. http://example.org/oranges=1.99 b. http://example.org/ c. http://example.org?item=oranges&price=1.99 You Answered d. http://example.org/#item=oranges&price=1.99
b. http://example.org/
Which URL links to the "Governance" section of Wikipedia's "Internet" article? a. https://en.wikipedia.org/wiki/Internet/Governance b. https://en.wikipedia.org/wiki/Internet#Governance c. https://en.wikipedia.org/wiki/Internet
b. https://en.wikipedia.org/wiki/Internet#Governance
In JavaScript, which property can be used to loop through an array? a. size b. length c. len d. Length
b. length
Which of the following is a CSS selector that will target all of anchor elements that are descendants of the nav element a. nav~a b. nav a c. nav+a d. nav > a
b. nav a
Which of the following declarations set the left padding and right padding to 4 pixels? Select all that apply a. padding: 4px; b. padding: 0px 4px 0px 4px; c. padding-left: 4px;padding-right: 4px; d. padding: 0px 4px;
b. padding: 0px 4px 0px 4px; c. padding-left: 4px;padding-right: 4px; d. padding: 0px 4px;
When you develop a web page, you should use CSS to provide a. the structure for a page b. the formatting for the page c. the structure and formatting for the page
b. the formatting for the page
If two elements are stacked on top of each other and both have margin:20px, the total margin between the two elements is ____ a. 60px b. 0px c. 20px d. 40px
c. 20px
Which tag can create a text box widget a. <textarea> b. <text> c. <input> d. <inputarea>
c. <input>
What elements would the style rule that follows apply to?.red { color: red; } a. The only element with a class named red b. The only element with an id of red c. All elements with the class named red d. All elements with an id of red
c. All elements with the class named red
To interact with a web server, the client for a web application uses programs called a. JavaScript Engines b. Internet Service Providers c. Web Browsers d. Local Area Networks
c. Web Browsers
The the 'z-index' CSS property can be set to a. any real numbers b. percentages c. any integers d. keywords such as top and bottom
c. any integers
How to access the third element of the array arr = [3, 5, 10, 20]? a. arr.indexOf(1) b. arr.indexOf(2) c. arr[2] d. arr[1]
c. arr[2]
With the following CSS styles, where will the element with id "box" located to its default location #box { position: static; left: 10px; bottom: 20px; } a. 10px to the left and 20px higher b. 10px to the right and 20px lower c. at its default location d. 10px to the right and 20px higher e. 10px to the left and 20px lower
c. at its default location
What types of elements can be inside a block element? a. only block elements b. only inline elements c. both inline and block elements d. none of these elements
c. both inline and block elements
The class attribute a. determines the priority level of an HTML element b. can be applied to only one element in an HTML document c. can be used by CSS to apply the same formatting to more than one HTML element d. determines the text that will be displayed when the mouse hovers over an element
c. can be used by CSS to apply the same formatting to more than one HTML element
Which of the following statement will print "JavaScript is awesome" in the console? a. print('JavaScript is awesome'); b. console.print('JavaScript is awesome'); c. console.log('JavaScript is awesome'); d. log.console('JavaScript is awesome');
c. console.log('JavaScript is awesome');
Select all statements that output true in the terminal. a. console.log(10 === '10'); b. console.log(true === 1); c. console.log(10 == '10'); d. console.log(false === 0); e. console.log(false == 0); f. console.log(true == 1); g. console.log(false == '0');
c. console.log(10 == '10'); e. console.log(false == 0); f. console.log(true == 1); g. console.log(false == '0');
What is the output of the following program? const nums = [30, 35, 42, 20, 15]; console.log(nums.every(num => num > 20)); a. true b. [30, 35, 42, 20, 15] c. false d. [30, 35, 42]
c. false
Which attribute inside the <label> tag is used to associate the label with a widget? a. id b. name c. for
c. for
Refer to the form below. <form method="GET" action="http://example.org/"><input type="text" name="item"><input type="text" name="price"><input type="submit"></form> What URL does the browser request if the user submits "bananas" and "2.50" in the text boxes? a. http://example.org/#item=bananas&price=2.50 b. http://example.org/item=bananas&price=2.50 c. http://example.org?item=bananas&price=2.50 d. http://example.org/
c. http://example.org?item=bananas&price=2.50
Which attribute uniquely identifies an HTML element? a. class b. for c. id d. name
c. id
Given the array const letters = ["a", "b", "c"], which of the following statement makes letters to be["a", "d", "b", "c"]? a. letters.splice(1, 1, 'd'); b. letters.unshift('d') c. letters.splice(1, 0, 'd'); d. letters.push('d')
c. letters.splice(1, 0, 'd');
An HTTP response is sent from a. the application server to the web server b. the client to the web server c. the web server to the client d. the web server to the application server
c. the web server to the client
Select the code below that configures a class called "offer" with blue text using CSS. a. .offer { text: blue; } b. offer { color: blue; } c. #offer { color: blue; } d. .offer { color: blue; }
d. .offer { color: blue; }
With the following CSS styles, where will the element with id "box" located to its default location #box { position: relative; left: 10px; bottom: 20px; } a. 10px to the left and 20px higher b. 10px to the right and 20px lower c. at its default location d. 10px to the right and 20px higher e. 10px to the left and 20px lower
d. 10px to the right and 20px higher
The _______ pseudo-class configures the styles that will apply when the mouse is placed on a hyperlink. a. :link b. :visited c. :active d. :hover
d. :hover
How does HTML use the external style sheet "mystyle.css"? a. <stylesheet>mystyle.css</stylesheet > b. <style >mystyle.css</style> c. <style src="mystyle.css"> d. <link rel="stylesheet" href="mystyle.css">
d. <link rel="stylesheet" href="mystyle.css">
Which of the following has the correct CSS syntax? a. body: color = black b. {body:color=black(body} d. body {color: black} e. {body;color:black}
d. body {color: black}
The ________ property specifies the distance from other page elements. a. border b. padding c. float d. margin
d. margin
What types of elements can be inside an inline element? a. none of these b. only block elements c. both inline and block elements d. only inline elements
d. only inline elements
Multiple CSS rule declarations in style sheets are separated by a _______________. a. colon b. comma c. space d. semicolon
d. semicolon
Which image tag attribute specifies the image's URL? a. alt b. url c. href d. src
d. src
The default value of the position property is _________. a. absolute b. fixed c. relative d. static
d. static
What is the width of a block element? a. none of these answers b. the minimum width necessary to hold the block's contents c. the full width of the web page d. the full width of the block's parent container
d. the full width of the block's parent container
The _______ CSS property sets whether an element is treated as a block or inline box and the layout used for its children
display
What does the following hyperlink do? <a href="https://example.com/index.html">See example</a> a. Opens a file from the user's computer b. Loads a web page over an unencrypted connection c. Sends an email d. Downloads a file e. Loads a web page over an encrypted connection
e. Loads a web page over an encrypted connection
Which of the following items below can be used as a CSS selector? a. an HTML element b. a class name c. an HTML attribute d. an id value e. all of the above
e. all of the above