Font size
WorksheetsJavaScript (Jquery) Quiz # 2
Total questions: 40
Worksheet time: 25mins
The following is correct syntax for CSS
p { color: red; }
True
False
addClass() - Adds one or more classes to the____________.?
selected classes.
selected elements
None of the above
Which of the following is the correct syntax to Set CSS in JQuery?
$("p").css("background-color="yellow");
$("p").css("backgroundcolor", "yellow");
$("p").css("background-color", "yellow");
In order to make use of jQuery in our HTML page, which of the following lines of code must be put in our page?
<link rel="stylesheet" href="styles/style_anchor.css" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="script/jquery-3.6.0.js"></script>
<script src="script/jquery.slider.min.js"></script>
Given the following command in Javascript, which jQuery code will do the same thing?
document.getElementById("lastname").value
$(".lastname").val()
$("#lastname").val()
$("lastname").val()
Given the following HTML:
<a id="myLink" href="http://www.google.com">Google</a>
What text will the following code display in the alert box?
alert($("#myLink").attr("href"));
(a)
What will be the output of the following JavaScript code?
true
false
runtime error
logical error
What does the following selector: $("div"). will select in jQuery?
All div elements
The first div element
any one div element
The last div element
jQuery is a
JavaScript Language
JavaScript Library
JavaScript Method
JavaScript Class
What is the main purpose of jQuery?
Make CSS easier
Write less, do more
Replace JavaScript completely
Handle server-side operations
Which method changes CSS with jQuery?
.style()
.css()
.design()
.addStyle()
It is an alias of jQuery function.
(a)
Why was jQuery originally created
To replace HTML
To simplify and speed up JavaScript development
To remove the need for CSS
To build server-side applications
Which of the following is NOT a jQuery feature
DOM manipulation
Event handling
AJAX
Database management
How do I declare a variable named weekDay and set it to "Tuesday"?
weekDay = "Tuesday";
let weekDay = "Tuesday";
const weekDay = "Tuesday";
WeekDay = "Tuesday";
In JavaScript, how would I declare a constant myName?
constant myName = "Michael Phelps";
var myName = "Michael Phelps";
const MyName = "Captain Sparrow";
const myName = "Princess Buttercup";
What are the preferred (modern) coding conventions for declaring variables?
const
var
let
mkdir
The model representing the elements of a web page in a tree structure, created by the browser, is called...
Domain Object Model
HyperText Markup Model
Document Object Model
Domain Oriented Model
Predict the output:
<!DOCTYPE html>
<html>
<body>
<p id="test"></p>
<script>
function firstFunction(p1, p2) {
return p1 + p2;
}
document.getElementById("test").innerHTML = firstFunction(1, 5);
</script>
</body>
</html>
6
No output
Error while declaring the function
None of the above
Which line of html code would you use to add the image 'image.jpg' into index.html?
<img src="image.jpg">
<img href="image.jpg">
<img src="project/images/image.jpg">
<img src="images/image.jpg">
Where a script stores bits of information:
Variables
Identifier
Array
Code blocks
Where a list of values is stored:
Array
Identifier
Code block
Concatenation
Statements end with a ______________, which tells the JavaScript interpreter when a step is over, indicating that it should move to the next step.
semicolon
colon
period
comma
What is the value of "elem" variable?
var elem;
if ( 11 == 11 && 12 < 10 ){
elem = 12;
}else {
elem = 'undefined';
}
undefined
12
11
10
What is displayed on the browser?
function myFunction(){
document.write(myFunction === myFunction);
}
myFunction();
true
false
undefined
null
What is the value of
var fruits = ["A", "D", "F", "B"];
fruits.reverse();
alert(fruits)
A,B,D,F
B,F,D,A
null
undefined
What is != ?
What is the output?
condition
True
Program has a syntax error.
3 > 2
Predict the output of the following JavaScript code snippets.
8
Error
35
"35"
Which of the following is not a valid way to declare a variable in JavaScript?
var x =5;
let y = 10;
const z = 15;
int w = 20;
What will this code display?
570
569
568
attendees
JavaScript : What is the alert display for text3 ?
John Doe
JohnDoe
"John" " " "Doe"
"JohnDoe"
What would this piece of code display?
let x = 5;
console.log(x != 8);
false
x!=8
true
8
The Document Object Model (DOM) can be used to:
Find elements by class
Create new elements
Retrieve data from a server
Change element styles
What will this code display?
8, 2, 1, 4, 7
82147
Myarray.length
5
Which of these is a method?
getElementById( )
style
document
color
What is the "++" operator called ?
Incrementing
Decrementing
Two Additions
