Web programming & design Quiz 1/Quiz 2
Cascading Style Sheets
The acronym CSS stands for what? A. Cascading Style Sheets B. Carrot System Style C. Correlated Styling System D. Canvas Styling System
function myFunction( )
How do you create a function in JavaScript? A. function = my function( ) B. function myFunction( ) C. function: myFunction( ) D. myFunction{ }
Float:right;
If you wanted to position an element to the right in its container, what is a valid CSS property to use? A. Display:right; B. Float-right:0px; C. Display-right:0px; D. Float:right;
Absolute
If you wanted to put an HTML element at a certain position on the page regardless of the other elements, what value would you give the position property? A. Static B. Fixed C. Absolute D. Relative
:hover
Some HTML elements have multiple states, like the link, how do you give it a particular style when the user hovers over the elements? A. :onHover B. :hover C. :mouseOver D. :over
document.getElementById("demo").innerHTML = "Hello World!!";
What is the correct JavaScript syntax to change the content of the HTML element below? <p id="demo"> This is a demonstration.</p> A. (# demo").innerHTML = "Hello World!!"; B. document.getElementById("demo").innerHTML = "Hello World!!"; C. document.getElementByName("p") = "Hello World!!"; D. document.getElementById("demo").innerHTML = Hello World!!;
element.addClass("classname");
What is the correct way to add a CSS class to an element using JavaScript? A. element.addClass("classname"); B. element.css("classname"); C. element.attribute.class("classname"); D. element.setAttribute("class", "classname");
Color
What is the property used to set the class's text color? A. Text-color B. Text:color C. Color D. font-color
Margin
What property do you use to create spacing between HTML elements? A. Margin B. Spacing C. Padding D. Border
Padding
What property would you use to create space between the element's border and inner content? A. Margin B. Spacing C. Padding D. Border
Green
What will be printed in console by executing the following statements? var x = 0; if(x){ console.log("Blue"); } else{ console.log("Green"); } A. Blue B. Green C. undefined D. Error
Yellow - the inline style will get the highest specificity
What will be the final background-color of this div? <style type="text/css"> #red{ background-color: red; } .blue{ background-color: blue; } </style> <div id="red" class="blue" style="background-color: yellow;">SAMPLE DIV </div> A. Red - the id selector has higher specificity B. Blue - the .blue rule is after the #red rule C. Purple - blue and red will mix D. Yellow - the inline style will get the highest specificity
10
What will be the value of x after executing the following statements var x = 10 x + 7 A. 107 B. 17 C. 10 D. 7
9
What would be the final value of the following expression? "5" - - 4 A. 0 B. 1 C. 9 D. 54
["egg", "coffee", "banana", "orange"];
What would be the value of x after executing the following statements? var x = ["coffee", "banana", "orange"]; x.unshift("egg"); A. ["coffee", "banana", "orange"]; B. ["egg", "banana", "orange"]; C. ["coffee", "banana", "orange", "egg"]; D. ["egg", "coffee", "banana", "orange"];
onclick
Which event occurs when the user clicks on an HTML element? A. onmouseover B. onchange C. onclick D. onmouseclick
prompt ( );
Which function will show a popup and ask for an input from the user? A. alert( ); B. popup( ); C. confirm ( ); D. prompt ( );
Body{color: black}
Which is the correct CSS syntax? A. Body:color=black B. {body; color:black} C. {body:color=black(body} D. Body{color: black}
pop( );
Which method will return the last item from an array? A. push( ); B. pop( ); C. shift( ); D. reverse( );
var car = new Object( );
Which of the following statements will create an object? A. var car = new car( ); B. var car = new Object( ); C. var car = Object( ) D. var car = new OBJECT( );
Background-image
Which property is necessary to set an image in the background? A. Image B. Background-image C. Background:image D. Image:background