Font size
WorksheetsJavaScript and CSS Quiz
Total questions: 107
Worksheet time: 54mins
What is used to insert at the [MISSING] to change the display property of the p tag to "block"
nothing
p
this
object
What of the following code do you choose to insert at [MISSING CODE] to check device width is 400px or larger?
min-device-width: 400px
min-width: 400px
device-width: 400px
max-device-width: 400px
What statement do you insert the 3rd line to get a list of images in the document?
var list=document.getElementById("abc")
var list=document.getElementsByTagName("image")
var list=document.getElementsByTagName("img")
What is the correct JavaScript syntax to the 2nd paragraph display inline?
document.getElementsByTagName("p")[1].style.display="inline";
document.getElementsByTagName("p")[2].style.display="inline";
document.getElementsByName("p")[1].style.display="inline";
document.getElementsByName("p")[2].style.display="inline";
What of the following code do you choose to insert at [MISSING CODE] to check the media feature that is the orientation of the viewport (landscape or portrait mode)?
orientation
printation
ratio
direction
What of the following code do you choose to insert at [MISSING CODE] to check device width is 768px or smaller?
min-device-width: 768px
min-width: 768px
device-width: 768px
max-device-width: 768px
What statement do you use to change the style property of a tag with id="demo"?
document.getElementById("demo").style-newvalue
"demo" style=newvalue
style=newvalue
None of the others
What statement do you insert the 3rd code line to get a list of images in p tag?
var list="abc".getElementsByTagName("img")
var list=document.getElementById("abc").getElementsByTagName("img")
var list=document.getElementById("abc").getElementsByClassName("img")
var list=document.getElementById("abc").getElementsByName("img")
What validation error will this code produce?
Start tag seen without seeing a doctype first. Expected e.g!DOCTYPE html>.
No p element in scope but a p end tag seen.
No error
What of the following code do you choose to insert at [MISSING CODE] to check the media type is used for computer screens, tablets, smart-phones, etc. with its width from 768px and up?
screen
all
mobile
What is wrong with the following code?
<a href="picture.jpg">My dog</a> chews socks.
The link in the href must have a full URL
The alt text attributes is missing from the tag
You can not have text after the closing </a> tag.
D. This code is semantically and syntactically correct
What statement do you insert the 4th line to create an image in div tag?
document.write("<img src ="image.jpg">";)
tag.innerHTML="<img src ="image.jpg">";
tag.appendChild("");
D. tag.appendChild("");
What is returned when the method myFunction called?
true
-1
7
0
What statement is the right to append obj object to tag object in the 3rd line?
1.var obj=document.createElement("img")
2.var tag=document.getElementById("demo")
tag.innerHTML=obj
tag.value=obj
tag.text=obj
tag.appendChild(obj)
What of the following code do you choose to insert at [MISSING CODE] to check the media feature that is the orientation of the viewport (landscape or portrait mode)?
@media only screen and ([MISSING CODE]) { body { background-image: url('img_flowers.jpg');}
orientation
printation
ratio
direction
What unit is used to fix the size of an element (it will appear exactly this size)?
Vmax
Vmin
%
mm
What grid classes that cross the page are in the Bootstrap 3 Grid System?
sm
xs
md
Lg
All of the others
What is the correct HTML for creating a hyperlink?
What unit is used to specify the font size that relative to 1% of viewport's smaller dimension?
Rem
Vmin
%
Px
What validation error will this code produce?
Element head is missing a required instance of child element title.
End of file seen when expecting text or an end tag.
No error.
What statement do you insert the 3rd line to invisible an image?
obj.opacity=0;
obj.visibility=0;
obj.style.display="none";
obj.style.visibility="visible";
What is the value of the variable n?
6
5
7
null
What is the correct JavaScript syntax to change the content of the HTML element below?
document.getElementById("demo").innerHTML = "Hello World!";
#demo.innerHTML = "Hello World!";
document.getElement(
document.getElementById("demo").innerHTML = "Hello World!";
content of the HTML element below?
document.getElementById("demo").innerHTML = "Hello World!";
#demo.innerHTML = "Hello World!";
document.getElement("p").innerHTML = "Hello World!";
document.getElementByName("p").innerHTML = "Hello World!";
What is the width of the left border?
9px
5px
3px
10px
What is wrong with this code? var name = "Mike"; "Colleen" = name,
It is illegal to change the value stored in a variable.
This code is illegal and it doesn't make sense to have a non-variable (also called a constant) in the left-hand side (LHS) of an assignment statement.
The variable declaration is illegal.
What output is right of above function?
To change the src property of the image with id="demo"
To change the src property of the image
To change the src property of the image that holds the event
None of the others
What statement do you choose to append
new tag in body element?
document.body.innerHTML(document.createElement("p"))
document.body.appendChild(document.getElementById("demo"))
document.body.appendChild(document.createElement("p"))
None of the others
What is a right statement?
Syntax error
retrieves the text of an
element and copies it into a
element
retrieves the text of an
element and copies it into a
element
None of the others
Which method to choose the total width of the div tag is 200px?
box-sizing: content-box
box-sizing: border-box
box-sizing: Inherited
What is the output of the above code?
Syntax error
Banana Orange Apple Mango undefined undefined Lemon
Banana Orange Apple Mango Lemon
Banana Orange Apple Mango Inull
Which of the following code segments will keep people from being able to zoom in or out on
A.
It is impossible to lock the zoom ability
All of the others
Which HTML attribute is used to define inline CSS styles?
CSS
style
type
id
What is the correct HTML for referring to an external style sheet stored in a subfolder called css?
Which property is used to specify typefaces?
font-family
font-name
font-face
font-type
Which of the following is an example of a top-level domain?
.com
umich.edu
wikipedia.org
Which of the following is the relative unit that is relative to the font-size of the root element?
pc
px
mm
rem
Which is the correct file extension for a web page?
html
java
js
.cpp
Which HTML tag is used to define an internal style sheet?
Which of the following code using Bootstrap 3 to set up two columns of the page in an sm viewport with 4 columns wide and 8 columns wide?
col-sm-4 and col-sm-8
col-lg-4 and col-sm-8
col-sm-4 and col-md-8
col-md-4 and col-lg-8
Which of the following is not a valid variable name?
variable-2
variable$2
variable_2
Which fluid measurement type returns a percentage of the viewport height?
vh
vw
hv
Wv
Which of the following code is the correct way to link to an email address?
Which of the following is the proper syntax for a pseudo-class?
pseudo-class { } property value;
selector->pseudo-class { property.value; }
selector pseudo-class ( property value; }
selector pseudo-class ( property.value; }
Which of the following is used to represent Visited hyperlink?
visited
clicked
focus
:link
Which of the following code segments will keep people from being able to zoom in or out on your content?
It is impossible to lock the zoom ability
D. All of the others
Which of the following would be used to create class called button which has a width of 750px, a height of 30px and the color of the text is black?
#button {height: 30px; width: 750px; text: black; }
.button { height: 30px; width: 750px; color: black; }
.button { height: 30px; width: 750px; text: black; }
Which code will properly insert headings along each row?
Which method to choose the total width of the div tag is 200px?
box-sizing: content-box
box-sizing: border-box
box-sizing: Inherited
Which of the following code segments will keep people from being able to zoom in or out on your content?
It is impossible to lock the zoom ability
All of the others
Which class adds zebra-stripes to a table?
table-bordered
table-striped
even and odd
table-zebra
Which tag is used to create a link?
<link>
<a>
<anchor>
<hyper>
Which measurement is easier and comfortable for the designer/developer to use when coding?
em
rem
px
%
Which class provides a responsive fixed width container?
.container-fluid
container
.container-fixed
All of the others
Which of the following is the best example of declaring at-rule in CSS?
@-import
@import
at-import
at@import
Which of the following line of code can be used to hide the image?
img { display: 0;}
img { display: block; }
img { display: none; }
img { display: empty; }
Which of the following would be used to create the class called header which has a width of 200px and the color of the text is blue?
header {width:750px; height:200px; color:blue; }
.header { width:750px; height:200px; color:blue; }
#header { width:200px; width:750px; text:blue;}
header(height=200px; width=750px; color-blue; }
Which of these tags breaks the tenet of the separation of content and layout?
Body
Font
h1
Which of these is not valid? (Hint, pay attention to if the method should return one thing or more)
document.getElementsById(idName)
document.getElementsByClassName(className)
document.getElementsByTagName(tagName)
document.getname(Name)
Which snippet of CSS is commonly used to center an element horizontally?
site-align: center;
margin: auto 0;
margin: 0 auto;
margin: center;
The image will scale down if it has to, but never scale up to be larger than its original size. Which code is right?
Width:100%
Max-width:100%
Scale: 100%
min-width: 100%
Which is the correct CSS syntax?
{body;color:black;}
body:color=black;
(body color-black;}
body {color: black;}
Which method is used to search for a match, and returns the position of the match?
match()
search()
test()
replace()
How do you make the text bold?
style:bold;
font-weight:bold;
font:bold;
text:bold;
How do you make each word in a text start with a capital letter?
text-transform capitale
transform: capitalize
text-style: capitalize
style cap
How many type faces inside property "font-family"?
1
Maximum 2
No Limit
Maximum 3
How much horizontal space ("width") will this div use? div width:50px; padding: 10px; margin: 5px; border: 2px; }
74px
50px
70px
54px
How can you created rounded corners using CSS3?
border[round]: 30px;
border-radius: 30px;
corner-effect: round;
alpha-effect: round-corner,
How many ways are there to integrate CSS into a web page?
2
3
4
5
How do you properly access the third element in an array variable named "fruit"?
[fruit]3
fruit[3]
fruit_3
None of the others
How do you display hyperlinks without an underline?
a (underline:none;}
a (text-decoration:no-underline;}
a (decoration:no-underline;}
a {text-decoration:none;}
How to create transition effects using CSS3?
transition: width 2s;
transition-duration: 2s;
aphe-effect: transition (width 2s);
transition-effect: width;
How can you open a link in a new tab/browser window?
How can you insert a search icon?
Consider the below code: var x=5+5 var y='5"+5; var z="Hello" + 5; Which statement is right about the result of x,y,z?
10,55,Hello5
55,10,Hello5
Hello5,10,55
Hello5,55,10
Consider the following CSS rules: div width: 80%; @media all and (min-width:500px){ div{ } width: 25%; What is the width of any div elements on a 750px screen?
80%
100%
25%
Consider the code: h1 { color: blue; font-size: 20px;} Which of the following is called "selector"?
color and font-size
h1
All parts of the code above
blue and 20px
Consider the code .center { text-align: center color: red; What is the right statement?
All HTML elements with class="center" will be red and center-aligned.
only one HTML element with class="center" will be red and center-aligned.
only one HTML element with id="center" will be red and center-aligned.
All HTML elements with id="center" will be red and center-aligned.
Consider the code body font-size: 16px; Pl font-size: 100%; border: 1px solid black;
This is a song
The font-size of this document is 16px
The font size of the p element is 16px
The % unit sets the font-size relative to the font-size of the parent element.
All of the others
Consider some options: (A) Use relative units (B) we should set a static value for every HTML element, like 600 pixels. (C) Use a grid-view system (D) take control over the viewport, through the tag. (E) Use min-height, max-height properties for setting the size of the element. What option should be used in the fluid layout design?
A,B,C
B,C,E
A,C,D
B,D,E
Consider the code:
What code is the right statement to assign the sum of two integers 4,3 to the p tag at the r [MISSINGCODE]?document.getElementById("demo").innerHTML=myFun-tion(4,3);
Consider two statements: Statement 1: You can insert one or many "responsive breakpoints" in your stylesheet. But you should choose a mobile-first approach to design. Statement 2: Responsive web design generates many completed layouts. Each layout is done individually for each device type. Choose the right option.
Statement 1 is true, statement 2 is true
Statement 1 is false, statement 2 is false
Statement 1 is true, statement 2 is false
Statement 1 is false, statement 2 is true
Choose the right statement about the total width of a tag.
Total width: 320px
Total width: 300px
Total width: 310px
Total width: 370px
var op=document.createElement("option"); op.innerHTML="Apple"; Choose a right statement?
Create an option
Create an option with id="Apple"
Create an option and its HTML content is "Apple"
None of the others
Consider the following CSS rules: div { width: 80%; } @media all and (max-width: 767px) { div { width: 25%; } } What is the width of any div elements on a 500px screen?
80%
75%
100%
25%
Consider the following CSS rules: @media all and (max-width: 767px) { div { width: 50%; } } div { width: 80%; } What is the width of any div elements on a 500px screen?
80%
75%
100%
50%
function change(obj) { while(obj.length>0) obj.remove(0); } Choose a right statement?
None of the others
Remove an option
Remove an option by zero-based index
Remove all options by their index
Consider the below code: div {width:50%; height:300px; overflow:scroll; }
Script to be run when an element's scrollbar is being scrolled
The Script cannot run because the "onscroll" event is not supported by all browsers.
Script to be run when a div's scrollbar is being scrolled
Script to be run when window's scrollbar is being scrolled
Consider the code:
What code is the right statement to assign the sum of two integers 4,3 to the p tag at the row [MISSINGCODE]?document.getElementById("demo").innerHTML=myFun-tion(4,3);
document.getElementById("demo").innerHTML="4"+"3";
document.getElementById("demo").innerHTML= myFun-tion("4","3");
Consider the code:
What code is added at [MISSING CODE] to set the text "mango" of the variable arr to the input tag with id="demo"?document.getElementById("demo").text=arr
document.getElementById("demo").value=arr[1]
document.getElementById("demo")=arr[1]
document.getElementById("demo").value=arr[2]
Choose the right statement?
A Script to be run when an element's scrollbar is being scrolled
The Script cannot run because the 'onscroll' event is not supported by all browsers.
Script to be run when a div's scrollbar is being scrolled
Script to be run when window's scrollbar is being scrolled
What data does the form send to the page myscript.aspx after submitting?
nothing
female and ThiNo
female and male
1 and ThiNo
What statement do you use to change name = 'Nga' to 'My'?
Person.firstName='My'
Person[0].firstName='My'
Person[1].firstName='My'
none of the others
Choose the right statement about the code below?
the image will scale down if it has to, but never scale up to be larger than its original size
the image can be scaled up to be larger than its original size
the image is displayed in the same its original size
The image can scale up or down base on the viewport wide
Choose the right output?
Return array
Return all img tags in the tag with id='demo'
Return all img tags in a document.
None of the others
Choose the right statement?
A div element is formatted such as a double border-style and black border-color
A div element is formatted such as a single solid border-style and black border-color
A div element is formatted such as a double border-style and any border-color
A div element is formatted such as a dotted border-style and black border-color
Choose the right statement about the code below?
When the screen (browser window) gets smaller than 768px, each column should have a width of 100%
When the screen (browser window) gets greater than 768px, each column should have a width of 100%
Each column should have a width of 100% for any screen wide
When the screen (browser window) or mobile gets smaller than 768px, each column should have a width of 100%
Which of the following is a true statement?
The div elements will have a width of 25% only when the page is printed
The div elements will only visible only when the page is printed
The div elements will have a width of 80% only when the page is printed
A. The font-size of this document is 16px
B. The font-size of the div with id="mycss" is 2x the browser's font size
C. The rem unit sets the font-size relative to the browsers base font-size, and will not inherit from its parents.
D. All of the others
A. Statement 1 is true and statement 2 is true
B. Statement 1 is false and statement 2 is false
C. Statement 1 is true and statement 2 is false
D. Statement 1 is false and statement 2 is true
If the function was invoked from a statement, JavaScript will "return" to execute the code after the invoking statement. Choose the right option
A. Statement 1 is true, statement 2 is true
B. Statement 1 is false, statement 2 is false
C. Statement 1 is true, statement 2 is false
D. Statement 1 is false, statement 2 is true
A. A div element is formatted such as a double border-style and black border-color
B. A div element is formatted such as a single solid border-style and black border-color
C. A div element is formatted such as a double border-style and any border-color
D. A div element is formatted such as a dotted border-style and black border-color
Consider two statements: Statement 1: You can insert one or many "responsive breakpoints" in your stylesheet. This supports a mobile-first approach to design. Statement 2: Responsive web design generates many completed layouts. These are created individually for each device type.
Choose the right option
A. Statement 1 is true, statement 2 is true
B. Statement 1 is false, statement 2 is false
C. Statement 1 is true, statement 2 is false
D. Statement 1 is false, statement 2 is true
Consider two statements: Statement 1: The code inside the function will execute when "something" invokes (calls) the function. Statement 2: If the function was invoked from a statement, JavaScript will "return" to execute the code after the invoking statement.
Choose the right option
A. Statement 1 is true, statement 2 is true
B. Statement 1 is false, statement 2 is false
C. Statement 1 is true, statement 2 is false
D. Statement 1 is false, statement 2 is true
A. If the device's width is larger than 500px, the background color will change to light blue
B. If the device's width is smaller than 500px, the background color will change to light blue
C. If the browser window is larger than 500px, the background color will change to light blue
D. If the browser window is smaller than 500px, the background color will change to light blue
A. moves an element from its current position
B. moves an element from its (0,0) position
C. moves the <div>
element 50 pixels to the right, and 100 pixels down from its current position
D. moves the <div>
element 50 pixels to the right, and 100 pixels down from its (0,0) position
